style: New modal bottom sheets
This commit is contained in:
parent
4376070733
commit
2df72b5d13
19 changed files with 328 additions and 355 deletions
28
lib/utils/adaptive_bottom_sheet.dart
Normal file
28
lib/utils/adaptive_bottom_sheet.dart
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
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,
|
||||
}) =>
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: builder,
|
||||
useRootNavigator: !PlatformInfos.isMobile,
|
||||
isDismissible: isDismissible,
|
||||
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),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
@ -10,6 +10,7 @@ import 'package:url_launcher/url_launcher.dart';
|
|||
import 'package:vrouter/vrouter.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/utils/adaptive_bottom_sheet.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import 'package:fluffychat/widgets/profile_bottom_sheet.dart';
|
||||
import 'package:fluffychat/widgets/public_room_bottom_sheet.dart';
|
||||
|
|
@ -145,7 +146,7 @@ class UrlLauncher {
|
|||
}
|
||||
return;
|
||||
} else {
|
||||
await showModalBottomSheet(
|
||||
await showAdaptiveBottomSheet(
|
||||
context: context,
|
||||
builder: (c) => PublicRoomBottomSheet(
|
||||
roomAlias: identityParts.primaryIdentifier,
|
||||
|
|
@ -182,7 +183,7 @@ class UrlLauncher {
|
|||
}
|
||||
}
|
||||
} else if (identityParts.primaryIdentifier.sigil == '@') {
|
||||
await showModalBottomSheet(
|
||||
await showAdaptiveBottomSheet(
|
||||
context: context,
|
||||
builder: (c) => ProfileBottomSheet(
|
||||
userId: identityParts.primaryIdentifier,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue