showVoOverlay<Result, T> function
Future<Result?>
showVoOverlay<Result, T>(
- BuildContext context, {
- bool cancelable = true,
- bool useSafeArea = true,
- VoOverlayType type = VoOverlayType.bottomSheet,
- ScrollController? scrollController,
- VoBottomSheetOptions bottomSheetOptions = const VoBottomSheetOptions(),
- required VoOverlayOptions<
T> options,
Implementation
Future<Result?> showVoOverlay<Result, T>(
BuildContext context, {
bool cancelable = true,
bool useSafeArea = true,
VoOverlayType type = VoOverlayType.bottomSheet,
ScrollController? scrollController,
VoBottomSheetOptions bottomSheetOptions = const VoBottomSheetOptions(),
required VoOverlayOptions<T> options,
}) {
final overlayTheme = context.componentTheme.overlay;
DraggableScrollableController? sheetController;
if (type == VoOverlayType.bottomSheet) {
sheetController ??= DraggableScrollableController();
}
return switch (type) {
VoOverlayType.bottomSheet => showModalBottomSheet<Result>(
context: context,
// The shell paints the background, corners and shadow.
backgroundColor: Colors.transparent,
elevation: 0,
barrierColor: overlayTheme.barrierColor,
isDismissible: cancelable,
enableDrag: cancelable,
isScrollControlled: bottomSheetOptions.canFullHeight,
builder: (context) => DraggableScrollableSheet(
expand: false,
maxChildSize: bottomSheetOptions.maxChildSize,
minChildSize: bottomSheetOptions.minChildSize,
controller: sheetController!,
initialChildSize: bottomSheetOptions.initialChildSize,
builder: (context, controller) => VoBottomSheetShell<T>(
type: type,
options: options,
useSafeArea: useSafeArea,
sheetController: sheetController!,
scrollController: scrollController ?? controller,
bottomSheetOptions: bottomSheetOptions,
),
),
),
VoOverlayType.modal => showGeneralDialog<Result>(
context: context,
barrierColor: overlayTheme.barrierColor,
fullscreenDialog: true,
// transitionDuration: context.componentTheme
// .switchingViewTransition().duration,
// transitionBuilder: (context, animation, _, child) => context.componentTheme
// .switchingViewTransition()
// .transitionBuilder(child, animation),
pageBuilder: (context, _, _) => Material(
color: Colors.transparent,
child: VoBottomSheetShell<T>(
type: type,
useSafeArea: useSafeArea,
options: options,
scrollController: scrollController,
),
),
),
VoOverlayType.dialog => showDialog<Result>(
context: context,
barrierColor: overlayTheme.barrierColor,
barrierDismissible: cancelable,
builder: (context) => Material(
color: Colors.transparent,
child: VoBottomSheetShell<T>(
type: type,
options: options,
useSafeArea: useSafeArea,
scrollController: scrollController,
),
),
),
};
}