Flutter:分隔符与 TabBar 中的指示线相交
Flutter: Divider intersecting the indicator line in TabBar
我已经使用
实现了这个
return Stack(
children: <Widget>[
new TabBar(
controller: _controller,
labelColor: Colors.black,
unselectedLabelColor: Colors.grey,
indicatorColor: Colors.black,
tabs: [
new Tab(text: 'Info'),
new Tab(text: 'Transpo'),
new Tab(text: 'Shelter'),
new Tab(text: 'Tips'),
new Tab(text: 'Routes'),
],
),
new Padding(
padding: const EdgeInsets.only(top: 39.0),
child: new Divider(
color: Colors.grey,
height: 16.0,
),
),
],
);
}
但我很担心,因为分隔符的填充中的常数值。如果 tabbar 的高度发生变化怎么办?或者有没有办法获取标签栏的高度然后将其用于填充?还是有另一种优雅的方式来实现这个?谢谢
没关系,因为Appbar
的高度是恒定的。无法改变。
我已经使用
实现了这个return Stack(
children: <Widget>[
new TabBar(
controller: _controller,
labelColor: Colors.black,
unselectedLabelColor: Colors.grey,
indicatorColor: Colors.black,
tabs: [
new Tab(text: 'Info'),
new Tab(text: 'Transpo'),
new Tab(text: 'Shelter'),
new Tab(text: 'Tips'),
new Tab(text: 'Routes'),
],
),
new Padding(
padding: const EdgeInsets.only(top: 39.0),
child: new Divider(
color: Colors.grey,
height: 16.0,
),
),
],
);
}
但我很担心,因为分隔符的填充中的常数值。如果 tabbar 的高度发生变化怎么办?或者有没有办法获取标签栏的高度然后将其用于填充?还是有另一种优雅的方式来实现这个?谢谢
没关系,因为Appbar
的高度是恒定的。无法改变。