我遇到一种情况,我只想在底部工作表中显示选项卡,例如whatsapp如何显示以共享实时位置,所以我为此使用了默认选项卡栏,但我想读取用户在没有任何tabBar视图主体的情况下选择的索引。请帮助我。
new DefaultTabController(
length: 3,
child: new Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
new Container(
padding: EdgeInsets.only(top: 13.0,bottom: 25.0),
alignment: Alignment.topCenter,
child: new Material(
color: Colors.white,
child: new TabBar(
labelColor: Color(0xFF454f63),
unselectedLabelColor: Color(0XFF959dad),
indicator: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment(0.3, 0.0), // 10% of the width, so there are ten blinds.
colors: [const Color(0xFF0080ff),const Color(0XFF00ff80)], // whitish to gray
tileMode: TileMode.clamp, // repeats the gradient over the canvas
),
),
tabs: [
GestureDetector(
onTap: check1(),
child: Tab(
child : new Text("1 Hour",
style: new TextStyle(
fontSize: 13.0,
)
),
),
),
GestureDetector(
onTap: check2(),
child: Tab(
child : new Text("8 Hours",
style: new TextStyle(
fontSize: 13.0,
)
),
),
),
GestureDetector(
onTap: check3(),
child: Tab(
child : new Text("1 Day",
style: new TextStyle(
fontSize: 13.0,
)
),
),
),
],
),
),
),
],
),
),