mirror of
https://github.com/Iconica-Development/flutter_timeline.git
synced 2025-05-18 18:13:46 +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
3615342c64
commit
65d27ce4a0
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (isLoading && widget.posts == null) {
|
if (isLoading && widget.posts == null) {
|
||||||
|
|
Loading…
Reference in a new issue