diff --git a/lib/screens/flight_log/flight_log_screen.dart b/lib/screens/flight_log/flight_log_screen.dart index a3042ff..eaea9e6 100644 --- a/lib/screens/flight_log/flight_log_screen.dart +++ b/lib/screens/flight_log/flight_log_screen.dart @@ -19,7 +19,7 @@ class FlightLogScreen extends StatefulWidget { State createState() => _FlightLogScreenState(); } -class _FlightLogScreenState extends State { +class _FlightLogScreenState extends State with WidgetsBindingObserver { late FToast _fToast; late FlightLogListController _logBookController; late AppConfig _appConfig; @@ -28,6 +28,7 @@ class _FlightLogScreenState extends State { @override void initState() { super.initState(); + WidgetsBinding.instance.addObserver(this); _fToast = FToast(); _fToast.init(context); _logBookController = FlightLogListController(); @@ -46,10 +47,18 @@ class _FlightLogScreenState extends State { super.didUpdateWidget(oldWidget); } + @override + void didChangeAppLifecycleState(AppLifecycleState state) { + if (state == AppLifecycleState.resumed) { + _logBookController.reset(); + } + } + @override void dispose() { - super.dispose(); + WidgetsBinding.instance.removeObserver(this); _logBookController.removeListener(_logBookListChanged); + super.dispose(); } void _logBookListChanged() {