@@ -6,7 +6,24 @@ import '../models.dart';
66
77part 'show_dialog_action.g.dart' ;
88
9- /// An action that navigates to a new page.
9+ /// Where a [ShowDialogAction] puts its canvas.
10+ enum DialogPresentation {
11+ /// A dialog at the canvas's design size: centered, or placed by
12+ /// [ShowDialogAction.alignment] and [ShowDialogAction.insets] .
13+ dialog,
14+
15+ /// A modal sheet across the bottom of the screen, as wide as the screen and
16+ /// as tall as the canvas (at most 88% of the screen). The canvas draws the
17+ /// sheet's surface, such as rounded top corners and a grab handle.
18+ bottomSheet,
19+
20+ /// A modal sheet along the right edge, as wide as the canvas and as tall
21+ /// as the screen less [ShowDialogAction.insets] .
22+ sideSheet,
23+ }
24+
25+ /// An action that shows a canvas over the current one: as a dialog, a bottom
26+ /// sheet or a side sheet.
1027@JsonSerializable ()
1128class ShowDialogAction extends ActionModel with Equatable , SerializableMixin {
1229 /// Destination canvas node's ID.
@@ -24,13 +41,26 @@ class ShowDialogAction extends ActionModel with Equatable, SerializableMixin {
2441 /// Whether to show a close button on the dialog.
2542 final bool showCloseButton;
2643
44+ /// How the canvas is shown.
45+ final DialogPresentation presentation;
46+
47+ /// Where a dialog sits on the screen, e.g. bottom left for a popover next
48+ /// to a sidebar. Null centers it. Ignored by sheets.
49+ final AlignmentModel ? alignment;
50+
51+ /// Space kept between the canvas and the screen edges it is aligned to.
52+ final EdgeInsetsModel insets;
53+
2754 /// Creates a new [ShowDialogAction] .
2855 ShowDialogAction ({
2956 required this .destinationId,
3057 Map <String , String >? params,
3158 this .barrierColor = ColorRGBA .black54,
3259 this .barrierDismissible = true ,
3360 this .showCloseButton = false ,
61+ this .presentation = DialogPresentation .dialog,
62+ this .alignment,
63+ this .insets = EdgeInsetsModel .zero,
3464 super .nonBlocking,
3565 super .enabled,
3666 }) : params = {...params ?? {}},
@@ -43,6 +73,9 @@ class ShowDialogAction extends ActionModel with Equatable, SerializableMixin {
4373 barrierDismissible,
4474 barrierColor,
4575 showCloseButton,
76+ presentation,
77+ alignment,
78+ insets,
4679 ];
4780
4881 /// Duplicates this [ShowDialogAction] with given data overrides.
@@ -52,12 +85,18 @@ class ShowDialogAction extends ActionModel with Equatable, SerializableMixin {
5285 bool ? barrierDismissible,
5386 ColorRGBA ? barrierColor,
5487 bool ? showCloseButton,
88+ DialogPresentation ? presentation,
89+ AlignmentModel ? alignment,
90+ EdgeInsetsModel ? insets,
5591 }) => ShowDialogAction (
5692 destinationId: destinationId ?? this .destinationId,
5793 params: {...this .params, ...params ?? {}},
5894 barrierDismissible: barrierDismissible ?? this .barrierDismissible,
5995 barrierColor: barrierColor ?? this .barrierColor,
6096 showCloseButton: showCloseButton ?? this .showCloseButton,
97+ presentation: presentation ?? this .presentation,
98+ alignment: alignment ?? this .alignment,
99+ insets: insets ?? this .insets,
61100 );
62101
63102 /// Creates a new [ShowDialogAction] instance from a JSON data.
0 commit comments