From fb120b585963d4d6fc28e7e9b15f244a482d5313 Mon Sep 17 00:00:00 2001 From: reasje Date: Thu, 12 Dec 2024 10:54:32 +0330 Subject: [PATCH] refactor: Move base bottom sheet to mxc ui --- ui/lib/mxc_ui.dart | 1 + .../src/bottom_sheets/base_bottom_sheet.dart | 40 ++++++++++--------- ui/lib/src/bottom_sheets/bottom_sheets.dart | 3 +- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/ui/lib/mxc_ui.dart b/ui/lib/mxc_ui.dart index eeaccd2..5409040 100644 --- a/ui/lib/mxc_ui.dart +++ b/ui/lib/mxc_ui.dart @@ -13,5 +13,6 @@ export 'src/drop_down.dart'; export 'src/app_bar.dart'; export 'src/app_bar_evenly.dart'; export 'src/mxc_icons.dart'; +export 'src/bottom_sheets/bottom_sheets.dart'; const mxcUiPackageName = 'mxc_ui'; diff --git a/ui/lib/src/bottom_sheets/base_bottom_sheet.dart b/ui/lib/src/bottom_sheets/base_bottom_sheet.dart index 061ab1e..fd145e3 100644 --- a/ui/lib/src/bottom_sheets/base_bottom_sheet.dart +++ b/ui/lib/src/bottom_sheets/base_bottom_sheet.dart @@ -11,7 +11,8 @@ Future showBaseBottomSheet({ List? widgets, Widget? content, bool isDismissible = true, - bool enableDrag = true + bool enableDrag = true, + Color? bottomSheetBackgroundColor, }) { assert( ((widgets != null && bottomSheetTitle != null) || content != null) && @@ -29,7 +30,7 @@ Future showBaseBottomSheet({ useSafeArea: true, builder: (BuildContext context) => ConstrainedBox( constraints: BoxConstraints( - maxHeight: MediaQuery.of(context).size.height * 0.95, + maxHeight: MediaQuery.of(context).size.height * 0.9, ), child: Container( padding: const EdgeInsets.only( @@ -38,39 +39,40 @@ Future showBaseBottomSheet({ right: Sizes.spaceNormal, left: Sizes.spaceNormal), decoration: BoxDecoration( - color: ColorsTheme.of(context).layerSheetBackground, + color: bottomSheetBackgroundColor ?? + ColorsTheme.of(context).layerSheetBackground, borderRadius: const BorderRadius.only( topLeft: Radius.circular(20), topRight: Radius.circular(20), ), ), - child: content ?? - Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsetsDirectional.only( - start: Sizes.spaceNormal, - end: Sizes.spaceNormal, - bottom: Sizes.space2XLarge), - child: MxcAppBarEvenly.title( + child: Container( + padding: const EdgeInsetsDirectional.only( + start: Sizes.spaceSmall, + end: Sizes.spaceSmall, + bottom: Sizes.space2XLarge), + child: content ?? + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + MxcAppBarEvenly.title( titleText: translate(bottomSheetTitle!), action: hasCloseButton ? Container( alignment: Alignment.centerRight, child: InkWell( - child: const Icon(Icons.close, size: 30), + child: const Icon(Icons.close, size: 24), onTap: () => Navigator.of(context) .pop(closeButtonReturnValue), ), ) : null, ), - ), - ...widgets! - ], - ), + ...widgets! + ], + ), + ), ), ), ); diff --git a/ui/lib/src/bottom_sheets/bottom_sheets.dart b/ui/lib/src/bottom_sheets/bottom_sheets.dart index 61bab91..3226555 100644 --- a/ui/lib/src/bottom_sheets/bottom_sheets.dart +++ b/ui/lib/src/bottom_sheets/bottom_sheets.dart @@ -1 +1,2 @@ -export 'info_bottom_sheet.dart'; \ No newline at end of file +export 'info_bottom_sheet.dart'; +export 'base_bottom_sheet.dart'; \ No newline at end of file