chore: Better bottom sheets on desktop
This commit is contained in:
parent
960d603037
commit
dea29161c8
2 changed files with 33 additions and 24 deletions
|
|
@ -8,25 +8,34 @@ Future<T?> showAdaptiveBottomSheet<T>({
|
|||
required Widget Function(BuildContext) builder,
|
||||
bool isDismissible = true,
|
||||
bool isScrollControlled = true,
|
||||
double maxHeight = 512,
|
||||
double maxHeight = 600,
|
||||
bool useRootNavigator = true,
|
||||
}) =>
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: builder,
|
||||
// this sadly is ugly on desktops but otherwise breaks `.of(context)` calls
|
||||
useRootNavigator: useRootNavigator,
|
||||
isDismissible: isDismissible,
|
||||
isScrollControlled: isScrollControlled,
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: maxHeight,
|
||||
maxWidth: FluffyThemes.columnWidth * 1.25,
|
||||
}) {
|
||||
final dialogMode = FluffyThemes.isColumnMode(context);
|
||||
return showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (context) => Padding(
|
||||
padding:
|
||||
dialogMode ? const EdgeInsets.only(bottom: 32.0) : EdgeInsets.zero,
|
||||
child: ClipRRect(
|
||||
borderRadius: dialogMode
|
||||
? BorderRadius.circular(AppConfig.borderRadius)
|
||||
: const BorderRadius.only(
|
||||
topLeft: Radius.circular(AppConfig.borderRadius),
|
||||
topRight: Radius.circular(AppConfig.borderRadius),
|
||||
),
|
||||
child: builder(context),
|
||||
),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(AppConfig.borderRadius),
|
||||
topRight: Radius.circular(AppConfig.borderRadius),
|
||||
),
|
||||
),
|
||||
);
|
||||
),
|
||||
useRootNavigator: useRootNavigator,
|
||||
isDismissible: isDismissible,
|
||||
isScrollControlled: isScrollControlled,
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: maxHeight + (dialogMode ? 32 : 0),
|
||||
maxWidth: FluffyThemes.columnWidth * 1.25 + 64,
|
||||
),
|
||||
backgroundColor: Colors.transparent,
|
||||
showDragHandle: !dialogMode,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue