fix: Dialogs

This commit is contained in:
Christian Pauly 2021-01-19 15:46:43 +01:00
parent 1805a479a3
commit 5f0ce49c46
11 changed files with 104 additions and 68 deletions

View File

@ -11,10 +11,14 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
import '../matrix.dart'; import '../matrix.dart';
class BootstrapDialog extends StatefulWidget { class BootstrapDialog extends StatefulWidget {
const BootstrapDialog({Key key, @required this.l10n}) : super(key: key);
Future<bool> show(BuildContext context) => PlatformInfos.isCupertinoStyle Future<bool> show(BuildContext context) => PlatformInfos.isCupertinoStyle
? showCupertinoDialog(context: context, builder: (context) => this) ? showCupertinoDialog(context: context, builder: (context) => this)
: showDialog(context: context, builder: (context) => this); : showDialog(context: context, builder: (context) => this);
final L10n l10n;
@override @override
_BootstrapDialogState createState() => _BootstrapDialogState(); _BootstrapDialogState createState() => _BootstrapDialogState();
} }
@ -39,36 +43,36 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
case BootstrapState.askWipeSsss: case BootstrapState.askWipeSsss:
body = Text('Wipe chat backup?'); body = Text('Wipe chat backup?');
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
child: Text(L10n.of(context).yes), child: Text(widget.l10n.yes),
onPressed: () => bootstrap.wipeSsss(true), onPressed: () => bootstrap.wipeSsss(true),
)); ));
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
textColor: Theme.of(context).textTheme.bodyText1.color, textColor: Theme.of(context).textTheme.bodyText1.color,
child: Text(L10n.of(context).no), child: Text(widget.l10n.no),
onPressed: () => bootstrap.wipeSsss(false), onPressed: () => bootstrap.wipeSsss(false),
)); ));
break; break;
case BootstrapState.askUseExistingSsss: case BootstrapState.askUseExistingSsss:
body = Text('Use existing chat backup?'); body = Text('Use existing chat backup?');
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
child: Text(L10n.of(context).yes), child: Text(widget.l10n.yes),
onPressed: () => bootstrap.useExistingSsss(true), onPressed: () => bootstrap.useExistingSsss(true),
)); ));
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
textColor: Theme.of(context).textTheme.bodyText1.color, textColor: Theme.of(context).textTheme.bodyText1.color,
child: Text(L10n.of(context).no), child: Text(widget.l10n.no),
onPressed: () => bootstrap.useExistingSsss(false), onPressed: () => bootstrap.useExistingSsss(false),
)); ));
break; break;
case BootstrapState.askBadSsss: case BootstrapState.askBadSsss:
body = Text('SSSS bad - continue nevertheless? DATALOSS!!!'); body = Text('SSSS bad - continue nevertheless? DATALOSS!!!');
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
child: Text(L10n.of(context).yes), child: Text(widget.l10n.yes),
onPressed: () => bootstrap.ignoreBadSecrets(true), onPressed: () => bootstrap.ignoreBadSecrets(true),
)); ));
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
textColor: Theme.of(context).textTheme.bodyText1.color, textColor: Theme.of(context).textTheme.bodyText1.color,
child: Text(L10n.of(context).no), child: Text(widget.l10n.no),
onPressed: () => bootstrap.ignoreBadSecrets(false), onPressed: () => bootstrap.ignoreBadSecrets(false),
)); ));
break; break;
@ -77,14 +81,15 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
for (final entry in bootstrap.oldSsssKeys.entries) { for (final entry in bootstrap.oldSsssKeys.entries) {
final keyId = entry.key; final keyId = entry.key;
final key = entry.value; final key = entry.value;
widgets.add(Flexible(child: _AskUnlockOldSsss(keyId, key))); widgets
.add(Flexible(child: _AskUnlockOldSsss(keyId, key, widget.l10n)));
} }
body = Column( body = Column(
children: widgets, children: widgets,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
); );
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
child: Text(L10n.of(context).confirm), child: Text(widget.l10n.confirm),
onPressed: () => bootstrap.unlockedSsss(), onPressed: () => bootstrap.unlockedSsss(),
)); ));
break; break;
@ -130,19 +135,19 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
case BootstrapState.askWipeCrossSigning: case BootstrapState.askWipeCrossSigning:
body = Text('Wipe cross-signing?'); body = Text('Wipe cross-signing?');
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
child: Text(L10n.of(context).yes), child: Text(widget.l10n.yes),
onPressed: () => bootstrap.wipeCrossSigning(true), onPressed: () => bootstrap.wipeCrossSigning(true),
)); ));
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
textColor: Theme.of(context).textTheme.bodyText1.color, textColor: Theme.of(context).textTheme.bodyText1.color,
child: Text(L10n.of(context).no), child: Text(widget.l10n.no),
onPressed: () => bootstrap.wipeCrossSigning(false), onPressed: () => bootstrap.wipeCrossSigning(false),
)); ));
break; break;
case BootstrapState.askSetupCrossSigning: case BootstrapState.askSetupCrossSigning:
body = Text('Set up cross-signing?'); body = Text('Set up cross-signing?');
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
child: Text(L10n.of(context).yes), child: Text(widget.l10n.yes),
onPressed: () => bootstrap.askSetupCrossSigning( onPressed: () => bootstrap.askSetupCrossSigning(
setupMasterKey: true, setupMasterKey: true,
setupSelfSigningKey: true, setupSelfSigningKey: true,
@ -151,31 +156,31 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
)); ));
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
textColor: Theme.of(context).textTheme.bodyText1.color, textColor: Theme.of(context).textTheme.bodyText1.color,
child: Text(L10n.of(context).no), child: Text(widget.l10n.no),
onPressed: () => bootstrap.askSetupCrossSigning(), onPressed: () => bootstrap.askSetupCrossSigning(),
)); ));
break; break;
case BootstrapState.askWipeOnlineKeyBackup: case BootstrapState.askWipeOnlineKeyBackup:
body = Text('Wipe chat backup?'); body = Text('Wipe chat backup?');
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
child: Text(L10n.of(context).yes), child: Text(widget.l10n.yes),
onPressed: () => bootstrap.wipeOnlineKeyBackup(true), onPressed: () => bootstrap.wipeOnlineKeyBackup(true),
)); ));
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
textColor: Theme.of(context).textTheme.bodyText1.color, textColor: Theme.of(context).textTheme.bodyText1.color,
child: Text(L10n.of(context).no), child: Text(widget.l10n.no),
onPressed: () => bootstrap.wipeOnlineKeyBackup(false), onPressed: () => bootstrap.wipeOnlineKeyBackup(false),
)); ));
break; break;
case BootstrapState.askSetupOnlineKeyBackup: case BootstrapState.askSetupOnlineKeyBackup:
body = Text('Set up chat backup?'); body = Text('Set up chat backup?');
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
child: Text(L10n.of(context).yes), child: Text(widget.l10n.yes),
onPressed: () => bootstrap.askSetupOnlineKeyBackup(true), onPressed: () => bootstrap.askSetupOnlineKeyBackup(true),
)); ));
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
textColor: Theme.of(context).textTheme.bodyText1.color, textColor: Theme.of(context).textTheme.bodyText1.color,
child: Text(L10n.of(context).no), child: Text(widget.l10n.no),
onPressed: () => bootstrap.askSetupOnlineKeyBackup(false), onPressed: () => bootstrap.askSetupOnlineKeyBackup(false),
)); ));
break; break;
@ -183,10 +188,10 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
body = ListTile( body = ListTile(
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
leading: Icon(Icons.error_outline, color: Colors.red), leading: Icon(Icons.error_outline, color: Colors.red),
title: Text(L10n.of(context).oopsSomethingWentWrong), title: Text(widget.l10n.oopsSomethingWentWrong),
); );
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
child: Text(L10n.of(context).close), child: Text(widget.l10n.close),
onPressed: () => Navigator.of(context).pop<bool>(false), onPressed: () => Navigator.of(context).pop<bool>(false),
)); ));
break; break;
@ -197,7 +202,7 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
title: Text('Chat backup has been initialized!'), title: Text('Chat backup has been initialized!'),
); );
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
child: Text(L10n.of(context).close), child: Text(widget.l10n.close),
onPressed: () => Navigator.of(context).pop<bool>(false), onPressed: () => Navigator.of(context).pop<bool>(false),
)); ));
break; break;
@ -222,7 +227,8 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
class _AskUnlockOldSsss extends StatefulWidget { class _AskUnlockOldSsss extends StatefulWidget {
final String keyId; final String keyId;
final OpenSSSS ssssKey; final OpenSSSS ssssKey;
_AskUnlockOldSsss(this.keyId, this.ssssKey); final L10n l10n;
_AskUnlockOldSsss(this.keyId, this.ssssKey, this.l10n);
@override @override
_AskUnlockOldSsssState createState() => _AskUnlockOldSsssState(); _AskUnlockOldSsssState createState() => _AskUnlockOldSsssState();
@ -274,7 +280,7 @@ class _AskUnlockOldSsssState extends State<_AskUnlockOldSsss> {
maxLines: 1, maxLines: 1,
obscureText: true, obscureText: true,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context).passphraseOrKey, hintText: widget.l10n.passphraseOrKey,
prefixStyle: TextStyle(color: Theme.of(context).primaryColor), prefixStyle: TextStyle(color: Theme.of(context).primaryColor),
suffixStyle: TextStyle(color: Theme.of(context).primaryColor), suffixStyle: TextStyle(color: Theme.of(context).primaryColor),
border: OutlineInputBorder(), border: OutlineInputBorder(),
@ -285,7 +291,7 @@ class _AskUnlockOldSsssState extends State<_AskUnlockOldSsss> {
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
elevation: 5, elevation: 5,
textColor: Colors.white, textColor: Colors.white,
child: Text(L10n.of(context).submit), child: Text(widget.l10n.submit),
onPressed: () { onPressed: () {
input = textEditingController.text; input = textEditingController.text;
checkInput(context); checkInput(context);

View File

@ -16,7 +16,12 @@ class KeyVerificationDialog extends StatefulWidget {
final KeyVerification request; final KeyVerification request;
KeyVerificationDialog({this.request}); final L10n l10n;
KeyVerificationDialog({
this.request,
@required this.l10n,
});
@override @override
_KeyVerificationPageState createState() => _KeyVerificationPageState(); _KeyVerificationPageState createState() => _KeyVerificationPageState();
@ -86,7 +91,7 @@ class _KeyVerificationPageState extends State<KeyVerificationDialog> {
if (valid.error != null) { if (valid.error != null) {
await showOkAlertDialog( await showOkAlertDialog(
context: context, context: context,
message: L10n.of(context).incorrectPassphraseOrKey, message: widget.l10n.incorrectPassphraseOrKey,
); );
} }
}; };
@ -94,8 +99,7 @@ class _KeyVerificationPageState extends State<KeyVerificationDialog> {
margin: EdgeInsets.only(left: 8.0, right: 8.0), margin: EdgeInsets.only(left: 8.0, right: 8.0),
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Text(L10n.of(context).askSSSSSign, Text(widget.l10n.askSSSSSign, style: TextStyle(fontSize: 20)),
style: TextStyle(fontSize: 20)),
Container(height: 10), Container(height: 10),
TextField( TextField(
controller: textEditingController, controller: textEditingController,
@ -109,7 +113,7 @@ class _KeyVerificationPageState extends State<KeyVerificationDialog> {
maxLines: 1, maxLines: 1,
obscureText: true, obscureText: true,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context).passphraseOrKey, hintText: widget.l10n.passphraseOrKey,
prefixStyle: TextStyle(color: Theme.of(context).primaryColor), prefixStyle: TextStyle(color: Theme.of(context).primaryColor),
suffixStyle: TextStyle(color: Theme.of(context).primaryColor), suffixStyle: TextStyle(color: Theme.of(context).primaryColor),
border: OutlineInputBorder(), border: OutlineInputBorder(),
@ -120,30 +124,29 @@ class _KeyVerificationPageState extends State<KeyVerificationDialog> {
), ),
); );
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
child: Text(L10n.of(context).submit), child: Text(widget.l10n.submit),
onPressed: () { onPressed: () {
input = textEditingController.text; input = textEditingController.text;
checkInput(); checkInput();
}, },
)); ));
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
child: Text(L10n.of(context).skip), child: Text(widget.l10n.skip),
onPressed: () => widget.request.openSSSS(skip: true), onPressed: () => widget.request.openSSSS(skip: true),
)); ));
break; break;
case KeyVerificationState.askAccept: case KeyVerificationState.askAccept:
body = Container( body = Container(
child: Text( child: Text(widget.l10n.askVerificationRequest(widget.request.userId),
L10n.of(context).askVerificationRequest(widget.request.userId),
style: TextStyle(fontSize: 20)), style: TextStyle(fontSize: 20)),
margin: EdgeInsets.only(left: 8.0, right: 8.0), margin: EdgeInsets.only(left: 8.0, right: 8.0),
); );
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
child: Text(L10n.of(context).accept), child: Text(widget.l10n.accept),
onPressed: () => widget.request.acceptVerification(), onPressed: () => widget.request.acceptVerification(),
)); ));
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
child: Text(L10n.of(context).reject), child: Text(widget.l10n.reject),
onPressed: () { onPressed: () {
widget.request.rejectVerification().then((_) { widget.request.rejectVerification().then((_) {
Navigator.of(context).pop(); Navigator.of(context).pop();
@ -159,7 +162,7 @@ class _KeyVerificationPageState extends State<KeyVerificationDialog> {
: CircularProgressIndicator(), : CircularProgressIndicator(),
SizedBox(height: 10), SizedBox(height: 10),
Text( Text(
L10n.of(context).waitingPartnerAcceptRequest, widget.l10n.waitingPartnerAcceptRequest,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
], ],
@ -172,14 +175,14 @@ class _KeyVerificationPageState extends State<KeyVerificationDialog> {
// view for if "emoji" is a present sasType or not? // view for if "emoji" is a present sasType or not?
String compareText; String compareText;
if (widget.request.sasTypes.contains('emoji')) { if (widget.request.sasTypes.contains('emoji')) {
compareText = L10n.of(context).compareEmojiMatch; compareText = widget.l10n.compareEmojiMatch;
compareWidget = TextSpan( compareWidget = TextSpan(
children: widget.request.sasEmojis children: widget.request.sasEmojis
.map((e) => WidgetSpan(child: _Emoji(e))) .map((e) => WidgetSpan(child: _Emoji(e)))
.toList(), .toList(),
); );
} else { } else {
compareText = L10n.of(context).compareNumbersMatch; compareText = widget.l10n.compareNumbersMatch;
final numbers = widget.request.sasNumbers; final numbers = widget.request.sasNumbers;
final numbstr = '${numbers[0]}-${numbers[1]}-${numbers[2]}'; final numbstr = '${numbers[0]}-${numbers[1]}-${numbers[2]}';
compareWidget = compareWidget =
@ -203,19 +206,19 @@ class _KeyVerificationPageState extends State<KeyVerificationDialog> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
); );
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
child: Text(L10n.of(context).theyMatch), child: Text(widget.l10n.theyMatch),
onPressed: () => widget.request.acceptSas(), onPressed: () => widget.request.acceptSas(),
)); ));
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
textColor: Colors.red, textColor: Colors.red,
child: Text(L10n.of(context).theyDontMatch), child: Text(widget.l10n.theyDontMatch),
onPressed: () => widget.request.rejectSas(), onPressed: () => widget.request.rejectSas(),
)); ));
break; break;
case KeyVerificationState.waitingSas: case KeyVerificationState.waitingSas:
var acceptText = widget.request.sasTypes.contains('emoji') var acceptText = widget.request.sasTypes.contains('emoji')
? L10n.of(context).waitingPartnerEmoji ? widget.l10n.waitingPartnerEmoji
: L10n.of(context).waitingPartnerNumbers; : widget.l10n.waitingPartnerNumbers;
body = Column( body = Column(
children: <Widget>[ children: <Widget>[
PlatformInfos.isCupertinoStyle PlatformInfos.isCupertinoStyle
@ -236,14 +239,14 @@ class _KeyVerificationPageState extends State<KeyVerificationDialog> {
Icon(Icons.check_circle_outlined, color: Colors.green, size: 200.0), Icon(Icons.check_circle_outlined, color: Colors.green, size: 200.0),
SizedBox(height: 10), SizedBox(height: 10),
Text( Text(
L10n.of(context).verifySuccess, widget.l10n.verifySuccess,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
], ],
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
); );
buttons.add(AdaptiveFlatButton( buttons.add(AdaptiveFlatButton(
child: Text(L10n.of(context).close), child: Text(widget.l10n.close),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
)); ));
break; break;
@ -260,7 +263,7 @@ class _KeyVerificationPageState extends State<KeyVerificationDialog> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
); );
buttons.add(FlatButton( buttons.add(FlatButton(
child: Text(L10n.of(context).close), child: Text(widget.l10n.close),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
)); ));
break; break;
@ -305,7 +308,7 @@ class _KeyVerificationPageState extends State<KeyVerificationDialog> {
], ],
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
); );
final title = Text(L10n.of(context).verifyTitle); final title = Text(widget.l10n.verifyTitle);
final content = Scrollbar( final content = Scrollbar(
isAlwaysShown: true, isAlwaysShown: true,
controller: _scrollController, controller: _scrollController,

View File

@ -5,8 +5,13 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart';
class PermissionSliderDialog extends StatefulWidget { class PermissionSliderDialog extends StatefulWidget {
const PermissionSliderDialog({Key key, this.initialPermission = 0}) const PermissionSliderDialog({
: super(key: key); Key key,
this.initialPermission = 0,
@required this.l10n,
}) : super(key: key);
final L10n l10n;
Future<int> show(BuildContext context) => PlatformInfos.isCupertinoStyle Future<int> show(BuildContext context) => PlatformInfos.isCupertinoStyle
? showCupertinoDialog<int>(context: context, builder: (context) => this) ? showCupertinoDialog<int>(context: context, builder: (context) => this)
@ -41,7 +46,7 @@ class _PermissionSliderDialogState extends State<PermissionSliderDialog> {
min: 0.0, min: 0.0,
); );
final title = Text( final title = Text(
L10n.of(context).setPermissionsLevel, widget.l10n.setPermissionsLevel,
textAlign: TextAlign.center, textAlign: TextAlign.center,
); );
final content = Column( final content = Column(
@ -49,9 +54,9 @@ class _PermissionSliderDialogState extends State<PermissionSliderDialog> {
children: [ children: [
Text('Level: ' + Text('Level: ' +
(_permission == 100 (_permission == 100
? '$_permission (${L10n.of(context).admin})' ? '$_permission (${widget.l10n.admin})'
: _permission >= 50 : _permission >= 50
? '$_permission (${L10n.of(context).moderator})' ? '$_permission (${widget.l10n.moderator})'
: _permission.toString())), : _permission.toString())),
Container( Container(
height: 56, height: 56,
@ -61,11 +66,11 @@ class _PermissionSliderDialogState extends State<PermissionSliderDialog> {
); );
final buttons = [ final buttons = [
AdaptiveFlatButton( AdaptiveFlatButton(
child: Text(L10n.of(context).cancel), child: Text(widget.l10n.cancel),
onPressed: () => Navigator.of(context).pop<int>(null), onPressed: () => Navigator.of(context).pop<int>(null),
), ),
AdaptiveFlatButton( AdaptiveFlatButton(
child: Text(L10n.of(context).confirm), child: Text(widget.l10n.confirm),
onPressed: () => Navigator.of(context).pop<int>(_permission), onPressed: () => Navigator.of(context).pop<int>(_permission),
), ),
]; ];

View File

@ -7,8 +7,13 @@ import 'package:intl/intl.dart';
class RecordingDialog extends StatefulWidget { class RecordingDialog extends StatefulWidget {
final Function onFinished; final Function onFinished;
final L10n l10n;
const RecordingDialog({this.onFinished, Key key}) : super(key: key); const RecordingDialog({
this.onFinished,
@required this.l10n,
Key key,
}) : super(key: key);
@override @override
_RecordingDialogState createState() => _RecordingDialogState(); _RecordingDialogState createState() => _RecordingDialogState();
@ -67,7 +72,7 @@ class _RecordingDialogState extends State<RecordingDialog> {
SizedBox(width: 8), SizedBox(width: 8),
Expanded( Expanded(
child: Text( child: Text(
'${L10n.of(context).recording}: $time', '${widget.l10n.recording}: $time',
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18,
), ),
@ -78,7 +83,7 @@ class _RecordingDialogState extends State<RecordingDialog> {
actions: <Widget>[ actions: <Widget>[
FlatButton( FlatButton(
child: Text( child: Text(
L10n.of(context).cancel.toUpperCase(), widget.l10n.cancel.toUpperCase(),
style: TextStyle( style: TextStyle(
color: Theme.of(context).textTheme.bodyText2.color.withAlpha(150), color: Theme.of(context).textTheme.bodyText2.color.withAlpha(150),
), ),
@ -88,7 +93,7 @@ class _RecordingDialogState extends State<RecordingDialog> {
FlatButton( FlatButton(
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Text(L10n.of(context).send.toUpperCase()), Text(widget.l10n.send.toUpperCase()),
SizedBox(width: 4), SizedBox(width: 4),
Icon(Icons.send_outlined, size: 15), Icon(Icons.send_outlined, size: 15),
], ],

View File

@ -362,7 +362,10 @@ class MatrixState extends State<Matrix> {
request.onUpdate = null; request.onUpdate = null;
hidPopup = true; hidPopup = true;
await request.acceptVerification(); await request.acceptVerification();
await KeyVerificationDialog(request: request).show(context); await KeyVerificationDialog(
request: request,
l10n: L10n.of(context),
).show(context);
} else { } else {
request.onUpdate = null; request.onUpdate = null;
hidPopup = true; hidPopup = true;

View File

@ -52,7 +52,10 @@ class MessageContent extends StatelessWidget {
timeline.cancelSubscriptions(); timeline.cancelSubscriptions();
} }
}; };
await KeyVerificationDialog(request: req).show(context); await KeyVerificationDialog(
request: req,
l10n: L10n.of(context),
).show(context);
} else { } else {
final success = await showFutureLoadingDialog( final success = await showFutureLoadingDialog(
context: context, context: context,

View File

@ -59,9 +59,10 @@ class UserBottomSheet extends StatelessWidget {
} }
break; break;
case 'permission': case 'permission':
final newPermission = final newPermission = await PermissionSliderDialog(
await PermissionSliderDialog(initialPermission: user.powerLevel) initialPermission: user.powerLevel,
.show(context); l10n: L10n.of(context),
).show(context);
if (newPermission != null) { if (newPermission != null) {
if (newPermission == 100 && await _askConfirmation() == false) break; if (newPermission == 100 && await _askConfirmation() == false) break;
await showFutureLoadingDialog( await showFutureLoadingDialog(
@ -82,7 +83,7 @@ class UserBottomSheet extends StatelessWidget {
void _verifyAction(BuildContext context) async { void _verifyAction(BuildContext context) async {
final client = user.room.client; final client = user.room.client;
final req = await client.userDeviceKeys[user.id].startVerification(); final req = await client.userDeviceKeys[user.id].startVerification();
await KeyVerificationDialog(request: req).show(context); await KeyVerificationDialog(request: req,l10n: L10n.of(context),).show(context);
} }
@override @override

View File

@ -265,6 +265,7 @@ class _ChatState extends State<Chat> {
context: context, context: context,
builder: (context) => RecordingDialog( builder: (context) => RecordingDialog(
onFinished: (r) => result = r, onFinished: (r) => result = r,
l10n: L10n.of(context),
)); ));
if (result == null) return; if (result == null) return;
final audioFile = File(result); final audioFile = File(result);

View File

@ -36,7 +36,10 @@ class _ChatEncryptionSettingsState extends State<ChatEncryptionSettings> {
setState(() => null); setState(() => null);
} }
}; };
await KeyVerificationDialog(request: req).show(context); await KeyVerificationDialog(
request: req,
l10n: L10n.of(context),
).show(context);
break; break;
case 'verify_manual': case 'verify_manual':
if (await showOkCancelAlertDialog( if (await showOkCancelAlertDialog(
@ -59,7 +62,10 @@ class _ChatEncryptionSettingsState extends State<ChatEncryptionSettings> {
setState(() => null); setState(() => null);
} }
}; };
await KeyVerificationDialog(request: req).show(context); await KeyVerificationDialog(
request: req,
l10n: L10n.of(context),
).show(context);
break; break;
case 'block': case 'block':
if (key.directVerified) { if (key.directVerified) {

View File

@ -20,9 +20,10 @@ class ChatPermissionsSettings extends StatelessWidget {
return FlushbarHelper.createError(message: L10n.of(context).noPermission) return FlushbarHelper.createError(message: L10n.of(context).noPermission)
.show(context); .show(context);
} }
final newLevel = final newLevel = await PermissionSliderDialog(
await PermissionSliderDialog(initialPermission: currentLevel) initialPermission: currentLevel,
.show(context); l10n: L10n.of(context),
).show(context);
if (newLevel == null) return; if (newLevel == null) return;
final content = Map<String, dynamic>.from( final content = Map<String, dynamic>.from(
room.getState(EventTypes.RoomPowerLevels).content); room.getState(EventTypes.RoomPowerLevels).content);

View File

@ -516,7 +516,8 @@ class _SettingsState extends State<Settings> {
: null, : null,
onTap: () async { onTap: () async {
if (!client.encryption.crossSigning.enabled) { if (!client.encryption.crossSigning.enabled) {
return BootstrapDialog().show(context); return BootstrapDialog(l10n: L10n.of(context))
.show(context);
} }
if (client.isUnknownSession) { if (client.isUnknownSession) {
final input = await showTextInputDialog( final input = await showTextInputDialog(
@ -592,7 +593,8 @@ class _SettingsState extends State<Settings> {
: null, : null,
onTap: () async { onTap: () async {
if (!client.encryption.keyManager.enabled) { if (!client.encryption.keyManager.enabled) {
return BootstrapDialog().show(context); return BootstrapDialog(l10n: L10n.of(context))
.show(context);
} }
if (!(await client.encryption.keyManager.isCached())) { if (!(await client.encryption.keyManager.isCached())) {
await requestSSSSCache(context); await requestSSSSCache(context);