mirror of
https://github.com/Myzel394/quid_faciam_hodie.git
synced 2025-06-19 15:45:26 +02:00
bugfixes
This commit is contained in:
parent
6492a75185
commit
bb1d65addb
@ -18,7 +18,7 @@ class TimelineModel extends PropertyChangeNotifier<String> {
|
|||||||
int _currentIndex = 0;
|
int _currentIndex = 0;
|
||||||
int _memoryIndex = 0;
|
int _memoryIndex = 0;
|
||||||
bool _paused = false;
|
bool _paused = false;
|
||||||
bool _isInitializing = true;
|
bool _isInitializing = false;
|
||||||
|
|
||||||
Map<DateTime, List<Memory>> get values => _timeline;
|
Map<DateTime, List<Memory>> get values => _timeline;
|
||||||
int get length => _timeline.length;
|
int get length => _timeline.length;
|
||||||
|
@ -21,6 +21,8 @@ class TimelineScreen extends StatefulWidget {
|
|||||||
this.date,
|
this.date,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
|
bool get popToCalendarScreen => date == null;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<TimelineScreen> createState() => _TimelineScreenState();
|
State<TimelineScreen> createState() => _TimelineScreenState();
|
||||||
}
|
}
|
||||||
@ -61,22 +63,17 @@ class _TimelineScreenState extends State<TimelineScreen> with Loadable {
|
|||||||
}
|
}
|
||||||
}, ['currentIndex']);
|
}, ['currentIndex']);
|
||||||
|
|
||||||
// Update page when initializing is done
|
print("blaaa");
|
||||||
timeline.addListener(() {
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
if (!mounted) {
|
final initialIndex = getIndexFromDate();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setState(() {});
|
print("#" * 50);
|
||||||
|
print(initialIndex);
|
||||||
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
await _goToPage(initialIndex);
|
||||||
final initialIndex = getIndexFromDate();
|
|
||||||
|
|
||||||
await _goToPage(initialIndex);
|
timeline.setCurrentIndex(initialIndex);
|
||||||
|
});
|
||||||
timeline.setCurrentIndex(initialIndex);
|
|
||||||
});
|
|
||||||
}, ['isInitializing']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -100,9 +97,13 @@ class _TimelineScreenState extends State<TimelineScreen> with Loadable {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () async {
|
onWillPop: () async {
|
||||||
await Navigator.pushReplacementNamed(context, CalendarScreen.ID);
|
if (widget.popToCalendarScreen) {
|
||||||
|
await Navigator.pushReplacementNamed(context, CalendarScreen.ID);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
body: ChangeNotifierProvider.value(
|
body: ChangeNotifierProvider.value(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user