我有一个文本字段,它位于Container的中心.我的问题是,我越降低屏幕高度,文本字段中的文本越超出边界.我用容器包装了文本字段,并给它赋予了 colored颜色 ,看起来文本字段正确地适应了容器的变化,但文本或文本字段的输入会自行行为,并随着我越多地调整高度而超出边界.有什么解决办法吗?
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
height: height * 0.076823398741207,
width: width * 0.414674703803783,
decoration: BoxDecoration(
color: Color.fromARGB(212, 17, 19, 57),
borderRadius: BorderRadius.circular(20),
),
child: Center(
child: Row(
children: [
Expanded(
child: TextField(
style: TextStyle(
color: Colors.white,
fontSize: width *
0.0103928497193931,
),
decoration: InputDecoration(
filled: true,
fillColor: Colors.red,
constraints: BoxConstraints(
minHeight: 120),
contentPadding:
EdgeInsets.only(
left: width *
0.0166285595510289,
),
border: InputBorder.none,
),
),
),
],
),
),
),
)
我try 了很多解决方案,比如用SingleChildScrollView包装它,设置max line和minline,但什么都没有.唯一似乎稍微改变了文本行为的是,在文本字段的InputDecorator的约束中设置了MaxHeight和MinHeight.