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

查看:610
本文介绍了父数据小部件的使用不正确。扩展的窗口小部件必须放在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.

推荐答案

您应仅在列,行或flex中使用扩展。

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

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

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