Merge pull request #4811 from dignow/refact/login_dialog

refact login dialog
This commit is contained in:
RustDesk 2023-07-01 13:00:58 +08:00 committed by GitHub
commit 24539c1241
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 3 deletions

View File

@ -828,6 +828,7 @@ class CustomAlertDialog extends StatelessWidget {
const CustomAlertDialog(
{Key? key,
this.title,
this.titlePadding,
required this.content,
this.actions,
this.contentPadding,
@ -837,6 +838,7 @@ class CustomAlertDialog extends StatelessWidget {
: super(key: key);
final Widget? title;
final EdgeInsetsGeometry? titlePadding;
final Widget content;
final List<Widget>? actions;
final double? contentPadding;
@ -885,7 +887,7 @@ class CustomAlertDialog extends StatelessWidget {
child: content,
),
actions: actions,
titlePadding: MyTheme.dialogTitlePadding(),
titlePadding: titlePadding ?? MyTheme.dialogTitlePadding(),
contentPadding:
MyTheme.dialogContentPadding(actions: actions is List),
actionsPadding: MyTheme.dialogActionsPadding(),

View File

@ -499,8 +499,28 @@ Future<bool?> loginDialog() async {
);
});
final title = Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
translate('Login'),
).marginOnly(top: MyTheme.dialogPadding),
TextButton(
child: Icon(
Icons.close,
size: 20,
color: Colors.black54,
),
onPressed: onDialogCancel,
).marginOnly(top: 5),
],
);
final titlePadding = EdgeInsets.fromLTRB(MyTheme.dialogPadding, 0, 0, 0);
return CustomAlertDialog(
title: Text(translate('Login')),
title: title,
titlePadding: titlePadding,
contentBoxConstraints: BoxConstraints(minWidth: 400),
content: Column(
crossAxisAlignment: CrossAxisAlignment.center,
@ -521,7 +541,6 @@ Future<bool?> loginDialog() async {
thirdAuthWidget(),
],
),
actions: [dialogButton('Close', onPressed: onDialogCancel)],
onCancel: onDialogCancel,
);
});