如何摆脱 appbar 和 tabbar 之间的 space?
how to get rid of space between appbar & tabbar in flutter?
我正在尝试做,但我不知道怎么做
我想去掉绿框 space。
我正在尝试使用 PreferedSize 小部件,但它不起作用我的代码是 ...
@override
Widget build(BuildContext context) {
return SafeArea(
child: PreferredSize(
preferredSize: Size.fromHeight(SizeConfig.heightMultiplier * 6.2),
// it's pretty narrow size but doesn't work in this screen but others
child: Scaffold(
appBar: AppBar(
centerTitle: true,
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'hello',
style: TextStyle(fontWeight: FontWeight.bold),
),
Text(
'world',
),
Text(
'!',
style: TextStyle(fontWeight: FontWeight.bold),
),
],
),
actions: <Widget>[
Icon(
Icons.add,
color: Colors.transparent,
),
],
backgroundColor: Theme.of(context).primaryColor,
bottom: TabBar(
controller: tabController,
indicatorColor: Colors.white,
tabs: myTabs,
),
),
...
我需要你的帮助 ☑
用高度为 0(或较小高度)的 PreferredSize
小部件包裹 TabBar
:
bottom: PreferredSize(
preferredSize: Size.fromHeight(0),
child: TabBar(
controller: tabController,
indicatorColor: Colors.white,
tabs: myTabs,
),
),
我正在尝试做,但我不知道怎么做
我想去掉绿框 space。 我正在尝试使用 PreferedSize 小部件,但它不起作用我的代码是 ...
@override
Widget build(BuildContext context) {
return SafeArea(
child: PreferredSize(
preferredSize: Size.fromHeight(SizeConfig.heightMultiplier * 6.2),
// it's pretty narrow size but doesn't work in this screen but others
child: Scaffold(
appBar: AppBar(
centerTitle: true,
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'hello',
style: TextStyle(fontWeight: FontWeight.bold),
),
Text(
'world',
),
Text(
'!',
style: TextStyle(fontWeight: FontWeight.bold),
),
],
),
actions: <Widget>[
Icon(
Icons.add,
color: Colors.transparent,
),
],
backgroundColor: Theme.of(context).primaryColor,
bottom: TabBar(
controller: tabController,
indicatorColor: Colors.white,
tabs: myTabs,
),
),
...
我需要你的帮助 ☑
用高度为 0(或较小高度)的 PreferredSize
小部件包裹 TabBar
:
bottom: PreferredSize(
preferredSize: Size.fromHeight(0),
child: TabBar(
controller: tabController,
indicatorColor: Colors.white,
tabs: myTabs,
),
),