美文网首页
flutter通用Widget混入AutomaticKeepAl

flutter通用Widget混入AutomaticKeepAl

作者: Janise001 | 来源:发表于2021-04-15 15:26 被阅读0次

当通用场景在不同地方调用要求其切换时不得重建,即要求该通用场景不得调用initState方法,这个时候需要对class混入AutomaticKeepAliveClientMixin,并设置wantKeepAlive为true,这样在不同场景中调用切换时都不会相互影响且不会调用initState方法

相关文章

网友评论

      本文标题:flutter通用Widget混入AutomaticKeepAl

      本文链接:https://www.haomeiwen.com/subject/lbgdlltx.html