I've got a screen that has a CupertinoSliverRefreshControl
controlling the pull-to-refresh capability that looks something like this:
CupertinoSliverRefreshControl(
onRefresh: () async {
_bloc.add(MyBlocEvent.reload());
},
);
Because CupertinoSliverRefreshControl
only shows the spinner for as long as the onRefresh
block takes to run (which is basically instantaneous in this case), the spinner disappears immediately... whereas the natural iOS UX is that it stays visible until the reload has completed.
I've tried adding an await Future.delayed()
after I add the event to the bloc - which sort of works in that it will show the spinner for that duration... however, that duration is not actually related to how long the bloc takes to reload the content.
I've even tried waiting for, say, 20 seconds and hoping that the bloc reload would blow away the spinner - which didn't work initially (presumably because CupertinoSliverRefreshControl
is stateful)... if I add a UniqueKey
to the refresh control then when the bloc finishes the spinner does disappear, but it is a jarring transition because a whole new refresh control is getting built (instead of nicely easing back into place)
I'm curious how folk uses this control in the context of a bloc. Thanks a lot.