美文网首页
Flutter iOS UITabBarController

Flutter iOS UITabBarController

作者: lionnner | 来源:发表于2019-04-30 10:45 被阅读0次
    • children的State 重写 wantKeepAlive 为true

    • children的State build 方法必须调用super.build

     class _MyPageState extends State<MyPage> with AutomaticKeepAliveClientMixin{
      @override
      bool get wantKeepAlive => true;  //重点1
    
      @override
      Widget build(BuildContext context) {
        super.build(context); //重点2
        return Scaffold(
          appBar: AppBar(
            title: Text(
              '我的',
              style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
            ),
            centerTitle: true,
            backgroundColor: Color.fromRGBO(32, 32, 32, 1),
          ),
        );
      }
    }
    

    相关文章

      网友评论

          本文标题:Flutter iOS UITabBarController

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