【发布时间】:2019-10-20 00:37:48
【问题描述】:
我正在设置一个文本字段,当在键盘上按下 Enter 时该文本字段将展开 当我尝试在最大行中设置 null 时,它不显示文本字段内的文本 我什至设置了扩展=真 我在代码中 size.height 的某个地方使用了媒体查询大小 我将文本字段包装在灵活的小部件中 并添加一些填充,然后将整个灵活的小部件包装在 Row 中 最后一行被包裹在一个容器中
所以这段代码不起作用帮助我解决这个问题
容器(
height: size.height * .059,
width: double.infinity,
child: new Row(
children: <Widget>[
new Flexible(
child: Padding(
padding: EdgeInsets.only(right: size.width * 0.007),
child: new TextField(
controller: _textFieldController,
textInputAction: TextInputAction.newline,
keyboardType: TextInputType.multiline,
maxLines: null,
expands: true,
style: TextStyle(color: Colors.black),
cursorColor: Colors.blue,
decoration: InputDecoration(
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(30.0),
borderSide: BorderSide(color: Color(0xff8e9291))),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(30.0),
borderSide: BorderSide(color: Color(0xff8e9291))),
prefixIcon: Icon(
Icons.message,
color: Color(0xff8e9291),
),
hintText: "Type a message",
hintStyle: TextStyle(
color: Color(0xff8e9291),
),
),
),
),
),
FloatingActionButton(
backgroundColor: Colors.blue[400],
onPressed: () {
},
tooltip: 'Send',
child: RotationTransition(
turns: AlwaysStoppedAnimation(-35 / 360),
child: Icon(
Icons.send,
size: 20,
)),
),
],
),
),
这是我正在使用的文本字段..
【问题讨论】:
标签: flutter