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,37 +6,45 @@ 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 {
|
||||
class MapBottomSheet extends ConsumerStatefulWidget {
|
||||
const MapBottomSheet({super.key});
|
||||
|
||||
@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));
|
||||
|
||||
ref.listen(mapStateProvider, (previous, next) async {
|
||||
bounds = next.bounds;
|
||||
key = GlobalKey();
|
||||
});
|
||||
|
||||
return ProviderScope(
|
||||
overrides: [
|
||||
// TODO: 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(),
|
||||
return BaseBottomSheet(
|
||||
initialChildSize: 0.25,
|
||||
shouldCloseOnMinExtent: false,
|
||||
actions: [],
|
||||
slivers: [
|
||||
SliverFillRemaining(
|
||||
child: ProviderScope(
|
||||
key: key,
|
||||
overrides: [
|
||||
timelineServiceProvider.overrideWith((ref) {
|
||||
final timelineService =
|
||||
ref.watch(timelineFactoryProvider).map(bounds);
|
||||
ref.onDispose(timelineService.dispose);
|
||||
return timelineService;
|
||||
}),
|
||||
],
|
||||
child: const Timeline(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user