Skip to content

Commit

Permalink
Merge branch 'master' into v2.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-Ioannou committed Jan 23, 2024
2 parents 1e9e707 + 9e9d40b commit ffdb9da
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/src/bottom_sheet_alert.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import 'cancel_action.dart';
///
/// The optional [isDismissible] can be passed to set barrierDismissible of showCupertinoModalPopup
/// and isDismissible of showModalBottomSheet (Default true as for both implementations)
///
/// The optional [useRootNavigator] can be passed to set useRootNavigator of showCupertinoModalPopup
/// (Default true) and useRootNavigator of showModalBottomSheet (Default false)
Future<T?> showAdaptiveActionSheet<T>({
required BuildContext context,
Widget? title,
Expand All @@ -30,6 +33,7 @@ Future<T?> showAdaptiveActionSheet<T>({
Color? bottomSheetColor,
double? androidBorderRadius,
bool isDismissible = true,
bool? useRootNavigator,
}) async {
assert(
barrierColor != Colors.transparent,
Expand All @@ -45,6 +49,7 @@ Future<T?> showAdaptiveActionSheet<T>({
bottomSheetColor,
androidBorderRadius,
isDismissible: isDismissible,
useRootNavigator: useRootNavigator,
);
}

Expand All @@ -57,6 +62,7 @@ Future<T?> _show<T>(
Color? bottomSheetColor,
double? androidBorderRadius, {
bool isDismissible = true,
bool? useRootNavigator,
}) {
if (Platform.isIOS) {
return _showCupertinoBottomSheet(
Expand All @@ -65,6 +71,7 @@ Future<T?> _show<T>(
actions,
cancelAction,
isDismissible: isDismissible,
useRootNavigator: useRootNavigator,
);
} else {
return _showMaterialBottomSheet(
Expand All @@ -76,6 +83,7 @@ Future<T?> _show<T>(
bottomSheetColor,
androidBorderRadius,
isDismissible: isDismissible,
useRootNavigator: useRootNavigator,
);
}
}
Expand All @@ -86,12 +94,14 @@ Future<T?> _showCupertinoBottomSheet<T>(
List<BottomSheetAction> actions,
CancelAction? cancelAction, {
bool isDismissible = true,
bool? useRootNavigator,
}) {
final defaultTextStyle =
Theme.of(context).textTheme.titleLarge ?? const TextStyle(fontSize: 20);
return showCupertinoModalPopup(
context: context,
barrierDismissible: isDismissible,
useRootNavigator: useRootNavigator ?? true,
builder: (BuildContext coxt) {
return CupertinoActionSheet(
title: title,
Expand Down Expand Up @@ -157,6 +167,7 @@ Future<T?> _showMaterialBottomSheet<T>(
Color? bottomSheetColor,
double? androidBorderRadius, {
bool isDismissible = true,
bool? useRootNavigator,
}) {
final defaultTextStyle =
Theme.of(context).textTheme.titleLarge ?? const TextStyle(fontSize: 20);
Expand All @@ -177,6 +188,7 @@ Future<T?> _showMaterialBottomSheet<T>(
topRight: Radius.circular(androidBorderRadius ?? 30),
),
),
useRootNavigator: useRootNavigator ?? false,
builder: (BuildContext coxt) {
final double screenHeight = MediaQuery.of(context).size.height;
return SafeArea(
Expand Down

0 comments on commit ffdb9da

Please sign in to comment.