gpt4 book ai didi

dart - flutter :画半圆

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

这样的半圆怎么画?
拜托,我不想要一个容器小部件并改变它的半径

enter image description here

最佳答案

我不明白你在“我不想要一个容器小部件并改变它的半径”中的意思,但这是我创建半圆的方法:

class Test extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold(
body: new Container(
padding: EdgeInsets.all(64.0),
child: new Column(
children: <Widget>[
new ClipPath(
clipper: new CustomHalfCircleClipper(),
child: new Container(
height: 300.0,
width: 300.0,
decoration: new BoxDecoration(color: Colors.blue, borderRadius: BorderRadius.circular(150.0) ),
),
)
],
),
),
);
}
}

class CustomHalfCircleClipper extends CustomClipper<Path> {
@override
Path getClip(Size size) {
final Path path = new Path();
path.lineTo(0.0, size.height / 2);
path.lineTo(size.width, size.height / 2);
path.lineTo(size.width, 0);
return path;
}
@override
bool shouldReclip(CustomClipper<Path> oldClipper) {
return true;
}
}

关于dart - flutter :画半圆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54935282/

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