High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
feat(mobile): action bottom sheet on map timeline (#27515)
Yaros39cfad713669
diff --git a/mobile/lib/presentation/widgets/bottom_sheet/map_bottom_sheet.widget.dart b/mobile/lib/presentation/widgets/bottom_sheet/map_bottom_sheet.widget.dartindex d7ef604718..3770c5d32d 100644--- a/mobile/lib/presentation/widgets/bottom_sheet/map_bottom_sheet.widget.dart+++ b/mobile/lib/presentation/widgets/bottom_sheet/map_bottom_sheet.widget.dart@@ -2,17 +2,21 @@ import 'package:flutter/material.dart';import 'package:hooks_riverpod/hooks_riverpod.dart';import 'package:immich_mobile/extensions/build_context_extensions.dart';import 'package:immich_mobile/presentation/widgets/bottom_sheet/base_bottom_sheet.widget.dart';+import 'package:immich_mobile/presentation/widgets/bottom_sheet/general_bottom_sheet.widget.dart';import 'package:immich_mobile/presentation/widgets/map/map.state.dart';import 'package:immich_mobile/presentation/widgets/timeline/timeline.widget.dart';import 'package:immich_mobile/providers/infrastructure/timeline.provider.dart';import 'package:immich_mobile/providers/user.provider.dart';class MapBottomSheet extends StatelessWidget {- const MapBottomSheet({super.key});+ final Key? sheetKey;++ const MapBottomSheet({super.key, this.sheetKey});@overrideWidget build(BuildContext context) {return BaseBottomSheet(+ key: sheetKey,initialChildSize: 0.25,maxChildSize: 0.75,shouldCloseOnMinExtent: false,@@ -49,7 +53,7 @@ class _ScopedMapTimeline extends StatelessWidget {return timelineService;}),],- child: const Timeline(appBar: null, bottomSheet: null, withScrubber: false),+ child: const Timeline(appBar: null, bottomSheet: GeneralBottomSheet(minChildSize: 0.23), withScrubber: false),);}}diff --git a/mobile/lib/presentation/widgets/map/map.widget.dart b/mobile/lib/presentation/widgets/map/map.widget.dartindex 3f406dd551..f6c4f7d468 100644--- a/mobile/lib/presentation/widgets/map/map.widget.dart+++ b/mobile/lib/presentation/widgets/map/map.widget.dart@@ -11,6 +11,7 @@ import 'package:immich_mobile/domain/utils/event_stream.dart';import 'package:immich_mobile/extensions/asyncvalue_extensions.dart';import 'package:immich_mobile/extensions/build_context_extensions.dart';import 'package:immich_mobile/extensions/translate_extensions.dart';+import 'package:immich_mobile/presentation/widgets/bottom_sheet/base_bottom_sheet.widget.dart';import 'package:immich_mobile/presentation/widgets/bottom_sheet/map_bottom_sheet.widget.dart';import 'package:immich_mobile/presentation/widgets/map/map.state.dart';import 'package:immich_mobile/presentation/widgets/map/map_utils.dart';@@ -53,6 +54,7 @@ class _DriftMapState extends ConsumerState<DriftMap> {final _reloadMutex = AsyncMutex();final _debouncer = Debouncer(interval: const Duration(milliseconds: 500), maxWaitTime: const Duration(seconds: 2));final ValueNotifier<double> bottomSheetOffset = ValueNotifier(0.25);+ final GlobalKey _bottomSheetKey = GlobalKey();StreamSubscription? _eventSubscription;@override@@ -184,7 +186,7 @@ class _DriftMapState extends ConsumerState<DriftMap> {return Stack(children: [_Map(initialLocation: widget.initialLocation, onMapCreated: onMapCreated, onMapReady: onMapReady),- _DynamicBottomSheet(bottomSheetOffset: bottomSheetOffset),+ _DynamicBottomSheet(bottomSheetOffset: bottomSheetOffset, sheetKey: _bottomSheetKey),_DynamicMyLocationButton(onZoomToLocation: onZoomToLocation, bottomSheetOffset: bottomSheetOffset),],);@@ -224,8 +226,9 @@ class _Map extends StatelessWidget {class _DynamicBottomSheet extends StatefulWidget {final ValueNotifier<double> bottomSheetOffset;+ final GlobalKey sheetKey;- const _DynamicBottomSheet({required this.bottomSheetOffset});+ const _DynamicBottomSheet({required this.bottomSheetOffset, required this.sheetKey});@overrideState<_DynamicBottomSheet> createState() => _DynamicBottomSheetState();@@ -236,10 +239,13 @@ class _DynamicBottomSheetState extends State<_DynamicBottomSheet> {Widget build(BuildContext context) {return NotificationListener<DraggableScrollableNotification>(onNotification: (notification) {- widget.bottomSheetOffset.value = notification.extent;- return true;+ final sheet = notification.context.findAncestorWidgetOfExactType<BaseBottomSheet>();+ if (sheet?.key == widget.sheetKey) {+ widget.bottomSheetOffset.value = notification.extent;+ }+ return false;},- child: const MapBottomSheet(),+ child: MapBottomSheet(sheetKey: widget.sheetKey),);}}diff --git a/mobile/lib/presentation/widgets/timeline/timeline.widget.dart b/mobile/lib/presentation/widgets/timeline/timeline.widget.dartindex 8d494a8452..578bd37a23 100644--- a/mobile/lib/presentation/widgets/timeline/timeline.widget.dart+++ b/mobile/lib/presentation/widgets/timeline/timeline.widget.dart@@ -469,6 +469,7 @@ class _SliverTimelineState extends ConsumerState<_SliverTimeline> {ref.read(timelineStateProvider.notifier).setScrolling(true);},child: Stack(+ clipBehavior: Clip.none,children: [timeline,if (isBottomWidgetVisible)