Flutter: best practices for persisting same widget while navigating to different screens/routes

核能气质少年 提交于 2020-02-23 07:37:00

问题


For the app we are making, it is required that a widget should remain active and visible while the user navigates to different screens; specifically, we need a music player widget that keeps playing music (while showing its live controls) while the user navigates to different routes, as shown in the diagram below (in the link).

Flutter widget persisting during navigation

Searching around, we found some hints on how to tackle this very basic use case (some suggest using the Material App's overlay, others the bottom sheet), but it looks like there is no "official" best practice in flutter docs [or Medium linked articles] showing how to address this very general requirement.

Are we missing something? Help, suggestions and references would be really appreciated.

EDIT --- NOTE FOR GOODWILL READERS AND HELPERS: we are quite into Flutter developments; in facts, we just deployed a full-fledged (and complex app) in the Google and Apple Stores (the "Vox Imago" app).

Nevertheless, the use case and requirement described above is not addressed in Flutter official documentation, nor in the cookbook; and a simple demo on how to achieve the desired result seems missing (?) in the extensive list of examples available on Flutter's sites.

Any suggestion for a sound approach would definitely be valuable :)

来源:https://stackoverflow.com/questions/60132896/flutter-best-practices-for-persisting-same-widget-while-navigating-to-different

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!