From 195694a252adf0f5c55024df66baacbedf09d574 Mon Sep 17 00:00:00 2001 From: krille-chan Date: Fri, 11 Aug 2023 07:15:09 +0200 Subject: [PATCH] design: Move chatbackup in adaptive bottom sheet --- lib/pages/bootstrap/bootstrap_dialog.dart | 19 ++++++------------- lib/utils/adaptive_bottom_sheet.dart | 5 +++-- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/lib/pages/bootstrap/bootstrap_dialog.dart b/lib/pages/bootstrap/bootstrap_dialog.dart index 3ef8bcfd..ca1ef0c8 100644 --- a/lib/pages/bootstrap/bootstrap_dialog.dart +++ b/lib/pages/bootstrap/bootstrap_dialog.dart @@ -13,6 +13,7 @@ import 'package:share_plus/share_plus.dart'; import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/widgets/adaptive_flat_button.dart'; +import '../../utils/adaptive_bottom_sheet.dart'; import '../key_verification/key_verification_dialog.dart'; class BootstrapDialog extends StatefulWidget { @@ -24,19 +25,11 @@ class BootstrapDialog extends StatefulWidget { required this.client, }) : super(key: key); - Future show(BuildContext context) => PlatformInfos.isCupertinoStyle - ? showCupertinoDialog( - context: context, - builder: (context) => this, - barrierDismissible: true, - useRootNavigator: false, - ) - : showDialog( - context: context, - builder: (context) => this, - barrierDismissible: true, - useRootNavigator: false, - ); + Future show(BuildContext context) => showAdaptiveBottomSheet( + context: context, + builder: (context) => this, + maxHeight: 600, + ); @override BootstrapDialogState createState() => BootstrapDialogState(); diff --git a/lib/utils/adaptive_bottom_sheet.dart b/lib/utils/adaptive_bottom_sheet.dart index c9813d33..d2a9a8b6 100644 --- a/lib/utils/adaptive_bottom_sheet.dart +++ b/lib/utils/adaptive_bottom_sheet.dart @@ -9,6 +9,7 @@ Future showAdaptiveBottomSheet({ required Widget Function(BuildContext) builder, bool isDismissible = true, bool isScrollControlled = true, + double maxHeight = 480.0, }) => showModalBottomSheet( context: context, @@ -16,8 +17,8 @@ Future showAdaptiveBottomSheet({ useRootNavigator: !PlatformInfos.isMobile, isDismissible: isDismissible, isScrollControlled: isScrollControlled, - constraints: const BoxConstraints( - maxHeight: 480, + constraints: BoxConstraints( + maxHeight: maxHeight, maxWidth: FluffyThemes.columnWidth * 1.5, ), clipBehavior: Clip.hardEdge,