From fad7e9752c42a8e621d3f5dd0ae0fb3c99178769 Mon Sep 17 00:00:00 2001 From: lifegpc Date: Wed, 29 May 2024 01:34:34 +0000 Subject: [PATCH] Fix layout --- lib/components/user_card.dart | 53 ++++++++++++----------------------- lib/l10n/app_en.arb | 3 +- lib/l10n/app_zh.arb | 3 +- lib/pages/users.dart | 2 +- 4 files changed, 23 insertions(+), 38 deletions(-) diff --git a/lib/components/user_card.dart b/lib/components/user_card.dart index 46a459b..2874eb5 100644 --- a/lib/components/user_card.dart +++ b/lib/components/user_card.dart @@ -66,41 +66,24 @@ class UserCard extends StatelessWidget { onPressed: () => showDialog( context: context, builder: (context) { - final maxWidth = MediaQuery.of(context).size.width; - return Dialog( - child: Container( - padding: maxWidth < 400 - ? const EdgeInsets.symmetric( - vertical: 20, horizontal: 10) - : const EdgeInsets.all(20), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(10)), - width: maxWidth < 500 ? null : 500, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Text(i18n - .deleteUserConfirm(user.username)), - Row( - mainAxisAlignment: - MainAxisAlignment.end, - children: [ - TextButton( - onPressed: () { - context.pop(); - _deleteUser(user.id, - i18n.failedDeleteUser); - }, - child: Text(i18n.yes)), - TextButton( - onPressed: () { - context.pop(); - }, - child: Text(i18n.no)), - ]), - ], - ))); + return AlertDialog( + title: Text(i18n.deleteUser), + content: + Text(i18n.deleteUserConfirm(user.username)), + actions: [ + TextButton( + onPressed: () { + context.pop(); + _deleteUser( + user.id, i18n.failedDeleteUser); + }, + child: Text(i18n.yes)), + TextButton( + onPressed: () { + context.pop(); + }, + child: Text(i18n.no)), + ]); }), tooltip: i18n.delete, icon: const Icon(Icons.delete)) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 1d3103a..7ca4f03 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -224,5 +224,6 @@ } } }, - "failedDeleteUser": "Failed to delete user: " + "failedDeleteUser": "Failed to delete user: ", + "deleteUser": "Delete user" } diff --git a/lib/l10n/app_zh.arb b/lib/l10n/app_zh.arb index 3bcab32..6143e3d 100644 --- a/lib/l10n/app_zh.arb +++ b/lib/l10n/app_zh.arb @@ -224,5 +224,6 @@ } } }, - "failedDeleteUser": "删除用户失败:" + "failedDeleteUser": "删除用户失败:", + "deleteUser": "删除用户" } diff --git a/lib/pages/users.dart b/lib/pages/users.dart index 33ac379..7e2acb2 100644 --- a/lib/pages/users.dart +++ b/lib/pages/users.dart @@ -145,7 +145,7 @@ class _UsersPage extends State with ThemeModeWidget, IsTopWidget2 { maxCrossAxisExtent: 360.0, mainAxisSpacing: 10.0, crossAxisSpacing: 10.0, - childAspectRatio: 4.0, + mainAxisExtent: 80.0, ), delegate: SliverChildBuilderDelegate( (BuildContext context, int index) {