[英]Repeat images next to each other in flutter
So this is my first real flutter project and I cannot figure out how to solve this problem...所以这是我第一个真正的颤振项目,我不知道如何解决这个问题......
I'm basically trying to "multiply" or "repeat" an icon infinite times on my AppBar.我基本上是在尝试在我的 AppBar 上无限次“倍增”或“重复”一个图标。 But I couldn't find a method to actually do this...
但我找不到真正做到这一点的方法......
Here's a picture what I mean:这是我的意思的图片:
https://i.stack.imgur.com/aKOVj.png https://i.stack.imgur.com/aKOVj.png
And here's my AppBar code:这是我的 AppBar 代码:
child: Stack(
children: <Widget>[
AppBar(
backgroundColor: Colors.lightGreen,
leading: IconButton(
alignment: Alignment(1.2, 1),
icon: Icon(Icons.close, color: Colors.white,),
),
),
Positioned(
right: 150,
left: -180,
child: Container(
),
),
Positioned(
height: 30,
top: 0,
right: 0,
child: RotationTransition(
turns: AlwaysStoppedAnimation(-30 / 360),
child: Image.asset('assets/writer-icon.png',
repeat: ImageRepeat.repeat,
alignment: const Alignment(2.5, 3.5),
)
),
),
Positioned(
height: 30,
top: 20,
right: 35,
child: RotationTransition(
turns: AlwaysStoppedAnimation(-30 / 360),
child: Image.asset('assets/writer-icon.png',
repeat: ImageRepeat.repeat,
alignment: const Alignment(2.5, 3.5),
)
),
),
],
),
Appreciate your help.感谢你的帮助。
Instead of using Stack with positioned elements, a simpler qnd easier solution would be to use flexibleSpace property of appBar to add a background image.而不是使用带有定位元素的 Stack,一个更简单的 qnd 更容易的解决方案是使用 appBar 的 flexibleSpace 属性来添加背景图像。 You will need your designer to create a background image as you want.
您将需要您的设计师根据需要创建背景图像。
flexibleSpace: Image( image: AssetImage('assets/images/appbar_bg.png'), fit: BoxFit.cover, ),
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.