Skip to content

Commit

Permalink
refactor: Move base bottom sheet to mxc ui
Browse files Browse the repository at this point in the history
  • Loading branch information
reasje committed Dec 12, 2024
1 parent b81c0f3 commit fb120b5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 20 deletions.
1 change: 1 addition & 0 deletions ui/lib/mxc_ui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
40 changes: 21 additions & 19 deletions ui/lib/src/bottom_sheets/base_bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Future<T?> showBaseBottomSheet<T>({
List<Widget>? widgets,
Widget? content,
bool isDismissible = true,
bool enableDrag = true
bool enableDrag = true,
Color? bottomSheetBackgroundColor,
}) {
assert(
((widgets != null && bottomSheetTitle != null) || content != null) &&
Expand All @@ -29,7 +30,7 @@ Future<T?> showBaseBottomSheet<T>({
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(
Expand All @@ -38,39 +39,40 @@ Future<T?> showBaseBottomSheet<T>({
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!
],
),
),
),
),
);
Expand Down
3 changes: 2 additions & 1 deletion ui/lib/src/bottom_sheets/bottom_sheets.dart
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export 'info_bottom_sheet.dart';
export 'info_bottom_sheet.dart';
export 'base_bottom_sheet.dart';

0 comments on commit fb120b5

Please sign in to comment.