mirror of
https://github.com/Iconica-Development/flutter_timeline.git
synced 2025-05-19 10:33:44 +02:00
fix: reload posts when the parent widget has rebuilt on the timeline screen
This way if the service passed to us is changed we'll update our posts from it instead of keeping the ones from the previous service.
This commit is contained in:
parent
03d6d6f676
commit
163e52319a
1 changed files with 9 additions and 0 deletions
|
@ -109,6 +109,15 @@ class _TimelineScreenState extends State<TimelineScreen> {
|
|||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant TimelineScreen oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
unawaited(loadPosts());
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (isLoading && widget.posts == null) {
|
||||
|
|
Loading…
Reference in a new issue