mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
feat(mobile): drift map page
This commit is contained in:
parent
da5deffd03
commit
d308d023c2
15 changed files with 783 additions and 0 deletions
|
|
@ -0,0 +1,42 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/presentation/widgets/bottom_sheet/base_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:maplibre_gl/maplibre_gl.dart';
|
||||
|
||||
class MapBottomSheet extends ConsumerWidget {
|
||||
const MapBottomSheet({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
LatLngBounds bounds = ref.watch(mapStateProvider.select((s) => s.bounds));
|
||||
|
||||
ref.listen(mapStateProvider, (previous, next) async {
|
||||
bounds = next.bounds;
|
||||
});
|
||||
|
||||
return ProviderScope(
|
||||
overrides: [
|
||||
// TODO: refactor (timeline): when ProviderScope changed, we should refresh timeline
|
||||
timelineServiceProvider.overrideWith((ref) {
|
||||
final timelineService =
|
||||
ref.watch(timelineFactoryProvider).map(bounds);
|
||||
ref.onDispose(timelineService.dispose);
|
||||
return timelineService;
|
||||
}),
|
||||
],
|
||||
child: const BaseBottomSheet(
|
||||
initialChildSize: 0.25,
|
||||
shouldCloseOnMinExtent: false,
|
||||
actions: [],
|
||||
slivers: [
|
||||
SliverFillRemaining(
|
||||
child: Timeline(),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue