如何在我的Flutter main.dart代码中添加pageView?

时间:2019-01-08 10:02:38

标签: layout dart flutter

我的应用程序可以在我的设备上完美运行,但是在日志消息中,我收到一条错误消息,提示需要使用pageView。 This is the error I get when I swipe。 所以我希望有人能帮我解决每次我在设备上滑动时不断出现的错误

   void main()
   {
      SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]) 
       .then((_) {
            runApp(new MyApp());
      });
    }

    class MyApp extends StatelessWidget 
    {
              @override
              Widget build(BuildContext context)
              {

                final tabController = new DefaultTabController(
                    length: 4 ,
                    child: new Scaffold(
                      appBar: new AppBar(
                        backgroundColor: Colors.lightGreen,
                        title: new Text("Discover Zambia"),
                        bottom: new TabBar(
                            indicatorColor: Colors.red,
                            indicatorWeight: 4.0,
                            tabs: [
                            new Tab(icon: new Icon(Icons.home),text: "Home"),
                            new Tab(icon: new Icon(Icons.landscape),text: "Sights"),
                            new Tab(icon: new Icon(Icons.local_drink),text: "Nightlife"),
                            new Tab(icon: new Icon(Icons.restaurant),text: "Foods")

                        ]),
                      ),
                      body: new TabBarView(
                          children: [
                            new Home(),
                            new Sights(),
                            new Nightlife(),
                            new Foods()
                          ]
                      ),
                    ));
                return new MaterialApp(
                  debugShowCheckedModeBanner: false,
                  title: "",
                  home: tabController,

                );
              }

      }

0 个答案:

没有答案