【发布时间】:2021-12-11 16:40:45
【问题描述】:
Widget build(BuildContext context){
var height2 = AppBar().preferredSize.height;
return Scaffold(
backgroundColor: Colors.white,
body: Stack(
children: <Widget>[
Image(
image: AssetImage("assets/oral_structure.png"),
fit: BoxFit.fill
),
Padding(
padding: EdgeInsets.only(top:100, left: 100),
child: Container(
height: 60,
width: 60,
child: FlatButton(
child: Text('ㅂ', style: TextStyle(fontSize: 30,fontWeight: FontWeight.bold)),
onPressed: (){
Navigator.push(context, MaterialPageRoute(builder: (context) => B()),);
},
)
),
),
以上是我的代码的一部分。我正在制作的应用程序是将适当的按钮放置在背景图像顶部的位置。但是,如果您进行上述代码,则按钮的位置和图像的位置会根据智能手机的屏幕尺寸而有所不同。固定高度和宽度也是如此。怎么没有办法?
【问题讨论】:
标签: flutter flutter-layout flutter-widget