Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 没有脚手架的管制员?_Flutter_Dart_Flutter Layout - Fatal编程技术网

Flutter 没有脚手架的管制员?

Flutter 没有脚手架的管制员?,flutter,dart,flutter-layout,Flutter,Dart,Flutter Layout,我试图在一些小部件中间使用 Debug Tabror控制器>代码>。因此,我的TabBar不能在AppBar中,必须关闭一些小部件。 所以我的问题是,当我使用TabBarView时,它崩溃了 这里有一个颤振示例,但没有找到在没有脚手架的情况下如何进行颤振 final List<Tab> myTabs = <Tab>[ Tab(text: 'LEFT'), Tab(text: 'RIGHT')]; 这里是我应该做的另一个TabBar示例 实码 class Prof

我试图在一些小部件中间使用<代码> Debug Tabror控制器>代码>。因此,我的
TabBar
不能在
AppBar
中,必须关闭一些小部件。 所以我的问题是,当我使用
TabBarView
时,它崩溃了

这里有一个颤振示例,但没有找到在没有
脚手架的情况下如何进行颤振

final List<Tab> myTabs = <Tab>[
  Tab(text: 'LEFT'),
  Tab(text: 'RIGHT')];
这里是我应该做的另一个TabBar示例

实码

class ProfileTabBarNavigation extends StatelessWidget {
 final List<Tab> myTabs = <Tab>[
   const Tab(text: kArtwork),
   const Tab(text: kPastJobs)];
@override
Widget build(BuildContext context) {
return DefaultTabController(
  length: 2,
  initialIndex: 0,
  child: Padding(
    padding: kPaddingTabBar,
    child: Container(
      padding: EdgeInsets.all(5.0),
      decoration: BoxDecoration(
        color: kLightGrey,
        borderRadius: BorderRadius.all(
          Radius.circular(50),
        ),
      ),
      child: Column(children: <Widget>[
        TabBar(
          tabs: myTabs,
          unselectedLabelColor: Colors.black54,
          labelColor: Colors.black,
          unselectedLabelStyle: kBoldText,
          labelStyle: kBoldText,
          indicatorSize: TabBarIndicatorSize.tab,
          indicator: BoxDecoration(
            shape: BoxShape.rectangle,
            borderRadius: BorderRadius.circular(50),
            color: Colors.white,
          ),
        ),
        TabBarView(
          children: myTabs.map((Tab tab) {
            final String label = tab.text.toLowerCase();
            return Center(
              child: Text(
                'This is the $label tab',
                style: const TextStyle(fontSize: 36),
              ),
            );
          }).toList(),
        ),
      ]),
    ),
  ),
);
}
}
class ProfileTabBarNavigation扩展了无状态小部件{
最终列表myTabs=[
常量选项卡(文本:kArtwork),
const选项卡(文本:kPastJobs)];
@凌驾
小部件构建(构建上下文){
返回DefaultTabController(
长度:2,
初始索引:0,
孩子:填充(
填充:kPaddingTabBar,
子:容器(
填充:所有边缘设置(5.0),
装饰:盒子装饰(
颜色:浅灰色,
borderRadius:borderRadius.all(
圆形半径(50),
),
),
子项:列(子项:[
塔巴(
标签:我的标签,
未选择的标签颜色:Colors.black 54,
labelColor:Colors.black,
未选择的标签样式:kBoldText,
标签样式:kBoldText,
指标化:TabBarIndicatorSize.tab,
指标:盒子装饰(
形状:BoxShape.rectangle,
边界半径:边界半径。圆形(50),
颜色:颜色,白色,
),
),
塔巴视图(
子项:myTabs.map((选项卡){
最终字符串标签=tab.text.toLowerCase();
返回中心(
子:文本(
'这是$label选项卡',
样式:常量文本样式(字体大小:36),
),
);
}).toList(),
),
]),
),
),
);
}
}

您可以在屏幕中间使用defaultTabView或使用其中一个软件包


选项卡视图


试穿一下

为什么不在中间使用
DefaultTabController
?@Kahou我想用它,很抱歉表达得不好,但是当我使用
TabBarView时
它崩溃了…11个例外。。。在布局过程中,RenderCustomMultiChildLayoutBox对象的大小为无限大_在布局期间,RenderInkFeatures对象的大小为无限大。RenderPhysicalModel对象在布局过程中被赋予了无限大的尺寸。我明白了。。。请尝试使用TabBar和TabBarView。@Kahou我的一个想法是使用而不是
Scaffold
Column
,但是有不同的错误。。。水平视口被赋予无限高。RenderBox未布局:RenderViewport#ab47d需要-布局需要-绘制需要-合成-位-更新“包:颤振/src/rendering/box.dart”:失败的断言:第1687行位置12:“hasSize”感谢这些包。我不会用在这个屏幕上,但我可以用在另一个我想过的屏幕上。不工作:(我有此错误>RenderFlex子项具有非零弹性,但传入的高度约束是无限的。使用SizeBox并放置高度不会崩溃…但高度可能会根据内容而改变…请传递您的DartPad的链接好吗?我添加了。~~~~~~~~在DartPad中有效,但在我的项目中无效XD
class ProfileTabBarNavigation extends StatelessWidget {
 final List<Tab> myTabs = <Tab>[
   const Tab(text: kArtwork),
   const Tab(text: kPastJobs)];
@override
Widget build(BuildContext context) {
return DefaultTabController(
  length: 2,
  initialIndex: 0,
  child: Padding(
    padding: kPaddingTabBar,
    child: Container(
      padding: EdgeInsets.all(5.0),
      decoration: BoxDecoration(
        color: kLightGrey,
        borderRadius: BorderRadius.all(
          Radius.circular(50),
        ),
      ),
      child: Column(children: <Widget>[
        TabBar(
          tabs: myTabs,
          unselectedLabelColor: Colors.black54,
          labelColor: Colors.black,
          unselectedLabelStyle: kBoldText,
          labelStyle: kBoldText,
          indicatorSize: TabBarIndicatorSize.tab,
          indicator: BoxDecoration(
            shape: BoxShape.rectangle,
            borderRadius: BorderRadius.circular(50),
            color: Colors.white,
          ),
        ),
        TabBarView(
          children: myTabs.map((Tab tab) {
            final String label = tab.text.toLowerCase();
            return Center(
              child: Text(
                'This is the $label tab',
                style: const TextStyle(fontSize: 36),
              ),
            );
          }).toList(),
        ),
      ]),
    ),
  ),
);
}
}
Expanded(
 child: TabBarView(//...),
),