chore: Merge upstream changes --------- Signed-off-by: Krille <c.kussowski@famedly.com> Co-authored-by: krille-chan <christian-kussowski@posteo.de> Co-authored-by: Krille <c.kussowski@famedly.com> Co-authored-by: Linerly <linerly@proton.me> Co-authored-by: Priit Jõerüüt <hwlate@joeruut.com> Co-authored-by: 大王叫我来巡山 <hamburger2048@users.noreply.hosted.weblate.org> Co-authored-by: fadelkon <fadelkon@posteo.net> Co-authored-by: Aindriú Mac Giolla Eoin <aindriu80@gmail.com> Co-authored-by: Edgars Andersons <Edgars+Weblate@gaitenis.id.lv> Co-authored-by: josé m <correoxm@disroot.org> Co-authored-by: Bezruchenko Simon <worcposj44@gmail.com> Co-authored-by: Christian <christian-pauly@posteo.de> Co-authored-by: - <hitekex@yandex.ru> Co-authored-by: Angelo Schirinzi <Odi-3@users.noreply.hosted.weblate.org> Co-authored-by: xabirequejo <xabi.rn@gmail.com> Co-authored-by: Piotr Orzechowski <piotr@orzechowski.tech> Co-authored-by: Rex_sa <rex.sa@pm.me> Co-authored-by: Tewuzij <tenajeza@outlook.com> Co-authored-by: goknarbahceli <goknarbahceli@proton.me> Co-authored-by: தமிழ்நேரம் <anishprabu.t@gmail.com> Co-authored-by: Erin <erin@erindesu.cz> Co-authored-by: EpicKiwi <me@epickiwi.fr> Co-authored-by: Christian Tietze <me@christiantietze.de> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
43 lines
1.4 KiB
Dart
43 lines
1.4 KiB
Dart
import 'dart:math';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:fluffychat/config/app_config.dart';
|
|
import 'package:fluffychat/config/themes.dart';
|
|
|
|
Future<T?> showAdaptiveBottomSheet<T>({
|
|
required BuildContext context,
|
|
required Widget Function(BuildContext) builder,
|
|
bool isDismissible = true,
|
|
bool isScrollControlled = true,
|
|
bool useRootNavigator = true,
|
|
}) {
|
|
final maxHeight = min(MediaQuery.of(context).size.height - 32, 600);
|
|
final dialogMode = FluffyThemes.isColumnMode(context);
|
|
return showModalBottomSheet(
|
|
context: context,
|
|
builder: (context) => Padding(
|
|
padding: dialogMode
|
|
? const EdgeInsets.symmetric(vertical: 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),
|
|
),
|
|
),
|
|
useRootNavigator: useRootNavigator,
|
|
isDismissible: isDismissible,
|
|
isScrollControlled: isScrollControlled,
|
|
constraints: BoxConstraints(
|
|
maxHeight: maxHeight + (dialogMode ? 64 : 0),
|
|
maxWidth: FluffyThemes.columnWidth * 1.25,
|
|
),
|
|
backgroundColor: Colors.transparent,
|
|
clipBehavior: Clip.hardEdge,
|
|
);
|
|
}
|