【问题标题】:Prevent google maps flutter from rebuilding when switching the pages切换页面时防止谷歌地图颤动重建
【发布时间】:2019-11-10 12:20:57
【问题描述】:

在切换底部导航页面后,我遇到了一个非常烦人的谷歌地图颤振问题。我已经坚持了最后一次缩放和相机位置,但是每次我进入地图页面时,小部件都会自行重建。如何预防?

【问题讨论】:

    标签: flutter flutter-plugin


    【解决方案1】:

    使用

    AutomaticKeepAliveClientMixin

    例如,

    class _ExampleClass extends State<ExampleState> with 
    AutomaticKeepAliveClientMixin<ExampleState> {
    @override
    bool get wantKeepAlive => true;
    

    【讨论】:

    • 非常感谢,效果很好,谷歌搜索 6 小时后得到了答案。
    猜你喜欢
    • 2021-01-03
    • 2023-03-10
    • 1970-01-01
    • 2014-08-13
    • 2015-06-09
    • 2011-01-30
    • 1970-01-01
    • 1970-01-01
    • 2023-03-22
    相关资源
    最近更新 更多