Fix StyledToast
This commit is contained in:
parent
12f4f6e192
commit
975fb1a45c
|
@ -1,7 +1,7 @@
|
|||
import 'package:fluffychat/l10n/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
|
||||
class SimpleDialogs {
|
||||
final BuildContext context;
|
||||
|
@ -149,10 +149,10 @@ class SimpleDialogs {
|
|||
onAdditionalAuth != null) {
|
||||
return await tryRequestWithErrorToast(onAdditionalAuth(exception));
|
||||
} else {
|
||||
showToast(exception.errorMessage);
|
||||
BotToast.showText(text: exception.errorMessage);
|
||||
}
|
||||
} catch (exception) {
|
||||
showToast(exception.toString());
|
||||
BotToast.showText(text: exception.toString());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import 'package:fluffychat/l10n/l10n.dart';
|
|||
import 'package:fluffychat/utils/app_route.dart';
|
||||
import 'package:fluffychat/views/chat_encryption_settings.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 'matrix.dart';
|
||||
|
@ -22,7 +22,7 @@ class _EncryptionButtonState extends State<EncryptionButton> {
|
|||
|
||||
void _enableEncryptionAction() async {
|
||||
if (widget.room.encrypted) {
|
||||
showToast(L10n.of(context).warningEncryptionInBeta);
|
||||
BotToast.showText(text: L10n.of(context).warningEncryptionInBeta);
|
||||
await Navigator.of(context).push(
|
||||
AppRoute.defaultRoute(
|
||||
context,
|
||||
|
@ -32,7 +32,7 @@ class _EncryptionButtonState extends State<EncryptionButton> {
|
|||
return;
|
||||
}
|
||||
if (!widget.room.client.encryptionEnabled) {
|
||||
showToast(L10n.of(context).needPantalaimonWarning);
|
||||
BotToast.showText(text: L10n.of(context).needPantalaimonWarning);
|
||||
return;
|
||||
}
|
||||
if (await SimpleDialogs(context).askConfirmation(
|
||||
|
|
|
@ -2,7 +2,7 @@ import 'package:famedlysdk/famedlysdk.dart';
|
|||
import 'package:fluffychat/views/chat.dart';
|
||||
import 'package:flutter/material.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 '../../l10n/l10n.dart';
|
||||
|
@ -31,7 +31,7 @@ class ChatListItem extends StatelessWidget {
|
|||
}
|
||||
|
||||
if (room.membership == Membership.ban) {
|
||||
showToast(L10n.of(context).youHaveBeenBannedFromThisChat);
|
||||
BotToast.showText(text: L10n.of(context).youHaveBeenBannedFromThisChat);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import 'package:flutter/foundation.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.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 'components/theme_switcher.dart';
|
||||
|
@ -31,10 +31,9 @@ class App extends StatelessWidget {
|
|||
child: Builder(
|
||||
// Workaround for: https://github.com/JackJonson/flutter_styled_toast/issues/7
|
||||
builder: (BuildContext context) => MaterialApp(
|
||||
home: StyledToast(
|
||||
duration: Duration(seconds: 5),
|
||||
child: MaterialApp(
|
||||
title: 'FluffyChat',
|
||||
builder: BotToastInit(),
|
||||
navigatorObservers: [BotToastNavigatorObserver()],
|
||||
theme: ThemeSwitcherWidget.of(context).themeData,
|
||||
localizationsDelegates: [
|
||||
AppLocalizationsDelegate(),
|
||||
|
@ -52,11 +51,8 @@ class App extends StatelessWidget {
|
|||
? Locale(html.window.navigator.language.split("-").first)
|
||||
: null,
|
||||
home: FutureBuilder<LoginState>(
|
||||
future: Matrix.of(context)
|
||||
.client
|
||||
.onLoginStateChanged
|
||||
.stream
|
||||
.first,
|
||||
future:
|
||||
Matrix.of(context).client.onLoginStateChanged.stream.first,
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData) {
|
||||
return Scaffold(
|
||||
|
@ -75,8 +71,6 @@ class App extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import 'package:fluffychat/views/chat.dart';
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.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:famedlysdk/famedlysdk.dart';
|
||||
import 'famedlysdk_store.dart';
|
||||
|
@ -33,8 +33,8 @@ abstract class FirebaseController {
|
|||
token = null;
|
||||
}
|
||||
if (token?.isEmpty ?? true) {
|
||||
showToast(
|
||||
L10n.of(context).noGoogleServicesWarning,
|
||||
BotToast.showText(
|
||||
text: L10n.of(context).noGoogleServicesWarning,
|
||||
duration: Duration(seconds: 15),
|
||||
);
|
||||
return;
|
||||
|
@ -67,7 +67,7 @@ abstract class FirebaseController {
|
|||
),
|
||||
(r) => r.isFirst);
|
||||
} catch (_) {
|
||||
showToast("Failed to open chat...");
|
||||
BotToast.showText(text: "Failed to open chat...");
|
||||
debugPrint(_);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -15,7 +15,7 @@ import 'package:fluffychat/l10n/l10n.dart';
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.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:pedantic/pedantic.dart';
|
||||
|
||||
|
@ -177,7 +177,7 @@ class _ChatState extends State<_Chat> {
|
|||
|
||||
void sendFileAction(BuildContext context) async {
|
||||
if (kIsWeb) {
|
||||
showToast(L10n.of(context).notSupportedInWeb);
|
||||
BotToast.showText(text: L10n.of(context).notSupportedInWeb);
|
||||
return;
|
||||
}
|
||||
File file = await FilePicker.getFile();
|
||||
|
@ -191,7 +191,7 @@ class _ChatState extends State<_Chat> {
|
|||
|
||||
void sendImageAction(BuildContext context) async {
|
||||
if (kIsWeb) {
|
||||
showToast(L10n.of(context).notSupportedInWeb);
|
||||
BotToast.showText(text: L10n.of(context).notSupportedInWeb);
|
||||
return;
|
||||
}
|
||||
File file = await ImagePicker.pickImage(
|
||||
|
@ -209,7 +209,7 @@ class _ChatState extends State<_Chat> {
|
|||
|
||||
void openCameraAction(BuildContext context) async {
|
||||
if (kIsWeb) {
|
||||
showToast(L10n.of(context).notSupportedInWeb);
|
||||
BotToast.showText(text: L10n.of(context).notSupportedInWeb);
|
||||
return;
|
||||
}
|
||||
File file = await ImagePicker.pickImage(
|
||||
|
|
|
@ -13,7 +13,7 @@ import 'package:fluffychat/views/invitation_selection.dart';
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.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:link_text/link_text.dart';
|
||||
import './settings_emotes.dart';
|
||||
|
@ -40,7 +40,7 @@ class _ChatDetailsState extends State<ChatDetails> {
|
|||
widget.room.setName(displayname),
|
||||
);
|
||||
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),
|
||||
);
|
||||
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) {
|
||||
showToast(L10n.of(context).avatarHasBeenChanged);
|
||||
BotToast.showText(text: L10n.of(context).avatarHasBeenChanged);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,8 @@ class _ChatDetailsState extends State<ChatDetails> {
|
|||
Clipboard.setData(
|
||||
ClipboardData(text: widget.room.canonicalAlias),
|
||||
);
|
||||
showToast(L10n.of(context).copiedToClipboard);
|
||||
BotToast.showText(
|
||||
text: L10n.of(context).copiedToClipboard);
|
||||
},
|
||||
),
|
||||
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/l10n/l10n.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';
|
||||
|
||||
|
@ -58,7 +58,7 @@ class _InvitationSelectionState extends State<InvitationSelection> {
|
|||
widget.room.invite(id),
|
||||
);
|
||||
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:famedlysdk/famedlysdk.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 '../components/adaptive_page_layout.dart';
|
||||
|
@ -371,7 +371,7 @@ class _EmoteImagePickerState extends State<_EmoteImagePicker> {
|
|||
),
|
||||
onPressed: () async {
|
||||
if (kIsWeb) {
|
||||
showToast(L10n.of(context).notSupportedInWeb);
|
||||
BotToast.showText(text: L10n.of(context).notSupportedInWeb);
|
||||
return;
|
||||
}
|
||||
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/views/auth_web_view.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';
|
||||
|
||||
|
@ -96,7 +96,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
|
|||
try {
|
||||
await matrix.client.setDisplayname(widget.displayname);
|
||||
} catch (exception) {
|
||||
showToast(L10n.of(context).couldNotSetDisplayname);
|
||||
BotToast.showText(text: L10n.of(context).couldNotSetDisplayname);
|
||||
}
|
||||
if (widget.avatar != null) {
|
||||
try {
|
||||
|
@ -107,7 +107,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
|
|||
),
|
||||
);
|
||||
} catch (exception) {
|
||||
showToast(L10n.of(context).couldNotSetAvatar);
|
||||
BotToast.showText(text: L10n.of(context).couldNotSetAvatar);
|
||||
}
|
||||
}
|
||||
await Navigator.of(context).pushAndRemoveUntil(
|
||||
|
|
14
pubspec.lock
14
pubspec.lock
|
@ -43,6 +43,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
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:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -216,13 +223,6 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
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:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -53,7 +53,7 @@ dependencies:
|
|||
flutter_sound: ^2.1.1
|
||||
open_file: ^3.0.1
|
||||
mime_type: ^0.3.0
|
||||
flutter_styled_toast: ^1.2.1
|
||||
bot_toast: ^3.0.0
|
||||
flutter_matrix_html: ^0.0.5
|
||||
|
||||
intl: ^0.16.0
|
||||
|
|
Loading…
Reference in a new issue