fluffychat/lib/utils/adaptive_bottom_sheet.dart

31 lines
1017 B
Dart
Raw Normal View History

2023-01-07 10:29:34 +01:00
import 'package:flutter/material.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/utils/platform_infos.dart';
Future<T?> showAdaptiveBottomSheet<T>({
required BuildContext context,
required Widget Function(BuildContext) builder,
bool isDismissible = true,
2023-01-08 12:32:35 +01:00
bool isScrollControlled = false,
2023-01-07 10:29:34 +01:00
}) =>
showModalBottomSheet(
context: context,
builder: builder,
useRootNavigator: !PlatformInfos.isMobile,
isDismissible: isDismissible,
2023-01-08 12:32:35 +01:00
isScrollControlled: isScrollControlled,
2023-01-07 10:29:34 +01:00
constraints: BoxConstraints(
maxHeight: MediaQuery.of(context).size.height - 128,
maxWidth: FluffyThemes.columnWidth * 1.5,
),
clipBehavior: Clip.hardEdge,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(AppConfig.borderRadius),
topRight: Radius.circular(AppConfig.borderRadius),
),
),
);