Jaime Blasco
... ... @@ -97,6 +97,7 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> {
label: _getRouteLabel(),
explicitChildNodes: true,
child: ModalBottomSheet(
closeProgressThreshold: widget.closeProgressThreshold,
expanded: widget.route.expanded,
containerBuilder: widget.route.containerBuilder,
animationController: widget.route._animationController!,
... ...
... ... @@ -22,6 +22,7 @@ import '../bottom_sheet_route.dart';
const double _behind_widget_visible_height = 10;
const Radius _default_top_radius = Radius.circular(12);
const BoxShadow _default_box_shadow = BoxShadow(blurRadius: 10, color: Colors.black12, spreadRadius: 5);
/// Cupertino Bottom Sheet Container
///
... ... @@ -32,20 +33,23 @@ class _CupertinoBottomSheetContainer extends StatelessWidget {
final Widget child;
final Color? backgroundColor;
final Radius topRadius;
final BoxShadow? shadow;
const _CupertinoBottomSheetContainer({
Key? key,
required this.child,
this.backgroundColor,
required this.topRadius,
this.shadow,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final topSafeAreaPadding = MediaQuery.of(context).padding.top;
final topPadding = _behind_widget_visible_height + topSafeAreaPadding;
final shadow =
final _shadow = shadow ?? _default_box_shadow;
BoxShadow(blurRadius: 10, color: Colors.black12, spreadRadius: 5);
final _backgroundColor =
backgroundColor ?? CupertinoTheme.of(context).scaffoldBackgroundColor;
... ... @@ -55,7 +59,7 @@ class _CupertinoBottomSheetContainer extends StatelessWidget {
borderRadius: BorderRadius.vertical(top: topRadius),
child: Container(
decoration:
BoxDecoration(color: _backgroundColor, boxShadow: [shadow]),
BoxDecoration(color: _backgroundColor, boxShadow: [_shadow]),
width: double.infinity,
child: MediaQuery.removePadding(
context: context,
... ... @@ -89,6 +93,7 @@ Future<T?> showCupertinoModalBottomSheet<T>({
Duration? duration,
RouteSettings? settings,
Color? transitionBackgroundColor,
BoxShadow? shadow,
}) async {
assert(context != null);
assert(builder != null);
... ... @@ -111,6 +116,7 @@ Future<T?> showCupertinoModalBottomSheet<T>({
child: child,
backgroundColor: backgroundColor,
topRadius: topRadius,
shadow: shadow,
),
secondAnimationController: secondAnimation,
expanded: expand,
... ... @@ -135,8 +141,12 @@ Future<T?> showCupertinoModalBottomSheet<T>({
class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> {
final Radius topRadius;
final Curve? previousRouteAnimationCurve;
final BoxShadow? boxShadow;
// Background color behind all routes
// Black by default
final Color? transitionBackgroundColor;
... ... @@ -159,6 +169,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> {
Duration? duration,
RouteSettings? settings,
ScrollController? scrollController,
this.boxShadow = _default_box_shadow,
this.transitionBackgroundColor,
this.topRadius = _default_top_radius,
this.previousRouteAnimationCurve,
... ... @@ -226,6 +237,7 @@ class _CupertinoModalTransition extends StatelessWidget {
final Radius topRadius;
final Curve? animationCurve;
final Color backgroundColor;
final BoxShadow? boxShadow;
final Widget body;
... ... @@ -236,6 +248,7 @@ class _CupertinoModalTransition extends StatelessWidget {
required this.topRadius,
this.backgroundColor = Colors.black,
this.animationCurve,
this.boxShadow,
}) : super(key: key);
@override
... ... @@ -340,6 +353,7 @@ class CupertinoScaffold extends StatefulWidget {
bool enableDrag = true,
Duration? duration,
RouteSettings? settings,
BoxShadow? shadow,
}) async {
assert(context != null);
assert(builder != null);
... ... @@ -363,7 +377,8 @@ class CupertinoScaffold extends StatefulWidget {
containerBuilder: (context, _, child) => _CupertinoBottomSheetContainer(
child: child,
backgroundColor: backgroundColor,
topRadius: _default_top_radius,
topRadius: topRadius ?? _default_top_radius,
shadow: shadow,
),
expanded: expand,
barrierLabel: barrierLabel,
... ...