Fix StyledToast
This commit is contained in:
parent
12f4f6e192
commit
975fb1a45c
|
@ -1,7 +1,7 @@
|
||||||
import 'package:fluffychat/l10n/l10n.dart';
|
import 'package:fluffychat/l10n/l10n.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:famedlysdk/famedlysdk.dart';
|
import 'package:famedlysdk/famedlysdk.dart';
|
||||||
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
|
import 'package:bot_toast/bot_toast.dart';
|
||||||
|
|
||||||
class SimpleDialogs {
|
class SimpleDialogs {
|
||||||
final BuildContext context;
|
final BuildContext context;
|
||||||
|
@ -117,7 +117,7 @@ class SimpleDialogs {
|
||||||
builder: (c) => AlertDialog(
|
builder: (c) => AlertDialog(
|
||||||
title: titleText != null ? Text(titleText) : null,
|
title: titleText != null ? Text(titleText) : null,
|
||||||
content: contentText != null ? Text(contentText) : null,
|
content: contentText != null ? Text(contentText) : null,
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
FlatButton(
|
FlatButton(
|
||||||
child: Text(
|
child: Text(
|
||||||
okText ?? L10n.of(context).ok.toUpperCase(),
|
okText ?? L10n.of(context).ok.toUpperCase(),
|
||||||
|
@ -149,10 +149,10 @@ class SimpleDialogs {
|
||||||
onAdditionalAuth != null) {
|
onAdditionalAuth != null) {
|
||||||
return await tryRequestWithErrorToast(onAdditionalAuth(exception));
|
return await tryRequestWithErrorToast(onAdditionalAuth(exception));
|
||||||
} else {
|
} else {
|
||||||
showToast(exception.errorMessage);
|
BotToast.showText(text: exception.errorMessage);
|
||||||
}
|
}
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
showToast(exception.toString());
|
BotToast.showText(text: exception.toString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import 'package:fluffychat/l10n/l10n.dart';
|
||||||
import 'package:fluffychat/utils/app_route.dart';
|
import 'package:fluffychat/utils/app_route.dart';
|
||||||
import 'package:fluffychat/views/chat_encryption_settings.dart';
|
import 'package:fluffychat/views/chat_encryption_settings.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
|
import 'package:bot_toast/bot_toast.dart';
|
||||||
|
|
||||||
import 'dialogs/simple_dialogs.dart';
|
import 'dialogs/simple_dialogs.dart';
|
||||||
import 'matrix.dart';
|
import 'matrix.dart';
|
||||||
|
@ -22,7 +22,7 @@ class _EncryptionButtonState extends State<EncryptionButton> {
|
||||||
|
|
||||||
void _enableEncryptionAction() async {
|
void _enableEncryptionAction() async {
|
||||||
if (widget.room.encrypted) {
|
if (widget.room.encrypted) {
|
||||||
showToast(L10n.of(context).warningEncryptionInBeta);
|
BotToast.showText(text: L10n.of(context).warningEncryptionInBeta);
|
||||||
await Navigator.of(context).push(
|
await Navigator.of(context).push(
|
||||||
AppRoute.defaultRoute(
|
AppRoute.defaultRoute(
|
||||||
context,
|
context,
|
||||||
|
@ -32,7 +32,7 @@ class _EncryptionButtonState extends State<EncryptionButton> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!widget.room.client.encryptionEnabled) {
|
if (!widget.room.client.encryptionEnabled) {
|
||||||
showToast(L10n.of(context).needPantalaimonWarning);
|
BotToast.showText(text: L10n.of(context).needPantalaimonWarning);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (await SimpleDialogs(context).askConfirmation(
|
if (await SimpleDialogs(context).askConfirmation(
|
||||||
|
|
|
@ -2,7 +2,7 @@ import 'package:famedlysdk/famedlysdk.dart';
|
||||||
import 'package:fluffychat/views/chat.dart';
|
import 'package:fluffychat/views/chat.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
|
import 'package:bot_toast/bot_toast.dart';
|
||||||
import 'package:pedantic/pedantic.dart';
|
import 'package:pedantic/pedantic.dart';
|
||||||
|
|
||||||
import '../../l10n/l10n.dart';
|
import '../../l10n/l10n.dart';
|
||||||
|
@ -31,7 +31,7 @@ class ChatListItem extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (room.membership == Membership.ban) {
|
if (room.membership == Membership.ban) {
|
||||||
showToast(L10n.of(context).youHaveBeenBannedFromThisChat);
|
BotToast.showText(text: L10n.of(context).youHaveBeenBannedFromThisChat);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
|
import 'package:bot_toast/bot_toast.dart';
|
||||||
|
|
||||||
import 'l10n/l10n.dart';
|
import 'l10n/l10n.dart';
|
||||||
import 'components/theme_switcher.dart';
|
import 'components/theme_switcher.dart';
|
||||||
|
@ -31,47 +31,41 @@ class App extends StatelessWidget {
|
||||||
child: Builder(
|
child: Builder(
|
||||||
// Workaround for: https://github.com/JackJonson/flutter_styled_toast/issues/7
|
// Workaround for: https://github.com/JackJonson/flutter_styled_toast/issues/7
|
||||||
builder: (BuildContext context) => MaterialApp(
|
builder: (BuildContext context) => MaterialApp(
|
||||||
home: StyledToast(
|
title: 'FluffyChat',
|
||||||
duration: Duration(seconds: 5),
|
builder: BotToastInit(),
|
||||||
child: MaterialApp(
|
navigatorObservers: [BotToastNavigatorObserver()],
|
||||||
title: 'FluffyChat',
|
theme: ThemeSwitcherWidget.of(context).themeData,
|
||||||
theme: ThemeSwitcherWidget.of(context).themeData,
|
localizationsDelegates: [
|
||||||
localizationsDelegates: [
|
AppLocalizationsDelegate(),
|
||||||
AppLocalizationsDelegate(),
|
GlobalMaterialLocalizations.delegate,
|
||||||
GlobalMaterialLocalizations.delegate,
|
GlobalWidgetsLocalizations.delegate,
|
||||||
GlobalWidgetsLocalizations.delegate,
|
GlobalCupertinoLocalizations.delegate,
|
||||||
GlobalCupertinoLocalizations.delegate,
|
],
|
||||||
],
|
supportedLocales: [
|
||||||
supportedLocales: [
|
const Locale('en'), // English
|
||||||
const Locale('en'), // English
|
const Locale('de'), // German
|
||||||
const Locale('de'), // German
|
const Locale('hu'), // Hungarian
|
||||||
const Locale('hu'), // Hungarian
|
const Locale('pl'), // Polish
|
||||||
const Locale('pl'), // Polish
|
],
|
||||||
],
|
locale: kIsWeb
|
||||||
locale: kIsWeb
|
? Locale(html.window.navigator.language.split("-").first)
|
||||||
? Locale(html.window.navigator.language.split("-").first)
|
: null,
|
||||||
: null,
|
home: FutureBuilder<LoginState>(
|
||||||
home: FutureBuilder<LoginState>(
|
future:
|
||||||
future: Matrix.of(context)
|
Matrix.of(context).client.onLoginStateChanged.stream.first,
|
||||||
.client
|
builder: (context, snapshot) {
|
||||||
.onLoginStateChanged
|
if (!snapshot.hasData) {
|
||||||
.stream
|
return Scaffold(
|
||||||
.first,
|
body: Center(
|
||||||
builder: (context, snapshot) {
|
child: CircularProgressIndicator(),
|
||||||
if (!snapshot.hasData) {
|
),
|
||||||
return Scaffold(
|
);
|
||||||
body: Center(
|
}
|
||||||
child: CircularProgressIndicator(),
|
if (Matrix.of(context).client.isLogged()) {
|
||||||
),
|
return ChatListView();
|
||||||
);
|
}
|
||||||
}
|
return HomeserverPicker();
|
||||||
if (Matrix.of(context).client.isLogged()) {
|
},
|
||||||
return ChatListView();
|
|
||||||
}
|
|
||||||
return HomeserverPicker();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -9,7 +9,7 @@ import 'package:fluffychat/views/chat.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||||
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
|
import 'package:bot_toast/bot_toast.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:famedlysdk/famedlysdk.dart';
|
import 'package:famedlysdk/famedlysdk.dart';
|
||||||
import 'famedlysdk_store.dart';
|
import 'famedlysdk_store.dart';
|
||||||
|
@ -33,8 +33,8 @@ abstract class FirebaseController {
|
||||||
token = null;
|
token = null;
|
||||||
}
|
}
|
||||||
if (token?.isEmpty ?? true) {
|
if (token?.isEmpty ?? true) {
|
||||||
showToast(
|
BotToast.showText(
|
||||||
L10n.of(context).noGoogleServicesWarning,
|
text: L10n.of(context).noGoogleServicesWarning,
|
||||||
duration: Duration(seconds: 15),
|
duration: Duration(seconds: 15),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
@ -67,7 +67,7 @@ abstract class FirebaseController {
|
||||||
),
|
),
|
||||||
(r) => r.isFirst);
|
(r) => r.isFirst);
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
showToast("Failed to open chat...");
|
BotToast.showText(text: "Failed to open chat...");
|
||||||
debugPrint(_);
|
debugPrint(_);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,7 +15,7 @@ import 'package:fluffychat/l10n/l10n.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
|
import 'package:bot_toast/bot_toast.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
import 'package:pedantic/pedantic.dart';
|
import 'package:pedantic/pedantic.dart';
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ class _ChatState extends State<_Chat> {
|
||||||
|
|
||||||
void sendFileAction(BuildContext context) async {
|
void sendFileAction(BuildContext context) async {
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
showToast(L10n.of(context).notSupportedInWeb);
|
BotToast.showText(text: L10n.of(context).notSupportedInWeb);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
File file = await FilePicker.getFile();
|
File file = await FilePicker.getFile();
|
||||||
|
@ -191,7 +191,7 @@ class _ChatState extends State<_Chat> {
|
||||||
|
|
||||||
void sendImageAction(BuildContext context) async {
|
void sendImageAction(BuildContext context) async {
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
showToast(L10n.of(context).notSupportedInWeb);
|
BotToast.showText(text: L10n.of(context).notSupportedInWeb);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
File file = await ImagePicker.pickImage(
|
File file = await ImagePicker.pickImage(
|
||||||
|
@ -209,7 +209,7 @@ class _ChatState extends State<_Chat> {
|
||||||
|
|
||||||
void openCameraAction(BuildContext context) async {
|
void openCameraAction(BuildContext context) async {
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
showToast(L10n.of(context).notSupportedInWeb);
|
BotToast.showText(text: L10n.of(context).notSupportedInWeb);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
File file = await ImagePicker.pickImage(
|
File file = await ImagePicker.pickImage(
|
||||||
|
|
|
@ -13,7 +13,7 @@ import 'package:fluffychat/views/invitation_selection.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
|
import 'package:bot_toast/bot_toast.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
import 'package:link_text/link_text.dart';
|
import 'package:link_text/link_text.dart';
|
||||||
import './settings_emotes.dart';
|
import './settings_emotes.dart';
|
||||||
|
@ -40,7 +40,7 @@ class _ChatDetailsState extends State<ChatDetails> {
|
||||||
widget.room.setName(displayname),
|
widget.room.setName(displayname),
|
||||||
);
|
);
|
||||||
if (success != false) {
|
if (success != false) {
|
||||||
showToast(L10n.of(context).displaynameHasBeenChanged);
|
BotToast.showText(text: L10n.of(context).displaynameHasBeenChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ class _ChatDetailsState extends State<ChatDetails> {
|
||||||
widget.room.setDescription(displayname),
|
widget.room.setDescription(displayname),
|
||||||
);
|
);
|
||||||
if (success != false) {
|
if (success != false) {
|
||||||
showToast(L10n.of(context).groupDescriptionHasBeenChanged);
|
BotToast.showText(text: L10n.of(context).groupDescriptionHasBeenChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ class _ChatDetailsState extends State<ChatDetails> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
if (success != false) {
|
if (success != false) {
|
||||||
showToast(L10n.of(context).avatarHasBeenChanged);
|
BotToast.showText(text: L10n.of(context).avatarHasBeenChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +172,8 @@ class _ChatDetailsState extends State<ChatDetails> {
|
||||||
Clipboard.setData(
|
Clipboard.setData(
|
||||||
ClipboardData(text: widget.room.canonicalAlias),
|
ClipboardData(text: widget.room.canonicalAlias),
|
||||||
);
|
);
|
||||||
showToast(L10n.of(context).copiedToClipboard);
|
BotToast.showText(
|
||||||
|
text: L10n.of(context).copiedToClipboard);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ChatSettingsPopupMenu(widget.room, false)
|
ChatSettingsPopupMenu(widget.room, false)
|
||||||
|
|
|
@ -7,7 +7,7 @@ import 'package:fluffychat/components/dialogs/simple_dialogs.dart';
|
||||||
import 'package:fluffychat/components/matrix.dart';
|
import 'package:fluffychat/components/matrix.dart';
|
||||||
import 'package:fluffychat/l10n/l10n.dart';
|
import 'package:fluffychat/l10n/l10n.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
|
import 'package:bot_toast/bot_toast.dart';
|
||||||
|
|
||||||
import 'chat_list.dart';
|
import 'chat_list.dart';
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ class _InvitationSelectionState extends State<InvitationSelection> {
|
||||||
widget.room.invite(id),
|
widget.room.invite(id),
|
||||||
);
|
);
|
||||||
if (success != false) {
|
if (success != false) {
|
||||||
showToast(L10n.of(context).contactHasBeenInvitedToTheGroup);
|
BotToast.showText(text: L10n.of(context).contactHasBeenInvitedToTheGroup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter_advanced_networkimage/provider.dart';
|
import 'package:flutter_advanced_networkimage/provider.dart';
|
||||||
import 'package:famedlysdk/famedlysdk.dart';
|
import 'package:famedlysdk/famedlysdk.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
|
import 'package:bot_toast/bot_toast.dart';
|
||||||
|
|
||||||
import 'chat_list.dart';
|
import 'chat_list.dart';
|
||||||
import '../components/adaptive_page_layout.dart';
|
import '../components/adaptive_page_layout.dart';
|
||||||
|
@ -371,7 +371,7 @@ class _EmoteImagePickerState extends State<_EmoteImagePicker> {
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
showToast(L10n.of(context).notSupportedInWeb);
|
BotToast.showText(text: L10n.of(context).notSupportedInWeb);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
File file = await ImagePicker.pickImage(
|
File file = await ImagePicker.pickImage(
|
||||||
|
|
|
@ -7,7 +7,7 @@ import 'package:fluffychat/l10n/l10n.dart';
|
||||||
import 'package:fluffychat/utils/app_route.dart';
|
import 'package:fluffychat/utils/app_route.dart';
|
||||||
import 'package:fluffychat/views/auth_web_view.dart';
|
import 'package:fluffychat/views/auth_web_view.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
|
import 'package:bot_toast/bot_toast.dart';
|
||||||
|
|
||||||
import 'chat_list.dart';
|
import 'chat_list.dart';
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
|
||||||
try {
|
try {
|
||||||
await matrix.client.setDisplayname(widget.displayname);
|
await matrix.client.setDisplayname(widget.displayname);
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
showToast(L10n.of(context).couldNotSetDisplayname);
|
BotToast.showText(text: L10n.of(context).couldNotSetDisplayname);
|
||||||
}
|
}
|
||||||
if (widget.avatar != null) {
|
if (widget.avatar != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -107,7 +107,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
showToast(L10n.of(context).couldNotSetAvatar);
|
BotToast.showText(text: L10n.of(context).couldNotSetAvatar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await Navigator.of(context).pushAndRemoveUntil(
|
await Navigator.of(context).pushAndRemoveUntil(
|
||||||
|
|
14
pubspec.lock
14
pubspec.lock
|
@ -43,6 +43,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.0.0"
|
||||||
|
bot_toast:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: bot_toast
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.0"
|
||||||
bubble:
|
bubble:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -216,13 +223,6 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.5"
|
version: "1.2.5"
|
||||||
flutter_styled_toast:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: flutter_styled_toast
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.2.1"
|
|
||||||
flutter_svg:
|
flutter_svg:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -53,7 +53,7 @@ dependencies:
|
||||||
flutter_sound: ^2.1.1
|
flutter_sound: ^2.1.1
|
||||||
open_file: ^3.0.1
|
open_file: ^3.0.1
|
||||||
mime_type: ^0.3.0
|
mime_type: ^0.3.0
|
||||||
flutter_styled_toast: ^1.2.1
|
bot_toast: ^3.0.0
|
||||||
flutter_matrix_html: ^0.0.5
|
flutter_matrix_html: ^0.0.5
|
||||||
|
|
||||||
intl: ^0.16.0
|
intl: ^0.16.0
|
||||||
|
|
Loading…
Reference in a new issue