当前位置:网站首页>The shutter tabbar listener is called twice

The shutter tabbar listener is called twice

2022-06-26 09:25:00 Eternity LAN

Hard coding ! Reprint please indicate the source !

0. Preface

Flutter Of TabViewController, Does not lazy load views , After you create TabBarView From that moment on , All the interfaces are loaded all at once

So as an elegant programmer , How can this waste of performance be allowed !

Click and click TabController,Run The back is cool , Find out that things are not so simple

TabController Of Listener It was called twice !!!

1. resolvent

There are not many small problems , Add a judgment , Problem solving :

tabController.addListener(() {

        // Key code 
      if (!tabController.indexIsChanging) {

        print(tabController.index);
      }
    });

Flutter After all, it's still that Issue Four digit Flutter

The person who rewards is still the most beautiful one

原网站

版权声明
本文为[Eternity LAN]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202170551084108.html