Skip to content

Commit

Permalink
feat: add bottom safe area of content for Modal Sheets' (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
smallTrogdor authored Dec 13, 2024
1 parent 4f888ee commit f6140c6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ It is expected that you keep this format strictly, since we depend on it in our

### Changed
- Dropped support for `Flutter SDK 3.19.6`: minimum supported version is 3.22.3
- `showSBBModalSheet` & `showCustomSBBModalSheet`: add bottom safe area of content if `useSafeArea` is true

### Deprecated
- `SBBIconFormButton`
Expand Down
23 changes: 15 additions & 8 deletions lib/src/modal/sbb_modal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,9 @@ Future<T?> showSBBModalSheet<T>({
enableDrag: enableDrag,
constraints: constraints,
builder: (BuildContext context) {
return SBBModalSheet(
title: title,
child: child,
);
return useSafeArea
? _wrapWithBottomSafeArea(SBBModalSheet(title: title, child: child))
: SBBModalSheet(title: title, child: child);
},
barrierColor: SBBInternal.barrierColor,
);
Expand Down Expand Up @@ -149,10 +148,9 @@ Future<T?> showCustomSBBModalSheet<T>({
enableDrag: enableDrag,
constraints: constraints,
builder: (BuildContext context) {
return SBBModalSheet.custom(
header: header,
child: child,
);
return useSafeArea
? _wrapWithBottomSafeArea(SBBModalSheet.custom(header: header, child: child))
: SBBModalSheet.custom(header: header, child: child);
},
barrierColor: SBBInternal.barrierColor,
);
Expand Down Expand Up @@ -306,3 +304,12 @@ class _CloseButton extends StatelessWidget {
),
);
}

Widget _wrapWithBottomSafeArea(Widget child) {
return SafeArea(
top: false,
left: false,
right: false,
child: child,
);
}

0 comments on commit f6140c6

Please sign in to comment.