chore: Nicer scaffold dialog for column mode
Signed-off-by: Krille <c.kussowski@famedly.com>
This commit is contained in:
parent
955ceec288
commit
64ba93d8ea
2 changed files with 34 additions and 16 deletions
|
|
@ -21,6 +21,7 @@ extension EventInfoDialogExtension on Event {
|
|||
class EventInfoDialog extends StatelessWidget {
|
||||
final Event event;
|
||||
final L10n l10n;
|
||||
|
||||
const EventInfoDialog({
|
||||
required this.event,
|
||||
required this.l10n,
|
||||
|
|
@ -41,10 +42,8 @@ class EventInfoDialog extends StatelessWidget {
|
|||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(L10n.of(context).messageInfo),
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_downward_outlined),
|
||||
leading: CloseButton(
|
||||
onPressed: Navigator.of(context, rootNavigator: false).pop,
|
||||
tooltip: L10n.of(context).close,
|
||||
),
|
||||
),
|
||||
body: ListView(
|
||||
|
|
|
|||
|
|
@ -12,21 +12,40 @@ Future<T?> showAdaptiveBottomSheet<T>({
|
|||
bool isScrollControlled = true,
|
||||
bool useRootNavigator = true,
|
||||
}) {
|
||||
final maxHeight = min(MediaQuery.of(context).size.height - 32, 600);
|
||||
final dialogMode = FluffyThemes.isColumnMode(context);
|
||||
return showModalBottomSheet(
|
||||
if (FluffyThemes.isColumnMode(context)) {
|
||||
return showDialog<T>(
|
||||
context: context,
|
||||
useRootNavigator: useRootNavigator,
|
||||
barrierDismissible: isDismissible,
|
||||
useSafeArea: true,
|
||||
builder: (context) => Container(
|
||||
margin: const EdgeInsets.all(16),
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 480,
|
||||
maxHeight: 720,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Material(
|
||||
elevation: Theme.of(context).dialogTheme.elevation ?? 4,
|
||||
shadowColor: Theme.of(context).dialogTheme.shadowColor,
|
||||
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
child: builder(context),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return showModalBottomSheet<T>(
|
||||
context: context,
|
||||
builder: (context) => Padding(
|
||||
padding: dialogMode
|
||||
? const EdgeInsets.symmetric(vertical: 32.0)
|
||||
: EdgeInsets.zero,
|
||||
padding: EdgeInsets.zero,
|
||||
child: ClipRRect(
|
||||
borderRadius: dialogMode
|
||||
? BorderRadius.circular(AppConfig.borderRadius)
|
||||
: const BorderRadius.only(
|
||||
topLeft: Radius.circular(AppConfig.borderRadius),
|
||||
topRight: Radius.circular(AppConfig.borderRadius),
|
||||
),
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(AppConfig.borderRadius / 2),
|
||||
topRight: Radius.circular(AppConfig.borderRadius / 2),
|
||||
),
|
||||
child: builder(context),
|
||||
),
|
||||
),
|
||||
|
|
@ -34,7 +53,7 @@ Future<T?> showAdaptiveBottomSheet<T>({
|
|||
isDismissible: isDismissible,
|
||||
isScrollControlled: isScrollControlled,
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: maxHeight + (dialogMode ? 64 : 0),
|
||||
maxHeight: min(MediaQuery.of(context).size.height - 32, 600),
|
||||
maxWidth: FluffyThemes.columnWidth * 1.25,
|
||||
),
|
||||
backgroundColor: Colors.transparent,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue