From 7f6284653996e2ab0d257cb10a4b107b3f5003b9 Mon Sep 17 00:00:00 2001 From: Thibault Deckers Date: Sun, 5 Jul 2020 10:11:41 +0900 Subject: [PATCH] fullscreen: always locate entry --- lib/widgets/fullscreen/fullscreen_body.dart | 4 +++ lib/widgets/fullscreen/info/info_page.dart | 31 --------------------- 2 files changed, 4 insertions(+), 31 deletions(-) diff --git a/lib/widgets/fullscreen/fullscreen_body.dart b/lib/widgets/fullscreen/fullscreen_body.dart index 74ce87dd3..8f8dfc7e4 100644 --- a/lib/widgets/fullscreen/fullscreen_body.dart +++ b/lib/widgets/fullscreen/fullscreen_body.dart @@ -514,6 +514,10 @@ class _FullscreenVerticalPageViewState extends State _oldEntry?.imageChangeNotifier?.removeListener(_onImageChanged); entry?.imageChangeNotifier?.addListener(_onImageChanged); _oldEntry = entry; + // make sure to locate the entry, + // so that we can display the address instead of coordinates + // even when background locating has not reached this entry yet + entry?.locate(); } // when the entry image itself changed (e.g. after rotation) diff --git a/lib/widgets/fullscreen/info/info_page.dart b/lib/widgets/fullscreen/info/info_page.dart index 1b10df6bd..478c0703f 100644 --- a/lib/widgets/fullscreen/info/info_page.dart +++ b/lib/widgets/fullscreen/info/info_page.dart @@ -34,33 +34,6 @@ class InfoPageState extends State { CollectionLens get collection => widget.collection; - @override - void initState() { - super.initState(); - _registerWidget(widget); - } - - @override - void didUpdateWidget(InfoPage oldWidget) { - super.didUpdateWidget(oldWidget); - _unregisterWidget(oldWidget); - _registerWidget(widget); - } - - @override - void dispose() { - _unregisterWidget(widget); - super.dispose(); - } - - void _registerWidget(InfoPage widget) { - widget.entryNotifier.addListener(_onEntryChanged); - } - - void _unregisterWidget(InfoPage widget) { - widget.entryNotifier.removeListener(_onEntryChanged); - } - @override Widget build(BuildContext context) { const horizontalPadding = EdgeInsets.symmetric(horizontal: 8); @@ -147,10 +120,6 @@ class InfoPageState extends State { ); } - void _onEntryChanged() { - widget.entryNotifier.value?.locate(); - } - bool _handleTopScroll(Notification notification) { if (notification is ScrollNotification) { if (notification is ScrollStartNotification) {