不正确地使用父数据小部件.扩展的小部件必须放在 flex 小部件内 [英] incorrect use of parent data widget. expanded widgets must be placed inside flex widgets

查看:20
本文介绍了不正确地使用父数据小部件.扩展的小部件必须放在 flex 小部件内的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到以下错误:

即,引发了另一个异常:ParentDataWidget 的使用不正确.在手机屏幕上显示错误.

i.e.., Another exception was thrown: Incorrect use of ParentDataWidget. showing error on the mobile screen.

 @override
  Widget build(BuildContext context) {

    return MaterialApp(
      title: widget.title,
      theme: ThemeData.light().copyWith(
        platform: _platform ?? Theme.of(context).platform,
      ),
      home: DefaultTabController(
        length: categoryNames.length,
        child: Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
                 ),
        body: SafeArea(
            child: Column(
              children: <Widget>[
                Chewie(
                  controller: _chewieController,
                ),
                TabBar(
                  labelColor:Colors.black,
                  tabs: categoryNames,
                ),
                Expanded(
                  child: TabBarView(
                    children: [
                      ImageList()
                    ],
                  ),
                )
                /*TabBarView(
                  children: [
                    Icon(Icons.directions_car),
                    Icon(Icons.directions_transit),
                    Icon(Icons.directions_bike),
                  ],
                )*/
              ],
            )
        ),
      ),
      ),
    );
  }

这是我的代码,请检查并告诉我问题.

Its my code, please check and let me know the issue.

推荐答案

您应该只在 columnrow 或 <代码>弹性.

You should use Expanded only within a column, row or flex.

这篇关于不正确地使用父数据小部件.扩展的小部件必须放在 flex 小部件内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆