flutter - tab bar flutter tabbar 右侧溢出 88 像素

标签 flutter flutter-layout

我正在使用 flutter 开发移动应用程序,我制作了一个图标和文本的标签栏,但结果右溢出了 88 像素 这是结果的屏幕截图

enter image description here

这是代码

        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
                    )),
                  ]),
            ),
          ],),
      ),

我该如何处理??我试图做一个水平滚动,但我失败了! 谁能帮我 ?

最佳答案

您可以在 TabBar 小部件上尝试使用 isScrollable: true 吗?如下

            TabBar(
              indicatorSize: TabBarIndicatorSize.tab,
              isScrollable: true,
              tabs: [
                Tab(
                  child: Row(children: <Widget>[
                    Icon(Icons.local_hospital, color: Colors.white),
                    Text("كلام",
                        style: TextStyle(
                          color: Colors.white,
                        )),
                  ]),
                ),
                Tab(
                    child: Row(children: <Widget>[
                  Icon(Icons.account_balance, color: Colors.white),
                  Text("كلام", style: TextStyle(color: Colors.white)),
                ])),
                Tab(
                  child: Row(children: <Widget>[
                    Icon(Icons.account_balance, color: Colors.white),
                    Text("كلام", style: TextStyle(color: Colors.white)),
                  ]),
                ),
                Tab(
                  child: Row(children: <Widget>[
                    Icon(Icons.mail, color: Colors.white),
                    Text("كلام", style: TextStyle(color: Colors.white)),
                  ]),
                ),
                Tab(
                  child: Row(children: <Widget>[
                    Icon(Icons.access_alarm, color: Colors.white),
                    Text("كلام", style: TextStyle(color: Colors.white)),
                  ]),
                ),
                Tab(
                  child: Row(children: <Widget>[
                    Icon(Icons.add_to_photos, color: Colors.white),
                    Text("كلام", style: TextStyle(color: Colors.white)),
                  ]),
                ),
              ],
            )

希望这对您有所帮助。

关于flutter - tab bar flutter tabbar 右侧溢出 88 像素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55986306/

相关文章:

flutter - 导航到新屏幕时保持 AppBar 静态

flutter - Tabbar抖动中的向后处理按钮

flutter - 在 flutter 中使图像的边缘变暗?

android - Flutter:http get 请求在 apk 版本上不起作用

android - Flutter,如何将 SliverAppbar 上的前导和 Action 移至底部

image - Flutter:将圆形图像放在角落

android - 需要从其他有状态小部件更新 bool 标志

ios - 复制到剪贴板 - Clipboard.setData() - 在适用于 iOS 浏览器(Safari 和 Chrome)的 Flutter Web 上损坏

flutter - 如何在 Flutter 后台使用 Android 摄像头?

firebase - flutter : Adding stream of comments 的 QnA 应用程序