晚上好,
我已经搜索了很多小时,找不到解决方案。我已经设置了全屏图像,并使用堆栈放置了多个GestureDetector。我已经成功能够按下GestureDetector并调用一个函数。问题是,当屏幕尺寸更改为新手机或旧手机时,图像会响应并覆盖全屏,但是Positioned()当然会停留在同一位置,因此图像映射不再正确。] >
有没有一种方法可以使“定位”响应迅速?还是可能以完全不同的方式实现期望的结果?
请帮助我:)
class Overview extends StatelessWidget {
@override
Widget build(BuildContext context) {
double sh = MediaQuery.of(context).size.height;
double sw = MediaQuery.of(context).size.width;
return Scaffold(
drawer: AppDrawer(),
body: Stack(
children: <Widget>[
Container(
height: sh,
width: sw,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/ang7.png'),
fit: BoxFit.cover)),
),
Positioned(
left: 10,
top: 50,
child: IconButton(
icon: Icon(Icons.menu),
iconSize: 30,
color: Colors.white,
onPressed: () => Scaffold.of(context).openDrawer(),
),
Positioned(
left: left,
top: top,
child: GestureDetector(
// child: Icon(Icons.add_circle),
onTap: () => Navigator.push(context, MaterialPageRoute(
builder: (context) {
return Amenities(
tText[page][0],
tText[page][1],
tText[page][2],
);
},
)),
child: Container(
height: 35,
width: 50,
color: Colors.blue,
),
));
),
晚上好,我已经搜索了很多小时,找不到解决方案。我已经设置了全屏图像,并使用堆栈放置了多个GestureDetector。我已经成功地能够...
[将我的评论发布为答案,以防万一,但没有提供更好的答案。请投赞成票并标记为回答。 :-)