gpt4 book ai didi

通过容器的图像

转载 作者:IT王子 更新时间:2023-10-29 07:20:53 25 4
gpt4 key购买 nike

我正在努力使它变得 flutter 朔迷离:

need to do

我的实际结果:

need to do

我的代码是这样的:

 new Container(
height: 150.0,
margin: const EdgeInsets.only(top: 16.0, bottom: 8.0),
child: new Stack(
children: <Widget>[
recantoCard,
recantoThumbnail,
],
),
)
final recantoThumbnail = new Container(
alignment: new FractionalOffset(0.0, 0.5),
margin: const EdgeInsets.only(left: 5.0, top: 10),
child: new Image(
image: new AssetImage("assets/nossos_restaurantes.png"),
height: 350.0,
),
);

final recantoCard = new Container(
margin: const EdgeInsets.only(left: 0.0, right: 48.0),
decoration: new BoxDecoration(
color: Color(getColorHexFromStr("E5E6E8")),
shape: BoxShape.rectangle,
),
child: new Container(
margin: const EdgeInsets.only(top: 10.0, left: 170.0),
constraints: new BoxConstraints.expand(),
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Text("text",
style: TextStyle(
color: Colors.black,
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
fontSize: 20.0)),
new Text("texto:",
style: TextStyle(
color: Colors.black,
fontFamily: 'Poppins',
fontWeight: FontWeight.w500,
fontSize: 17.0)),
],
),
),
);

图像是一个 .png 文件,我需要将它传递到一个容器和堆栈中,但图像总是停留在 150 高度的容器中。我怎样才能让图像越过容器?

最佳答案

要使您的图像越过容器,您必须使用 Matrix4.translationValues(double x, double y, double z) 类。

每当你需要通过立交桥时就使用这个类 转换:Matrix4.translationValues(0.0, 60, 0.0),

Container(
height: 150.0,
color: Colors.red,
child: Center(
child:Container(
height: 130.0,
width: 130.0,
transform: Matrix4.translationValues(0.0, 60, 0.0),

child: Image.asset('assets/image.jpg'),
)
),
)

This image will the result of the above code

关于通过容器的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55690826/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com