// 返回一个controller
Future<int> _showBottomSheet(BuildContext context){
return showModalBottomSheet<int>(
// 1.设置圆角
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(topLeft: Radius.circular(ScreenUtil().setWidth(10)),
topRight: Radius.circular(ScreenUtil().setWidth(10)))
),
context: context,
// 2.设置可以全屏
// isScrollControlled: true,
builder: (BuildContext context){
// 3.设置状态可以交互
return StatefulBuilder(
builder: (BuildContext context, StateSetter setState){
return Container(
child: Stack(
children: [
Column(
children: [
Container(
child: Text("购物篮"),
),
Container(
child: Text("列表页面"),
)
],
),
Positioned(
left: 0,
bottom: 0,
right: 0,
child: Container(
child: Text("aaaaaaa"),
))
],
),
);
}
);
});
}
关于showBottomSheet的用法
showBottomSheet(
context: context,
builder: (context) {
return Container(
decoration: BoxDecoration(
color: Colors.lightBlue,
borderRadius: BorderRadius.only(topLeft: Radius.circular(ScreenUtil().setWidth(10)),
topRight: Radius.circular(ScreenUtil().setWidth(10)))
),
height: ScreenUtil().setHeight(600),
);
});
网友评论