I\xe2\x80\x99m 使用 DefaultTabController 和 Scaffold 作为子部件。对于appBar,I\xe2\x80\x99m 使用TabBar。I\xe2\x80\x99d 喜欢在 TabBar 周围添加一些填充,但 appBar 属性需要一个扩展 PreferredSizeWidget 的类。
\n\n我正在构建的选项卡控制器的示例片段:
\n\n new DefaultTabController(\n length: tabs.length,\n child: new Scaffold(\n backgroundColor: const Color(0xFFF3EEE1),\n appBar: new TabBar(\n tabs: tabs,\n ),\n body: new TabBarView(\n children: _testPacks.map((TestPack testPack) {\n return _contentWidget(context: context, testPack: testPack);\n }).toList(),\n ),\n ),\n );\nRun Code Online (Sandbox Code Playgroud)\n\n来自脚手架类
\n\n/// An app bar to display at the top of the scaffold.\nfinal PreferredSizeWidget appBar;\nRun Code Online (Sandbox Code Playgroud)\n
Blo*_*oss 11
现在您可以传递自定义填充
TabBar(
labelPadding: EdgeInsets.all(0),
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8905 次 |
| 最近记录: |