Flutter 位置图像在带有堆栈的容器外一点
Flutter postion image a little bit outside container with stack
我正在尝试将图像放置在容器外一点,我使用了堆栈并将图像定位为从顶部将图像放置在容器外一点,但是图像的那部分看起来已经消失了,这是怎么回事看起来
这就是我想要的样子
这是我的代码
Column(
children: [
Stack(
fit: StackFit.loose,
clipBehavior: Clip.hardEdge,
children: [
Container(
height: 151.0,
width: 122.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.0),
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Color(0xffFFF0E5),
Color(0xffdeddc2),
Color(0xffa9ceb1),
Color(0xff68bdb9),
Color(0xff30a6ca)
],
),
boxShadow: [
BoxShadow(
color:
Color.fromARGB(255, 234, 246, 250),
spreadRadius: 8,
blurRadius: 7,
offset: Offset(0, 6),
),
],
border: Border.all(
width: 4,
color: Colors.yellow,
),
),
child: Positioned(
top: 75.0,
child: Container(
child: Image.asset(
'assets/images/watch-gt2-listimage-Matte-Black.png',
height: 120.0,
width: 125.0,
),
),
),
),
],
),
],
),
您必须更改 clipBehavior: Clip.none
它的所有父小部件,例如 Stack 和 Container。
我正在尝试将图像放置在容器外一点,我使用了堆栈并将图像定位为从顶部将图像放置在容器外一点,但是图像的那部分看起来已经消失了,这是怎么回事看起来
这就是我想要的样子
这是我的代码
Column(
children: [
Stack(
fit: StackFit.loose,
clipBehavior: Clip.hardEdge,
children: [
Container(
height: 151.0,
width: 122.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.0),
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Color(0xffFFF0E5),
Color(0xffdeddc2),
Color(0xffa9ceb1),
Color(0xff68bdb9),
Color(0xff30a6ca)
],
),
boxShadow: [
BoxShadow(
color:
Color.fromARGB(255, 234, 246, 250),
spreadRadius: 8,
blurRadius: 7,
offset: Offset(0, 6),
),
],
border: Border.all(
width: 4,
color: Colors.yellow,
),
),
child: Positioned(
top: 75.0,
child: Container(
child: Image.asset(
'assets/images/watch-gt2-listimage-Matte-Black.png',
height: 120.0,
width: 125.0,
),
),
),
),
],
),
],
),
您必须更改 clipBehavior: Clip.none
它的所有父小部件,例如 Stack 和 Container。