fix: desktop context menu position and bottom sheet sizing

This commit is contained in:
edde746
2026-03-05 14:25:23 +01:00
parent 268f293704
commit a2cd3397c9
2 changed files with 28 additions and 13 deletions
+11 -1
View File
@@ -121,10 +121,20 @@ class OverlaySheetController {
showDragHandle: showDragHandle,
);
}
// Apply the same default constraints the overlay system uses so sheets
// shown without an OverlaySheetHost still have sensible sizing on desktop.
final effectiveConstraints = constraints ?? () {
final size = MediaQuery.of(context).size;
final isDesktop = size.width > 600;
return BoxConstraints(
maxWidth: isDesktop ? 700 : double.infinity,
maxHeight: isDesktop ? 400 : size.height * 0.75,
);
}();
return showModalBottomSheet<T>(
context: context,
builder: builder,
constraints: constraints,
constraints: effectiveConstraints,
backgroundColor: backgroundColor ?? Theme.of(context).colorScheme.surface,
barrierColor: Colors.black54,
isScrollControlled: isScrollControlled,