show static method
void
show(})
Displays a modal bottom sheet with customizable content and behavior.
Shows a bottom sheet with white background, rounded top corners, and elevation.
The sheet can be dismissed by tapping outside or dragging down (if isDismissible is true).
Parameters:
bottomSheet: The widget to display in the bottom sheet.isDismissible: Whether the sheet can be dismissed by user interaction (defaults to true).resultCallback: Optional callback invoked when the sheet is dismissed, receiving any returned value.
The sheet automatically uses:
- White background color
- 10px elevation
- 20px rounded top corners
- Scroll-controlled content
Example:
GlobalBottomSheet.show(
Column(
children: [
Text('Select an option'),
ListTile(title: Text('Option 1'), onTap: () => Get.back(result: 1)),
ListTile(title: Text('Option 2'), onTap: () => Get.back(result: 2)),
],
),
resultCallback: (value) => print('Selected: $value'),
);
Implementation
static void show(Widget bottomSheet,
{bool isDismissible = true, Function(dynamic value)? resultCallback}) {
Get.bottomSheet(
isDismissible: isDismissible,
bottomSheet,
backgroundColor: Colors.white,
elevation: 10,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20),
),
),
isScrollControlled: true,
).then(
(value) => resultCallback != null ? resultCallback(value) : "",
);
}