showDoubleSheet<T> function
Future<T?>
showDoubleSheet<T>({
- required BuildContext context,
- required String title,
- required Widget child,
- Widget? titleWidget,
- Widget? customHeaderWidget,
- double initialChildSize = 0.4,
- double minChildSize = 0.25,
- double maxChildSize = 0.9,
- Color? backgroundColor,
- Color? headerBackgroundColor,
- TextStyle? titleStyle,
- bool enableDrag = true,
- bool isDismissible = true,
- bool showDragHandle = true,
- bool allowFullScreen = false,
- BorderRadius? borderRadius,
- BorderRadius? headerRadius,
- bool enableSynchronizedScrolling = false,
Implementation
Future<T?> showDoubleSheet<T>({
required BuildContext context,
required String title,
required Widget child,
Widget? titleWidget,
Widget? customHeaderWidget,
double initialChildSize = 0.4,
double minChildSize = 0.25,
double maxChildSize = 0.9,
Color? backgroundColor,
Color? headerBackgroundColor,
TextStyle? titleStyle,
bool enableDrag = true,
bool isDismissible = true,
bool showDragHandle = true,
bool allowFullScreen = false,
BorderRadius? borderRadius,
BorderRadius? headerRadius,
bool enableSynchronizedScrolling = false,
}) {
final config = DoubleSheetConfig(
title: title,
titleWidget: titleWidget,
customHeaderWidget: customHeaderWidget,
initialChildSize: initialChildSize,
minChildSize: minChildSize,
maxChildSize: maxChildSize,
backgroundColor: backgroundColor,
headerBackgroundColor: headerBackgroundColor,
titleStyle: titleStyle,
enableDrag: enableDrag,
isDismissible: isDismissible,
showDragHandle: showDragHandle,
allowFullScreen: allowFullScreen,
borderRadius: borderRadius,
headerRadius: headerRadius,
enableSynchronizedScrolling: enableSynchronizedScrolling,
);
return showGeneralDialog<T>(
context: context,
barrierDismissible: isDismissible,
barrierLabel:
isDismissible
? MaterialLocalizations.of(context).modalBarrierDismissLabel
: null,
barrierColor: Colors.black.withValues(alpha: 0.5),
transitionDuration: const Duration(milliseconds: 300),
pageBuilder: (dialogContext, animation, secondaryAnimation) {
return PopScope(
canPop: true,
child: MediaQuery.removeViewInsets(
context: dialogContext,
removeTop: true,
child: SynchronizedDoubleSheet(
config: config,
animation: animation,
onClose: () {
if (Navigator.of(dialogContext).canPop()) {
Navigator.of(dialogContext, rootNavigator: false).pop();
}
},
child: child,
),
),
);
},
transitionBuilder: (context, animation, secondaryAnimation, child) {
return child;
},
);
}