由于容器的子项不起作用而导致行颤动

问题描述

我有以下有效的代码。但是,当我在以下代码中将Column替换为Row时,出现错误Horizontal RenderFlex with multiple children has a null textDirection,so the layout order is undefined.

  Widget build(BuildContext context) {
    return new Container(
      color: Colors.red,child: Column(
        children: <Widget>[
          Container(
            width: 100,height: 100,color: Colors.white,),Container(
            width: 100,color: Colors.black,color: Colors.blue,],)
    );
  }

以下代码会产生错误。

  Widget build(BuildContext context) {
    return new Container(
      color: Colors.red,child: Row(
        children: <Widget>[
          ...,...,)
    );
  }

解决方法

行需要textDirection进行如下设置。

Row(
  textDirection: TextDirection.ltr,children: [...],)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...