Keep the refresh indicator until done

This commit is contained in:
Ming Ming 2021-11-18 21:04:42 +08:00
parent 50599f2ba5
commit cc5046ee8e

View file

@ -130,6 +130,7 @@ class _HomePhotosState extends State<HomePhotos>
backgroundColor: Colors.grey[100],
onRefresh: () async {
_onRefreshSelected();
await _waitRefresh();
},
child: CustomScrollView(
controller: _scrollController,
@ -579,6 +580,15 @@ class _HomePhotosState extends State<HomePhotos>
_bloc.add(const ScanAccountDirBlocRefresh());
}
Future<void> _waitRefresh() async {
while (true) {
await Future.delayed(const Duration(seconds: 1));
if (_bloc.state is! ScanAccountDirBlocLoading) {
return;
}
}
}
void _setThumbZoomLevel(int level) {
final prevLevel = _thumbZoomLevel;
_thumbZoomLevel = level;