【问题标题】:No Directionality widget found. RichText widgets require a Directionality widget ancestor未找到方向性小部件。 RichText 小部件需要 Directionality 小部件祖先
【发布时间】:2018-11-06 07:18:06
【问题描述】:

我正在尝试通过在屏幕上打印 Hello World 来运行最简单的 Flutter 应用程序。

按照this issue,我尝试了两个sn-ps:

void main() {
    runApp(
        new Center(
            child: new Text("Hello World!", textDirection: TextDirection.ltr)
        )
     );
}

&&

void main() {
    runApp(new Center(
      child: new Directionality(
          textDirection: TextDirection.ltr,
          child: new Text('Hello, world!'))));
}

但我收到错误消息:

未找到方向性小部件。 RichText 小部件需要 Directionality 小部件祖先。

我错过了什么?

【问题讨论】:

    标签: android dart flutter


    【解决方案1】:

    之后它对我有用:

    完全重启

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-11-19
      • 2019-01-17
      • 2020-11-23
      • 1970-01-01
      • 2021-05-18
      • 2021-10-08
      • 2021-03-31
      相关资源
      最近更新 更多