flutter - 为什么 Tapbar 空间不够?

标签 flutter dart flutter-layout tabbar

你能告诉我为什么底部空间不够吗?我给了容器足够的高度,但即使增加到 500,错误也不会消失。我的错误是什么?

我的代码-

DefaultTabController(
               length: 5,
               child: SingleChildScrollView(
                 child: Container(
               height: 150,
               child:  TabBar(
                 isScrollable: true,
                 tabs: [
                   Tab(child: Column(
                     children: [
                       InkWell(
                         onTap: () async {
                           print('asdasda');
                         },
                         child:  Container(
                           width: 71,
                           height: 71,
                           decoration: BoxDecoration(
                               color: Colors.white,
                               shape: BoxShape.circle
                           ),
                           child: IconButton(onPressed: () {}, icon: Icon(Icons.phone_iphone, size: 30, color: configColors.homeIcon,)),
                         ),
                       ),
                       Text('Phonesss')
                     ],
                   ),),

result

最佳答案

为您的选项卡提供高度

DefaultTabController(
               length: 5,
               child: SingleChildScrollView(
                 child: Container(
               height: 150,  // may remove
               child:  TabBar(
                 height: 150, // give height
                 isScrollable: true,
                 tabs: [
                   Tab(child: Column(
                     children: [
                       InkWell(
                         onTap: () async {
                           print('asdasda');
                         },
                         child:  Container(
                           width: 71,
                           height: 71,
                           decoration: BoxDecoration(
                               color: Colors.white,
                               shape: BoxShape.circle
                           ),
                           child: IconButton(onPressed: () {}, icon: Icon(Icons.phone_iphone, size: 30, color: configColors.homeIcon,)),
                         ),
                       ),
                       Text('Phonesss')
                     ],
                   ),),

关于flutter - 为什么 Tapbar 空间不够?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73443172/

相关文章:

flutter - 在一行 3 个文本小部件中用省略号(溢出时)剪辑第一个小部件

firebase - 如何在firebase中自动按时间戳排序文档?

flutter - 错误:在此AdminDashboardPage窗口小部件上方找不到正确的Provider <UsersProvider>

dart - 如何使用 PaginatedDataTable 正确实现列、字段和行上的单击事件

dart - Dart 中的 python 字典相当于什么?

flutter - 为什么在StreamBuilder的connectionState.done之后得到另一个connectionState类型?

flutter - 在这种情况下,有什么方法可以在initState中使用FutureBuilder(future)?

flutter - 在 Flutter Canvas 中使用 Gradient 和 Paint 对象

flutter - map <对象? Object> 不是类型 'Map<String,dynamic> 的子类型

android - 从Flutter开始:如何使4个按钮填充SafeArea