showCustomSheet<T, R> method
Future<SheetResponse<T> ?>
showCustomSheet<T, R>({
- dynamic variant,
- String? title,
- String? description,
- bool hasImage = false,
- String? imageUrl,
- bool showIconInMainButton = false,
- String? mainButtonTitle,
- bool showIconInSecondaryButton = false,
- String? secondaryButtonTitle,
- bool showIconInAdditionalButton = false,
- String? additionalButtonTitle,
- bool takesInput = false,
- Color barrierColor = Colors.black54,
- bool barrierDismissible = true,
- bool isScrollControlled = false,
- String barrierLabel = '',
- @Deprecated('Use `data` and pass in a generic type.') dynamic customData,
- R? data,
- bool enableDrag = true,
- Duration? exitBottomSheetDuration,
- Duration? enterBottomSheetDuration,
- bool? ignoreSafeArea,
Creates a popup with the given widget, a scale animation, and faded background.
The first generic type argument will be the BottomSheetResponse
while the second generic type argument is the BottomSheetRequest
e.g.
await _bottomSheetService.showCustomSheet<GenericBottomSheetResponse, GenericBottomSheetRequest>();
Where GenericBottomSheetResponse
is a defined model response,
and GenericBottomSheetRequest
is the request model.
Implementation
Future<SheetResponse<T>?> showCustomSheet<T, R>({
dynamic variant,
String? title,
String? description,
bool hasImage = false,
String? imageUrl,
bool showIconInMainButton = false,
String? mainButtonTitle,
bool showIconInSecondaryButton = false,
String? secondaryButtonTitle,
bool showIconInAdditionalButton = false,
String? additionalButtonTitle,
bool takesInput = false,
Color barrierColor = Colors.black54,
bool barrierDismissible = true,
bool isScrollControlled = false,
String barrierLabel = '',
@Deprecated('Use `data` and pass in a generic type.') dynamic customData,
R? data,
bool enableDrag = true,
Duration? exitBottomSheetDuration,
Duration? enterBottomSheetDuration,
bool? ignoreSafeArea,
bool useRootNavigator = false,
}) {
assert(
_sheetBuilders != null,
'''
There's no sheet builder supplied for the variant:$variant. If you haven't yet setup your
custom builder. Please call the setCustomSheetBuilders function on the service and supply
the UI that you'd like to build for each variant.
If you have already done that. Make sure that the variant:$variant has a builder associated
with it.
''',
);
final sheetBuilder = _sheetBuilders![variant];
return Get.bottomSheet<SheetResponse<T>>(
Material(
type: MaterialType.transparency,
child: sheetBuilder!(
Get.context!,
SheetRequest<R>(
title: title,
description: description,
hasImage: hasImage,
imageUrl: imageUrl,
showIconInMainButton: showIconInMainButton,
mainButtonTitle: mainButtonTitle,
showIconInSecondaryButton: showIconInSecondaryButton,
secondaryButtonTitle: secondaryButtonTitle,
showIconInAdditionalButton: showIconInAdditionalButton,
additionalButtonTitle: additionalButtonTitle,
takesInput: takesInput,
// ignore: deprecated_member_use_from_same_package
customData: customData,
variant: variant,
data: data,
),
completeSheet,
),
),
barrierColor: barrierColor,
isDismissible: barrierDismissible,
isScrollControlled: isScrollControlled,
enableDrag: barrierDismissible && enableDrag,
exitBottomSheetDuration: exitBottomSheetDuration,
enterBottomSheetDuration: enterBottomSheetDuration,
ignoreSafeArea: ignoreSafeArea,
settings: RouteSettings(
name: '$variant\_${_hashConcateator([
title,
description,
mainButtonTitle,
secondaryButtonTitle,
])}'),
useRootNavigator: useRootNavigator,
);
}