【发布时间】:2022-10-06 00:53:48
【问题描述】:
在我的 android flutter 应用程序中输入用于输入电话号码的文本框后,电话文本框没有移动到顶部。它被数字隐藏了。那么,如何解决这个问题呢?背景图片 bg.png 大小为 789X1665 。那么,需要调整 bg 图像的大小还是需要添加一些代码更改?请帮助任何人解决此问题。
return Scaffold(
resizeToAvoidBottomInset : false,
body: Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
image : DecorationImage(
image: AssetImage(\'images/bg.png\'),
fit: BoxFit.contain
)
),
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(height: 500,),
Container(
margin:EdgeInsets.only(top: 10),
child: const Center(
child: Text(
\"Phone (OTP) Authentication\",
style:TextStyle(fontWeight: FontWeight.bold,fontSize: 20) ,
),
),
),
SizedBox(height: 10,),
SizedBox(
width: 400,
height: 50,
child: CountryCodePicker(
onChanged: (country){
setState(() {
dialCodeDigits = country.dialCode!;
});
},
initialSelection: \"IN\",
showCountryOnly: false,
showOnlyCountryWhenClosed: false,
favorite: [\"+1\", \"US\", \"+91\", \"IND\"],
hideSearch: true,
showDropDownButton: false,
enabled: false,
),
),
Container(
margin: EdgeInsets.only(top: 10,right: 10,left: 10),
child: TextField(
decoration: InputDecoration(
hintText: \"Phone Number\",
prefix: Padding(
padding: EdgeInsets.all(4),
child: Text(dialCodeDigits!),
)
),
maxLength: 12,
keyboardType: TextInputType.number,
controller: _controller,
),
),
Container(
margin: EdgeInsets.all(15),
width: double.infinity,
child: ElevatedButton(
onPressed: (){
Navigator.of(context).push(MaterialPageRoute(builder: (c) => OTPControllerScreen(
phone: _controller.text,
codeDigits: dialCodeDigits!,
)));
},
child: Text(\'Next\',style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),),
),
),
],
),
)
)
);