如何在不使用Scaffold和AppBar的情况下在栏内添加标签栏?

时间:2019-10-26 05:26:46

标签: flutter dart

我想在Column内添加标签栏。目前,我是这样添加的。 一切正常。这样是添加TabBar的唯一方法吗? (我在此页面上添加了两个脚手架):在Column内使用制表键的最佳方法是什么?

    child: Scaffold(
        body: Container(
      color: Palette.backgroundGrey,
      child: Column(
        children: <Widget>[
          Stack(
            ...
          ),
          Padding(
            ...
          ),
          Flexible(
            flex: 9,
            child: DefaultTabController(
              length: 3,
              child: Scaffold(
                appBar: AppBar(
                  leading: Container(), //remove back button
                  backgroundColor:Palette.backgroundGrey, //added same color on main scaffold
                  elevation: 0, // remove shadow
                  flexibleSpace: TabBar(tabs: [ //tab bar added to flexibleSpace instead of title
                    Tab(text: 'Rating & Reviews'),
                    Tab(text: 'Business Details'),
                    Tab(text: 'Offers')
                  ]),
                ),
                body: TabBarView(children: [
                  Text('rating'),
                  Text('business'),
                  Text('offers')
                ])
              )
            ),
          )
        ],
      ),
    )),

0 个答案:

没有答案