mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-02 06:46:22 +01:00
Fix accessing context during initState
This commit is contained in:
parent
296aa9a99f
commit
7030376137
4 changed files with 20 additions and 4 deletions
|
@ -66,7 +66,11 @@ class _AlbumPickerDialogState extends State<AlbumPickerDialog> {
|
|||
_reqQuery();
|
||||
} else {
|
||||
// process the current state
|
||||
_onStateChange(context, _bloc.state);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
setState(() {
|
||||
_onStateChange(context, _bloc.state);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,11 @@ class _ArchiveViewerState extends State<ArchiveViewer>
|
|||
_reqQuery();
|
||||
} else {
|
||||
// process the current state
|
||||
_onStateChange(context, _bloc.state);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
setState(() {
|
||||
_onStateChange(context, _bloc.state);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,11 @@ class _HomeAlbumsState extends State<HomeAlbums> {
|
|||
_reqQuery();
|
||||
} else {
|
||||
// process the current state
|
||||
_onStateChange(context, _bloc.state);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
setState(() {
|
||||
_onStateChange(context, _bloc.state);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,11 @@ class _HomePhotosState extends State<HomePhotos>
|
|||
_reqQuery();
|
||||
} else {
|
||||
// process the current state
|
||||
_onStateChange(context, _bloc.state);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
setState(() {
|
||||
_onStateChange(context, _bloc.state);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue