Skip to main content

BottomSheetCommand

The class represents a command for showing or hiding a modal bottom sheet. Extends RemoteCommand.

Properties​

PropertyTypeDescription
actionOverlayActionAction (open or close)
contentMap<String, dynamic>BottomSheet content (widget tree)
isScrollControlledboolContent scroll control
isDismissibleboolCan be dismissed by tapping outside (default true)
useSafeAreaboolUse safe area
useRootNavigatorboolUse root navigator
enableDragboolAllow dragging (default true)
showDragHandlebool?Show drag handle
scrollControlDisabledMaxHeightRatiodoubleMaximum height ratio
backgroundColorColor?Background color
barrierColorColor?Barrier color
shapeShapeBorder?Border shape
clipBehaviorClip?Clip behavior
constraintsBoxConstraints?Size constraints
anchorPointOffset?Anchor point
onCloseServerAction?Action on close

Class Definition​

final class BottomSheetCommand extends RemoteCommand {
final OverlayAction action;
final Map<String, dynamic> content;
final bool isScrollControlled;
final bool isDismissible;
final bool useSafeArea;
final bool useRootNavigator;
final bool enableDrag;
final bool? showDragHandle;
final double scrollControlDisabledMaxHeightRatio;
final Color? backgroundColor;
final Color? barrierColor;
final ShapeBorder? shape;
final Clip? clipBehavior;
final BoxConstraints? constraints;
final Offset? anchorPoint;
final ServerAction? onClose;

const BottomSheetCommand({...});

factory BottomSheetCommand.fromRemoteCommand(RemoteCommand command);
}

OverlayAction​

enum OverlayAction {
open, // Open modal window
close, // Close modal window
}

JSON Examples​

Opening BottomSheet​

{
"type": "command",
"controllerId": "overlay",
"commandData": {
"type": "bottomSheet",
"action": "open",
"content": {
"type": "Container",
"attributes": {
"padding": {"top": 16, "bottom": 16, "left": 16, "right": 16}
},
"child": {
"type": "Text",
"attributes": {
"data": "Hello from BottomSheet!"
}
}
},
"isScrollControlled": true,
"isDismissible": true,
"enableDrag": true,
"showDragHandle": true,
"backgroundColor": "#FFFFFF"
}
}

Closing BottomSheet​

{
"type": "command",
"controllerId": "overlay",
"commandData": {
"type": "bottomSheet",
"action": "close"
}
}

With Close Handler​

{
"type": "command",
"controllerId": "overlay",
"commandData": {
"type": "bottomSheet",
"action": "open",
"content": {...},
"onClose": {
"executionType": 0,
"event": "/on-sheet-closed"
}
}
}