在启动画面中使图像居中且呈圆形的方法?

huangapple go评论63阅读模式
英文:

is there any way for making an image circular in the center of splash screen?

问题

在我的Flutter应用程序中,我创建了一个启动屏幕。我有一个问题,我无法使中心图像变成圆形图像。在这里,android:gravity="center" 之外,我应该写什么?
我分享了我的启动屏幕视图。你将理解我想要将哪个图像变成圆形。

在启动画面中使图像居中且呈圆形的方法?

我尝试写fill、center-fill代替center,但它们都没有帮助...

英文:

In my flutter app I created a splash screen.I have one problem.I can not make center image circular image.What shoudld I write instead of center here android:gravity="center" ?
I share the view of my splash screen.You will understand which image I want to make circular.

在启动画面中使图像居中且呈圆形的方法?

I tried to write fill,center-fill instead of center,but none of them helped...

答案1

得分: 1

如果我理解正确,您希望您的启动图像是圆形的。如果是这样的话,您应该在PNG源中裁剪出圆形形状,将角落切割成透明的部分。然后,使用flutter_native_splash来更新图像,使用您新裁剪的圆形图像。

英文:

If I understand correctly, you would like your splash image to be circular. If that is the case, you should crop the circle shape in the PNG source, leaving the corners cutouts as transparent sections. Then, use flutter_native_splash to update the image with your new cropped circular image.

答案2

得分: 0

你可以使用 CircleAvatarClipOval
两者都能轻松实现这一目标。

英文:

you can use CircleAvatar od ClipOval
both of them would achive that easily

答案3

得分: 0

你可以使用 CircleAvatar

如果头像需要显示图像,图像应该在 backgroundImage 属性中指定:

CircleAvatar(
  backgroundImage: NetworkImage(userAvatarUrl),
)

你也可以参考 https://api.flutter.dev/flutter/material/CircleAvatar-class.html#material.CircleAvatar.1

英文:

you can use CircleAvatar class

If the avatar is to have an image, the image should be specified in the backgroundImage property:

CircleAvatar(
  backgroundImage: NetworkImage(userAvatarUrl),
)

also you can refer https://api.flutter.dev/flutter/material/CircleAvatar-class.html#material.CircleAvatar.1

huangapple
  • 本文由 发表于 2023年5月13日 22:16:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/76243185.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定