如何使用Stack和定位在SafeArea中添加形状,我尝试更改AppBar的颜色并连接到该形状并添加mediaQuery,但仍然不能在每个屏幕上正确连接。那么,如何在SafeArea的整个表面上获取svg照片,并使其在不使用appbar的情况下使其具有响应性,是否有必要像下面的图片那样获得效果?(代码给出了图片中的效果,但它没有响应性,由两部分组成,我想要一个部分并得到响应)
任何帮助都非常感谢。


class Shape extends StatelessWidget {
static Route route() {
return MaterialPageRoute<void>(builder: (_) => Shape());
}
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.blue,
elevation: 0,
actions: [],
),
body: _profilePage(context),
);
}
Widget _profilePage(BuildContext context) {
return SafeArea(
child: Align(
child: Center(
child: Stack(
children: <Widget>[
Positioned(
width: MediaQuery.of(context).size.width * 1,
height: MediaQuery.of(context).size.height,
bottom: MediaQuery.of(context).size.width * 0.6,
child: _curved(context),
),
],
),
),
),
);
}
Widget _curved(BuildContext context) {
return SvgPicture.asset(
'assets/images/shape_purple.svg',
color: Colors.blue,
allowDrawingOutsideViewBox: true,
);
}发布于 2021-07-29 11:26:09
使用FitteBox Widget代替
FittedBox(
child: Image.asset('assets/images/background.png'),
fit: BoxFit.fill,
// decoration: BoxDecoration(
// color: Colors.white),
),https://stackoverflow.com/questions/68571051
复制相似问题