flutter - 如何以中心向外的弧形夹住容器的底部
问题描述
我想夹住容器的底部,如图所示
我已经对圆圈进行了编码,但是如何实现剩余部分
class MyClipper extends CustomClipper<Path> {
@override
Path getClip(Size size) {
var path = Path();
path.lineTo(0.0, size.height - 90);
var firstControlPoint = Offset(size.width / 5, size.height);
var firstPoint = Offset(size.width / 2, size.height);
path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy,
firstPoint.dx, firstPoint.dy);
var secondControlPoint = Offset(size.width - (size.width / 5), size.height);
var secondPoint = Offset(size.width, size.height - 90);
path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy,
secondPoint.dx, secondPoint.dy);
path.lineTo(size.width, 0);
path.close();
return path;
}
@override
bool shouldReclip(CustomClipper<Path> oldClipper) => false;
}
解决方案
Stack(
alignment: Alignment.bottomCenter,
children: [
Container(
margin: EdgeInsets.only(bottom: 24),
padding: EdgeInsets.symmetric(vertical: 4),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(15),
bottomLeft: Radius.circular(15),
),
border: Border.all(
color: Colors.grey.withOpacity(0.5),
),
),
child: Container(height: 100),
),
Container(
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
shape: BoxShape.circle, color: Colors.white),
child: CircleAvatar(
radius: 24,
backgroundColor: Colors.green,
child: Icon(
Icons.arrow_forward,
color: Colors.white,
)),
),
],
)
推荐阅读
- datatable - 如何在 Spotfire 数据表中隐藏具有空值的行
- php - 以正确的方式取消设置会话
- java - 线性布局,不像想要的那样出现
- reactjs - 搜索过滤器输入 ReactJS
- css - 更改网格样式的顺序(砌体)
- javascript - 如何在搜索到的位置设置多边形?
- ruby-on-rails - 如何运行在互联网上共享的 Rails 片段
- android - Livereload 不工作 Ionic cordova 部署到真实设备
- python - Pandas - 带有选定集合的 get_dummies
- firebase-realtime-database - 如何将 Paypal IPN 发送到 Google Cloud 功能?