No Directionality widget found
The problem is not that you have not wrapped your widgets into MaterialApp. As the documentation says this error occurs due to the nesting of the same kind of Widgets like nesting of Row into Row, Column into Column or Column into ListView so the problem arises as it becomes unbounded constraints for the Widget so unable to identify the direction.
So to avoid this kind of problems usage of Flexible or Expanded occurs which identifies the remaining space.
用 materialapp:
import 'package:flutter/material.dart';
import 'dart:ui' as ui;
void main() {
runApp(new MyApp());
} class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
// TODO: implement build
return MaterialApp(
title: 'hello',
home: Container(
color: Colors.red,
child: Column(
children: <Widget>[
RaisedButton(
child: Text('just test', textDirection: TextDirection.ltr,),
)
],
),
),
);
}
}
不用materialapp
import 'package:flutter/material.dart';
import 'dart:ui' as ui;
void main() {
runApp(new MyApp());
} class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
// TODO: implement build
return MediaQuery(
data: MediaQueryData.fromWindow(ui.window),
child: Directionality(textDirection: TextDirection.rtl, child: Container(
color: Colors.grey,
child: Column(
children: <Widget>[
RaisedButton(
child: Text('just test', textDirection: TextDirection.ltr,),
)
],
),
)),
);
}
}
No Directionality widget found的更多相关文章
- No Directionality widget found.错误记录。
import 'package:flutter/material.dart'; void main() => runApp(new Center(child: new Text('Hello, ...
- 【译】使用 Flutter 实现跨平台移动端开发
作者: Mike Bluestein | 原文地址:[https://www.smashingmagazine.com/2018/06/google-flutter-mobile-developm ...
- StructureMap 代码分析之Widget 之Registry 分析 (1)
说句实话,本人基本上没用过Structuremap,但是这次居然开始看源码了,不得不为自己点个赞.Structuremap有很多的类,其中有一个叫做Widget的概念.那么什么是Widget呢?要明白 ...
- Sencha ExtJS 6 Widget Grid 入门
最近由于业务需要,研究了一下Sencha ExtJS 6 ,虽然UI和性能上据相关资料说都有提升,但是用起来确实不太顺手,而且用Sencha cmd工具进行测试和发布,很多内部细节都是隐藏的,出了问题 ...
- 使用 CoordinatorLayout 出错 inflating class android.support.design.widget.CoordinatorLayout
ava.lang.RuntimeException: Unable to start activity ComponentInfo{com.czr.ianpu/com.czr.ianpu.MainAc ...
- yii2——自定义widget
参考资料:http://www.bsourcecode.com/yiiframework2/how-to-create-custom-widget-in-yii2-0-framework/ 如何使 ...
- Yii2 时间控件之把layDate做成widget
实现效果如下 1.把layDate封装成Yii2的widget,存在 "\common\widgets"目录下,命名为DycLayDate,具体引用查看代码. 2.对应的model ...
- 解决Android中No resource found that matches android:TextAppearance.Material.Widget.Button.Inverse问题
解决Android中No resource found that matches android:TextAppearance.Material.Widget.Button.Inverse问题http ...
- Ext.js细节:在MVC中处理Widget Column,GetCmp和ComponentQuery, Id和ItemId
针对EXT.JS版本的演进,要不断的学习新的最佳实践方法. 比如,在定义组件时,尽管用itemid,而不是id. 在搜索组件时,尽量用ComponentQuery,而不是getCmp. 在MVC中处理 ...
随机推荐
- MyCat(一) - 初体验
前提: 1.安装JDK 2.安装MySQL 3.搭建了MySQL主从 1.下载MyCat,官网:http://www.mycat.io/ wget http://dl.mycat.io/1.6-REL ...
- C#获取一个数组中的最大值、最小值、平均值
C#获取一个数组中的最大值.最小值.平均值 1.给出一个数组 ,,,,,-,,,,}; 2.数组Array自带方法 本身是直接可以调用Min(),Max(),Average()方法来求出 最小值.最大 ...
- [LeetCode] Group Anagrams 群组错位词
Given an array of strings, group anagrams together. Example: Input: ["eat", "tea" ...
- IsWindowVisible
IsWindowVisible通过该函数可以获得指定窗口的可视状态,即显示或者隐藏. BOOL IsWindowVisible( HWND hWnd ); hWnd:被测试窗口的句柄. 返回值:如果指 ...
- 一些关于SQL优化的总结
由于这个项目一直都是mysql所以写点mysql的 1.数据存储引擎的选择,MyISAM 和 InnoDB 的选择 InnoDB 一般都会选择这个,但是如果真的涉及到一些不涉及增删的表,可以考虑下My ...
- 剑指offer——python【第49题】把字符串转换成整数
题目描述 将一个字符串转换成一个整数(实现Integer.valueOf(string)的功能,但是string不符合数字要求时返回0),要求不能使用字符串转换整数的库函数. 数值为0或者字符串不是一 ...
- .NET Core开发日志——OData
简述 OData,即Open Data Protocol,是由微软在2007年推出的一款开放协议,旨在通过简单.标准的方式创建和使用查询式及交互式RESTful API. 类库 在.NET Core中 ...
- zabbix3.2使用自带模板监控MySql
一.zabbix自带MySql模板监控项 Zabbix3.0之后已经有MySql监控模板了,所以我们只要引用ZabbixServer自带的模板即可.zabbix默认有14个监控项 我们只需获取监控项需 ...
- Ubuntu虚拟机识别不了SD卡的解决办法
前提,你的虚拟机已经安装了VMware Tools. Step 1: 出现这种情况先查看计算机中的虚拟机的VMware USB Arbitration Service是否启用(注意是VMware US ...
- Spark MLlib之使用Breeze操作矩阵向量
在使用Breeze 库时,需要导入相关包: import breeze.linalg._ import breeze.numerics._ Breeze创建函数 //全0矩阵 DenseMatrix. ...