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( const CustomAlertDialog(
{Key? key, {Key? key,
this.title, this.title,
this.titlePadding,
required this.content, required this.content,
this.actions, this.actions,
this.contentPadding, this.contentPadding,
@ -837,6 +838,7 @@ class CustomAlertDialog extends StatelessWidget {
: super(key: key); : super(key: key);
final Widget? title; final Widget? title;
final EdgeInsetsGeometry? titlePadding;
final Widget content; final Widget content;
final List<Widget>? actions; final List<Widget>? actions;
final double? contentPadding; final double? contentPadding;
@ -885,7 +887,7 @@ class CustomAlertDialog extends StatelessWidget {
child: content, child: content,
), ),
actions: actions, actions: actions,
titlePadding: MyTheme.dialogTitlePadding(), titlePadding: titlePadding ?? MyTheme.dialogTitlePadding(),
contentPadding: contentPadding:
MyTheme.dialogContentPadding(actions: actions is List), MyTheme.dialogContentPadding(actions: actions is List),
actionsPadding: MyTheme.dialogActionsPadding(), 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( return CustomAlertDialog(
title: Text(translate('Login')), title: title,
titlePadding: titlePadding,
contentBoxConstraints: BoxConstraints(minWidth: 400), contentBoxConstraints: BoxConstraints(minWidth: 400),
content: Column( content: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
@ -521,7 +541,6 @@ Future<bool?> loginDialog() async {
thirdAuthWidget(), thirdAuthWidget(),
], ],
), ),
actions: [dialogButton('Close', onPressed: onDialogCancel)],
onCancel: onDialogCancel, onCancel: onDialogCancel,
); );
}); });