mirror of
https://github.com/immich-app/immich.git
synced 2025-08-11 09:16:31 -04:00
fix: refresh timeline by key
This commit is contained in:
parent
bcac0983d7
commit
34786f3d48
@ -6,20 +6,34 @@ import 'package:immich_mobile/presentation/widgets/timeline/timeline.widget.dart
|
|||||||
import 'package:immich_mobile/providers/infrastructure/timeline.provider.dart';
|
import 'package:immich_mobile/providers/infrastructure/timeline.provider.dart';
|
||||||
import 'package:maplibre_gl/maplibre_gl.dart';
|
import 'package:maplibre_gl/maplibre_gl.dart';
|
||||||
|
|
||||||
class MapBottomSheet extends ConsumerWidget {
|
class MapBottomSheet extends ConsumerStatefulWidget {
|
||||||
const MapBottomSheet({super.key});
|
const MapBottomSheet({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
ConsumerState<MapBottomSheet> createState() => _MapBottomSheetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MapBottomSheetState extends ConsumerState<MapBottomSheet> {
|
||||||
|
GlobalKey key = GlobalKey();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
LatLngBounds bounds = ref.watch(mapStateProvider.select((s) => s.bounds));
|
LatLngBounds bounds = ref.watch(mapStateProvider.select((s) => s.bounds));
|
||||||
|
|
||||||
ref.listen(mapStateProvider, (previous, next) async {
|
ref.listen(mapStateProvider, (previous, next) async {
|
||||||
bounds = next.bounds;
|
bounds = next.bounds;
|
||||||
|
key = GlobalKey();
|
||||||
});
|
});
|
||||||
|
|
||||||
return ProviderScope(
|
return BaseBottomSheet(
|
||||||
|
initialChildSize: 0.25,
|
||||||
|
shouldCloseOnMinExtent: false,
|
||||||
|
actions: [],
|
||||||
|
slivers: [
|
||||||
|
SliverFillRemaining(
|
||||||
|
child: ProviderScope(
|
||||||
|
key: key,
|
||||||
overrides: [
|
overrides: [
|
||||||
// TODO: when ProviderScope changed, we should refresh timeline
|
|
||||||
timelineServiceProvider.overrideWith((ref) {
|
timelineServiceProvider.overrideWith((ref) {
|
||||||
final timelineService =
|
final timelineService =
|
||||||
ref.watch(timelineFactoryProvider).map(bounds);
|
ref.watch(timelineFactoryProvider).map(bounds);
|
||||||
@ -27,16 +41,10 @@ class MapBottomSheet extends ConsumerWidget {
|
|||||||
return timelineService;
|
return timelineService;
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
child: const BaseBottomSheet(
|
child: const Timeline(),
|
||||||
initialChildSize: 0.25,
|
),
|
||||||
shouldCloseOnMinExtent: false,
|
|
||||||
actions: [],
|
|
||||||
slivers: [
|
|
||||||
SliverFillRemaining(
|
|
||||||
child: Timeline(),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user