1.Row 里面套 textfield报错
The following assertion was thrown during performLayout():
BoxConstraints forces an infinite width.
Row 里面嵌套textfield就报错。。。
解决:外面套个expanded
Expanded( child: TextField(), )
2019-07-03 11:42 更新
2. GestureDetector 嵌套 Container 点击只响应部分区域
GestureDetector( child: Container( child: Text(data[index]["typeName"], textAlign: TextAlign.left), height: 50, width: double.infinity, alignment: Alignment.centerLeft, padding: EdgeInsets.only(left: 20), decoration: currentLeftindex == index ? BoxDecoration(color: Colors.grey) : null), onTap: ()=>doShowIndex(index), )
如下,当点击的时候只有Text部分有响应,Container部分无响应,这个其实是由它的behavior属性来控制的,
加上
behavior: HitTestBehavior.opaque,
这个属性,则container部分也能点击了
2019-07-10 16:39 更新
3.如果在wrap里面想要包裹row怎么办
正常情况下,会发现一个row占有一行,这样就没有流式布局的效果了,
解决方法是
Row( mainAxisSize: MainAxisSize.min,)
通过设置mainAxisSize这个属性,一个row就不会占有一行了
参考:https://stackoverflow.com/questions/56009554/how-to-wrap-rows-which-contain-other-widgets-without-overflowing-in-flutter
2019-07-14 16:13 更新
4.tarbarview 如果想要tar平分屏幕怎么办
这个参数设为 true,即可
isScrollable: true,
- 点赞
- 收藏
- 分享
-
- 文章举报
原文始发于:flutter开发过程坑收集(二) coding相关
主题测试文章,只做测试使用。发布者:sys234,转转请注明出处:http://www.cxybcw.com/67002.html