showModalBottomSheet(
context: context,
isScrollControlled: true,//显示的底部弹出框(Bottom Sheet)是否能够根据内容大小进行滚动。
builder: (BuildContext context) {
return StatefulBuilder(
builder: (context, setState) {
final keyboardHeight = MediaQuery.of(context).viewInsets.bottom;//检测软键盘是否弹出
return Padding(
padding: EdgeInsets.only(bottom: keyboardHeight),//设置底部内边距为软件盘高度
child:
ClipRRect(
borderRadius:
const BorderRadius.vertical(
top: Radius.circular(20),
),
child: Container(
color: Colors.white,
height: 300.w,
width: double.infinity,
padding: const EdgeInsets.only(
top: 34.0, bottom: 20.0),
child: Column(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
'修改密码',
style: TextStyle(
color:
hexColor('#333333'),
fontSize: 20,
),
),
const SizedBox(height: 15.0),
// 弹窗中间部分处理
Expanded(
child: Center(
child: _option(),
),
),
const SizedBox(height: 15.0),
SizedBox(
width: 180.w,
child: OptBtn(
height: 52.w,
borderRadius: 26.0,
color:
hexColor('#03B86F'),
borderColor:
hexColor('#03B86F'),
textColor:
hexColor('#FFFFFF'),
text: '确定',
onTap: () {
Navigator.pop(
context);
}),
)
],
)));
);
});
});