@@ -22,6 +22,8 @@ class ShowBottomSheetAction extends EnsembleAction {
22
22
});
23
23
24
24
static const defaultTopBorderRadius = Radius .circular (16 );
25
+ static const dragHandleHeight = 3.0 ;
26
+ static const dragHandleVerticalMargin = 10.0 ;
25
27
26
28
final Map payload;
27
29
final dynamic body;
@@ -132,7 +134,21 @@ class ShowBottomSheetAction extends EnsembleAction {
132
134
}
133
135
134
136
Widget getBodyWidget (ScopeManager scopeManager, BuildContext context) {
135
- var widget = scopeManager.buildWidgetFromDefinition (body);
137
+ // We have to handle the BottomSheet's padding directly around the widget,
138
+ // such that it is inside the Scrollable area to be able to move up and down.
139
+ var sheetPadding = padding (scopeManager) ?? EdgeInsets .zero;
140
+
141
+ // account for the drag handle
142
+ if (showDragHandle (scopeManager)) {
143
+ var additionalPaddingTop =
144
+ dragHandleVerticalMargin * 2 + dragHandleHeight;
145
+ sheetPadding =
146
+ sheetPadding.copyWith (top: sheetPadding.top + additionalPaddingTop);
147
+ }
148
+
149
+ var widget = Padding (
150
+ padding: sheetPadding,
151
+ child: scopeManager.buildWidgetFromDefinition (body));
136
152
137
153
if (isScrollable (scopeManager) == true ) {
138
154
// fix the viewport numbers if used incorrectly
@@ -159,7 +175,7 @@ class ShowBottomSheetAction extends EnsembleAction {
159
175
// so the height will be fixed to initialViewport, and content will just scroll within it.
160
176
// https://docs.flutter.dev/release/breaking-changes/default-scroll-behavior-drag
161
177
return DraggableScrollableSheet (
162
- expand: false ,
178
+ expand: true ,
163
179
minChildSize: minViewport,
164
180
maxChildSize: maxViewport,
165
181
initialChildSize: initialViewport,
@@ -181,8 +197,6 @@ class ShowBottomSheetAction extends EnsembleAction {
181
197
Widget buildRootContainer (ScopeManager scopeManager, BuildContext context,
182
198
{required Widget child, required bool isScrollable}) {
183
199
Widget rootWidget = Container (
184
- margin: margin (scopeManager),
185
- padding: padding (scopeManager),
186
200
decoration: BoxDecoration (
187
201
color: getBackgroundColor (scopeManager) ??
188
202
Theme .of (context).dialogBackgroundColor,
@@ -202,14 +216,17 @@ class ShowBottomSheetAction extends EnsembleAction {
202
216
children: [rootWidget, _buildDragHandle (scopeManager)],
203
217
);
204
218
}
205
- return rootWidget;
219
+ // This is the Margin of the bottom sheet.
220
+ // Padding will be handled separately inside the scrollable area
221
+ return Padding (
222
+ padding: margin (scopeManager) ?? EdgeInsets .zero, child: rootWidget);
206
223
}
207
224
208
225
Widget _buildDragHandle (ScopeManager scopeManager) {
209
226
return Container (
210
- margin: const EdgeInsets .only (top: 10 ),
227
+ margin: const EdgeInsets .only (top: dragHandleVerticalMargin ),
211
228
width: 32 ,
212
- height: 3 ,
229
+ height: dragHandleHeight ,
213
230
decoration: BoxDecoration (
214
231
color: dragHandleColor (scopeManager) ?? Colors .grey[500 ],
215
232
borderRadius: BorderRadius .circular (12 ),
0 commit comments