Fix StyledToast

This commit is contained in:
Christian Pauly 2020-05-13 10:45:50 +02:00
commit 9f4660bd9f
12 changed files with 74 additions and 79 deletions

View file

@ -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;
@ -117,7 +117,7 @@ class SimpleDialogs {
builder: (c) => AlertDialog(
title: titleText != null ? Text(titleText) : null,
content: contentText != null ? Text(contentText) : null,
actions: <Widget>[
actions: <Widget>[
FlatButton(
child: Text(
okText ?? L10n.of(context).ok.toUpperCase(),
@ -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;
}
}

View file

@ -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(

View file

@ -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;
}