【发布时间】:2019-09-22 23:22:48
【问题描述】:
我正在使用 Flutter 开发移动应用程序,我制作了一个包含图标和文本的标签栏,但结果正好溢出了 88 像素 这是结果的屏幕截图
这是代码
bottom: new TabBar(controller: controller,
tabs: <Widget>[
new Tab(
child: new Row(
children: <Widget>[
new Icon(Icons.local_hospital,color: Colors.white),
new Text ( "كلام",
style:TextStyle(color: Colors.white,
)),
]),
),
new Tab(
child: new Row(
children: <Widget>[
new Icon(Icons.school,color: Colors.white),
new Text ( "كلام",style:TextStyle(
color: Colors.white
)),
]),
),
new Tab(
child: new Row(
children: <Widget>[
new Icon(Icons.account_balance,color: Colors.white),
new Text ( "كلام" ,style:TextStyle(
color: Colors.white
)),
]),
),
new Tab(
child: new Row(
children: <Widget>[
new Icon(Icons.account_balance,color: Colors.white),
new Text ( "كلام" ,style:TextStyle(
color: Colors.white
)),
]),
),
new Tab(
child: new Row(
children: <Widget>[
new Icon(Icons.account_balance,color: Colors.white),
new Text ( "كلام" ,style:TextStyle(
color: Colors.white
)),
]),
),
new Tab(
child: new Row(
children: <Widget>[
new Icon(Icons.account_balance,color: Colors.white),
new Text ( "كلام" ,style:TextStyle(
color: Colors.white
)),
]),
),
],),
),
我该如何处理?我试图做一个水平滚动,但我失败了! 谁能帮我 ?
【问题讨论】:
-
但是为什么不使用图标和文本,所以文本会显示在下面呢?你不会有那个错误
-
您可以使用 MediaQuery.of(givenContext).size.width 获取设备的整个宽度,然后将 MediaQuery.of(givenContext).size.width/numberOfWidgets 作为宽度添加到您的小部件。但是,如果它溢出,您的文本将不再可读......
-
@Hosar 但我正在使用它们 new Icon(Icons.local_hospital,color: Colors.white), new Text ( "كلام", style:TextStyle(color: Colors.white, )),还是你的意思不同?