openModal<T> method
Future<T?>
openModal<T>({
- required WidgetBuilder builder,
- WidgetBuilder? modalHandleBuilder,
- required String routeName,
- required Map<
String, dynamic> eventProps, - Color? backgroundColor,
- bool expand = false,
- Radius topRadius = Radius.zero,
- bool noSafeArea = false,
- bool isDismissible = true,
- double? maxHeight,
override
Implementation
@override
// ignore: long-parameter-list
Future<T?> openModal<T>({
required WidgetBuilder builder,
WidgetBuilder? modalHandleBuilder,
required String routeName,
required Map<String, dynamic> eventProps,
Color? backgroundColor,
bool expand = false,
Radius topRadius = Radius.zero,
bool noSafeArea = false,
bool isDismissible = true,
double? maxHeight,
}) {
final theme =
hubbleThemeData(navigatorState.overlay!.context, listen: false);
return showMaterialModalBottomSheet(
context: context,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(16),
),
),
isDismissible: isDismissible,
settings: RouteSettings(
name: routeName,
arguments: eventProps,
),
builder: (context) {
return SingleChildScrollView(
controller: ModalScrollController.of(context),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: isDismissible ? () => maybePop() : null,
child: SizedBox(
height: MediaQuery.of(context).padding.top + 24.0.dp,
),
),
Container(
padding: noSafeArea
? null
: EdgeInsets.only(
bottom: MediaQuery.of(context).padding.bottom,
),
decoration: BoxDecoration(
color: backgroundColor ?? theme.backgroundColor,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(16.0.dp),
topRight: Radius.circular(16.0.dp),
),
),
clipBehavior: Clip.antiAlias,
child: Stack(
children: [
builder(context),
modalHandleBuilder?.call(context) ??
const Align(
alignment: Alignment.center,
child: ModalHandle(),
).positioned(
left: 0, right: 0, top: 0, height: 28.0.dp),
],
),
),
],
),
);
},
);
// return showCupertinoModalBottomSheet<T>(
// context: navigatorState.overlay!.context,
// builder: (context) {
// final theme = hubbleThemeData(context);
//
// final widget = Container(
// width: double.infinity,
// decoration: BoxDecoration(
// color: backgroundColor ?? theme.backgroundColor,
// ),
// child:
// noSafeArea ? builder(context) : SafeArea(child: builder(context)),
// );
//
// return Column(
// mainAxisAlignment: MainAxisAlignment.end,
// mainAxisSize: MainAxisSize.min,
// children: [
// if (expand)
// Expanded(
// child: widget,
// )
// else
// Stack(
// children: [
// widget,
// Align(
// alignment: Alignment.center,
// child: Container(
// width: 45.0.dp,
// height: 4.0.dp,
// decoration: BoxDecoration(
// color: theme.baseTertiaryMedium,
// borderRadius: BorderRadius.circular(10.0.dp),
// ),
// ),
// ).positioned(left: 0, right: 0, top: 0, height: 28.0.dp),
// ],
// ),
// ],
// );
// },
// settings: RouteSettings(
// name: routeName,
// arguments: eventProps,
// ),
// elevation: 50,
// useRootNavigator: true,
// isDismissible: true,
// topRadius: Radius.circular(16.0.dp),
// enableDrag: true,
// );
}