美文网首页
解决flutter Tab/TabBar切换, TabView

解决flutter Tab/TabBar切换, TabView

作者: neobuger | 来源:发表于2023-03-30 10:06 被阅读0次
    import 'package:flutter/material.dart';
    
    class ChinesePage extends StatefulWidget {
      List list;
      ChinesePage(this.list);
      @override
      _ChinesePageState createState() => _ChinesePageState();
    }
    
    class _ChinesePageState extends State<ChinesePage>
        with AutomaticKeepAliveClientMixin {
      @override
      Widget build(BuildContext context) {
        return Scaffold(
            body: ListView.builder(
                itemCount: widget.list.length,
                itemBuilder: (build, index) {
                  return Container(
                      padding: EdgeInsets.only(top: 150),
                      child: Text("${widget.list[index]} ----- $index"));
                }));
      }
    
      @override
      // TODO: implement wantKeepAlive
      bool get wantKeepAlive => true;
    }
    
    
    

    相关文章

      网友评论

          本文标题:解决flutter Tab/TabBar切换, TabView

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