- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在expand
小部件上使用TextFormField
属性。
我的代码如下所示:
body: ListView(
children: <Widget>[
ListTile(
leading: CircleAvatar(
backgroundImage: CachedNetworkImageProvider(
currentUser.photoUrl
)
),
title: Container(
color: Colors.blue,
width: 250.0,
child: TextFormField(
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 20.0,
color: Colors.white
),
cursorColor: Colors.white,
maxLines: null,
minLines: null,
expands: true,
controller: captionController,
decoration: InputDecoration(
hintText: 'Write something...',
border: InputBorder.none,
hintStyle: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold
),
fillColor: Colors.blue
)
)
)
),
]
)
BoxConstraints forces an infinite height
。当文本字段的内容溢出时,如何扩展文本字段的高度。
最佳答案
尝试为Container()
提供有限的高度。 expands
尝试根据您的情况下为TextFormField
的 parent 高度调整null
的大小。
body: ListView(
children: <Widget>[
ListTile(
leading: CircleAvatar(
backgroundImage: CachedNetworkImageProvider(
currentUser.photoUrl
)
),
title: Container(
height: 200.0, // Add your own custom height here
//Rest of the code is same
)
),
]
),
关于flutter - flutter :BoxConstraints强制无限高,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59675594/
我想通过在函数中使用上下文来获取约束(在构建方法之前)。 在build()方法中,如果我们一开始就使用LayoutBuilder,它提供了child可以占用的constraints。那有没有可能直接通
在这个类中作为一个小部件,我使用动画来显示和隐藏,当我通过单击多次显示或隐藏时,有时我会收到此错误: BoxConstraints has a negative minimum width.The o
child:Column( children: [ Container( height: double.infinity, width: 100.0, color: Col
在列中添加行时出现错误。我收到以下错误: I/flutter ( 6449): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════
在flutter的Container小部件中, 给它一个固定的 height 和 width 和为它提供 BoxConstraints constraints< 有什么区别 属性?。 它是提供宽度 +
我正在尝试实现带有复选框的 ListView,但我收到一条错误消息,提示 BoxConstraints 强制无限宽度。这是我的代码: body: ListView.builder(itemCount:
我正在尝试模仿与附加图像类似的搜索 View ,但出现以下错误。我可以使用 ListTile 实现此目的,但我无法为图标或 TextField 设置填充。所以我正在尝试使用 Row 小部件来实现这一点
TL;DR - 如何实现 shrinkWrap = true在ReorderableListView ? 我试图创建一个 ReoderableListView与 Column ← Column ← P
文字未呈现在应用程序的主页上,这是我遇到问题的地方。我是新手,因此是新手。希望有人可以提供一些见解,或者根据我遇到的错误调整代码。 为了进一步说明,当我启动“ flutter ”时将显示此页面。将显示
不确定为什么会抛出错误 BoxConstraints forces an infinite height return Scaffold( body: Column( children:
我是一名优秀的程序员,十分优秀!