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