gpt4 book ai didi

flutter 。如何将容器的一个边缘切割成凹形/月牙形

转载 作者:行者123 更新时间:2023-12-03 03:25:43 25 4
gpt4 key购买 nike

这是一个圆角容器:

new Container(
width: 150,
height: 50,
decoration: new BoxDecoration(
color: Colors.lime,
borderRadius: new BorderRadius.all(new Radius.circular(5)),
),
)

我想让容器的右侧边缘凹陷/新月形,就好像它是用半圆切割的一样

像这样:

flutter custom shaped container

谢谢

最佳答案

您可以使用 ArcView 轻松制作此 View link .见附图

 @override
Widget build(BuildContext context) {
return Container(
child: Center(
child: Row(
children: <Widget>[
RotatedBox(
quarterTurns: 3,
child: Arc(
arcType: ArcType.CONVEY,
height: 10.0,
clipShadows: [ClipShadow(color: Colors.black)],
child: new Container(
width: 50,
height: 150,
borderRadius: new BorderRadius.only(
topLeft: new Radius.circular(5),
topRight: new Radius.circular(5),
),
),
),
),
),
FloatingActionButton(
backgroundColor: Colors.lime,
onPressed: null,
child: Icon(
Icons.add,
color: Colors.white,
),
),
],
),
),
);
}

enter image description here

关于 flutter 。如何将容器的一个边缘切割成凹形/月牙形,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57735819/

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