Repository navigation
Add loading indicator web template - #85464
YazeedAlKhalaf wants to merge 5 commits into
Conversation
|
The way you did it, wouldn't the loader be alive after Flutter app has loaded? Is there any benchmark to see if it doesn't affect anything? |
…rker loaded the app
|
Note: that this PR (#83530) created a merge conflict with this PR. |
…loading_indicator_web_template
|
@bernaferrari Yup you're right, it would stay spinning all the time even after the app loads. So now the loader is there with its styling. We need to make it appear only when the flutter app is loading and remove it once the app paints the first frame. I am not sure how, to be honest, but will try to dig in to find a way. Is there any way to know if the app has loaded? in web of course. |
|
I'm not sure whether this makes sense from a product perspective, adding @yjbanov for thoughts |
|
I suggest using the loading indicator that flutter photobooth used. Or do you think keeping it simple is better? https://github.com/flutter/photobooth/blob/main/web/index.html#L56 |
|
@yjbanov any thoughts? |
|
I think we should provide API for implementing custom loading indicators and/or splash screens, and provide an example that developers could learn from. The gallery should probably use one too. It would also be great if one of the Aside from that, I think we lack API for implementing a proper loading indicator. For example, this implementation, as pointed out by @bernaferrari, will stay in the DOM tree forever. We could have the engine emit a "first frame rendered event" JavaScript event that the app could listen to and implement a transition from the loading screen to the app screen. We should also provide a JS API for controlling the visibility of the Flutter app, so one could implement different transitions, such as cross-fade. This probably has enough devils in the detail to warrant a design doc before we jump into coding. |
|
I think we should not do this before we add JS API and before we make decision on styling, defaults, etc. So I'm closing this PR. However, this is a good example, and could be a useful blog post. I would add loading indicator removal after the app renders its first frame (which can be done by using addPostFrameCallback). |
Oh thanks for the suggestion @yjbanov. It makes so much sense. Will make a blog post. 🚀 |
This adds a loading indicator to the web template. It showed when there is no flutter app loaded. Once the Flutter app is loaded, the loading indicator is not visible to the user.
GIF showing the design of the loading indicator:

closes #85405
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.