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,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,10 +92,10 @@ class PublicRoomBottomSheet extends StatelessWidget {
|
|||
chunk?.name ?? roomAlias ?? chunk?.roomId ?? 'Unknown',
|
||||
overflow: TextOverflow.fade,
|
||||
),
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_downward_outlined),
|
||||
onPressed: Navigator.of(context, rootNavigator: false).pop,
|
||||
tooltip: L10n.of(context).close,
|
||||
leading: Center(
|
||||
child: CloseButton(
|
||||
onPressed: Navigator.of(context, rootNavigator: false).pop,
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
Padding(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue