feat: Add chat permissions settings
This commit is contained in:
parent
068cb85f90
commit
4c8744f027
7 changed files with 466 additions and 81 deletions
|
|
@ -6,6 +6,7 @@ import 'package:flutter/cupertino.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import '../avatar.dart';
|
||||
import 'adaptive_flat_button.dart';
|
||||
import 'simple_dialogs.dart';
|
||||
import '../../utils/string_color.dart';
|
||||
|
||||
|
|
@ -121,14 +122,14 @@ class _KeyVerificationPageState extends State<KeyVerificationDialog> {
|
|||
mainAxisSize: MainAxisSize.min,
|
||||
),
|
||||
);
|
||||
buttons.add(_AdaptiveFlatButton(
|
||||
buttons.add(AdaptiveFlatButton(
|
||||
child: Text(L10n.of(context).submit),
|
||||
onPressed: () {
|
||||
input = textEditingController.text;
|
||||
checkInput();
|
||||
},
|
||||
));
|
||||
buttons.add(_AdaptiveFlatButton(
|
||||
buttons.add(AdaptiveFlatButton(
|
||||
child: Text(L10n.of(context).skip),
|
||||
onPressed: () => widget.request.openSSSS(skip: true),
|
||||
));
|
||||
|
|
@ -140,11 +141,11 @@ class _KeyVerificationPageState extends State<KeyVerificationDialog> {
|
|||
style: TextStyle(fontSize: 20)),
|
||||
margin: EdgeInsets.only(left: 8.0, right: 8.0),
|
||||
);
|
||||
buttons.add(_AdaptiveFlatButton(
|
||||
buttons.add(AdaptiveFlatButton(
|
||||
child: Text(L10n.of(context).accept),
|
||||
onPressed: () => widget.request.acceptVerification(),
|
||||
));
|
||||
buttons.add(_AdaptiveFlatButton(
|
||||
buttons.add(AdaptiveFlatButton(
|
||||
child: Text(L10n.of(context).reject),
|
||||
onPressed: () {
|
||||
widget.request.rejectVerification().then((_) {
|
||||
|
|
@ -204,11 +205,11 @@ class _KeyVerificationPageState extends State<KeyVerificationDialog> {
|
|||
],
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
);
|
||||
buttons.add(_AdaptiveFlatButton(
|
||||
buttons.add(AdaptiveFlatButton(
|
||||
child: Text(L10n.of(context).theyMatch),
|
||||
onPressed: () => widget.request.acceptSas(),
|
||||
));
|
||||
buttons.add(_AdaptiveFlatButton(
|
||||
buttons.add(AdaptiveFlatButton(
|
||||
textColor: Colors.red,
|
||||
child: Text(L10n.of(context).theyDontMatch),
|
||||
onPressed: () => widget.request.rejectSas(),
|
||||
|
|
@ -244,7 +245,7 @@ class _KeyVerificationPageState extends State<KeyVerificationDialog> {
|
|||
],
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
);
|
||||
buttons.add(_AdaptiveFlatButton(
|
||||
buttons.add(AdaptiveFlatButton(
|
||||
child: Text(L10n.of(context).close),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
));
|
||||
|
|
@ -359,32 +360,3 @@ class _Emoji extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _AdaptiveFlatButton extends StatelessWidget {
|
||||
final Widget child;
|
||||
final Color textColor;
|
||||
final Function onPressed;
|
||||
|
||||
const _AdaptiveFlatButton({
|
||||
Key key,
|
||||
this.child,
|
||||
this.textColor,
|
||||
this.onPressed,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (PlatformInfos.isCupertinoStyle) {
|
||||
return CupertinoDialogAction(
|
||||
child: child,
|
||||
onPressed: onPressed,
|
||||
textStyle: textColor != null ? TextStyle(color: textColor) : null,
|
||||
);
|
||||
}
|
||||
return FlatButton(
|
||||
child: child,
|
||||
textColor: textColor,
|
||||
onPressed: onPressed,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue