在将文本输入到文本字段中时,屏幕正在滚动,并且我在resizeToAvoidBottomPadding:false,
中使用了此Scaffold
以避免调整屏幕大小,并且“列表是带有文本字段的动态”。编辑动态textfield
时如何停止滚动或调整屏幕大小?
我还通过在ListView.builder中添加physics: const NeverScrollableScrollPhysics()
来抵抗物理滚动。
Container dynamciContainer(BuildContext context,double width,double height){
return Container(
child: ListView.builder
(
itemCount:sfieldList.length,
shrinkWrap: true,
padding: EdgeInsets.all(0),
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext ctxt, int index) {
return dynamicItem(ctxt,width, height,sfieldList[index],index);
}
),
);
}
TextField项
Container textFieldContainer(double width,Fieldlist field,int p){
return Container(
decoration: new BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.grey[200], width: 2.0),
borderRadius: new BorderRadius.all(Radius.circular(45.0))),
padding:EdgeInsets.only(top:width*0.009,bottom: width*0.009,left: width*0.05,right: width*0.00),
child: new TextField(
style: TextStyle(fontFamily: 'semibold',color: MyColors.colorPrimary),
keyboardType:field.type=='STR'||field.type=='EMAIL'? TextInputType.text:TextInputType.number,
textInputAction: TextInputAction.done,
decoration: InputDecoration(contentPadding:EdgeInsets.all(8.0),hintStyle: TextStyle(fontFamily: 'semibold',color: MyColors.colorPrimary), border: InputBorder.none),
onChanged: (String val) {
enteredValue(field,val);
setState(() {
sfieldList[p].fieldvalue=val;
});
},),
);
}