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,
|
required Widget Function(BuildContext) builder,
|
||||||
bool isDismissible = true,
|
bool isDismissible = true,
|
||||||
bool isScrollControlled = true,
|
bool isScrollControlled = true,
|
||||||
double maxHeight = 512,
|
double maxHeight = 600,
|
||||||
bool useRootNavigator = true,
|
bool useRootNavigator = true,
|
||||||
}) =>
|
}) {
|
||||||
showModalBottomSheet(
|
final dialogMode = FluffyThemes.isColumnMode(context);
|
||||||
context: context,
|
return showModalBottomSheet(
|
||||||
builder: builder,
|
context: context,
|
||||||
// this sadly is ugly on desktops but otherwise breaks `.of(context)` calls
|
builder: (context) => Padding(
|
||||||
useRootNavigator: useRootNavigator,
|
padding:
|
||||||
isDismissible: isDismissible,
|
dialogMode ? const EdgeInsets.only(bottom: 32.0) : EdgeInsets.zero,
|
||||||
isScrollControlled: isScrollControlled,
|
child: ClipRRect(
|
||||||
constraints: BoxConstraints(
|
borderRadius: dialogMode
|
||||||
maxHeight: maxHeight,
|
? BorderRadius.circular(AppConfig.borderRadius)
|
||||||
maxWidth: FluffyThemes.columnWidth * 1.25,
|
: const BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(AppConfig.borderRadius),
|
||||||
|
topRight: Radius.circular(AppConfig.borderRadius),
|
||||||
|
),
|
||||||
|
child: builder(context),
|
||||||
),
|
),
|
||||||
clipBehavior: Clip.hardEdge,
|
),
|
||||||
shape: const RoundedRectangleBorder(
|
useRootNavigator: useRootNavigator,
|
||||||
borderRadius: BorderRadius.only(
|
isDismissible: isDismissible,
|
||||||
topLeft: Radius.circular(AppConfig.borderRadius),
|
isScrollControlled: isScrollControlled,
|
||||||
topRight: Radius.circular(AppConfig.borderRadius),
|
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',
|
chunk?.name ?? roomAlias ?? chunk?.roomId ?? 'Unknown',
|
||||||
overflow: TextOverflow.fade,
|
overflow: TextOverflow.fade,
|
||||||
),
|
),
|
||||||
leading: IconButton(
|
leading: Center(
|
||||||
icon: const Icon(Icons.arrow_downward_outlined),
|
child: CloseButton(
|
||||||
onPressed: Navigator.of(context, rootNavigator: false).pop,
|
onPressed: Navigator.of(context, rootNavigator: false).pop,
|
||||||
tooltip: L10n.of(context).close,
|
),
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
Padding(
|
Padding(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue