[英]Custom shape in flutter ( with curved edges )
Hello am trying to achieve this UI in flutter您好,我正在尝试在颤振中实现此 UI
Expected output预期输出
Output what am getting now输出现在得到的
How to make that curve before LTE and ZTL.
如何在 LTE 和 ZTL 之前制作该曲线。 How to position widgets in flutter when using stack other than the positioned widget?
使用定位小部件以外的堆栈时,如何在颤动中定位小部件?
The code for what I have done so far.到目前为止我所做的代码。
import 'package:flutter/material.dart';
class NavHome extends StatelessWidget {
const NavHome({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(
height: MediaQuery.of(context).size.height * 0.023,
),
Stack(children: [
Container(
height: MediaQuery.of(context).size.height * 0.35,
width: MediaQuery.of(context).size.width * 0.90,
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5), //color of shadow
spreadRadius: 2, //spread radius
blurRadius: 3, // blur radius
offset: const Offset(0, 0),
),
],
color: const Color(0xff0C2242),
borderRadius: BorderRadius.circular(17))),
Container(
height: MediaQuery.of(context).size.height * 0.27,
width: MediaQuery.of(context).size.width * 0.90,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(17))),
Positioned(
top: MediaQuery.of(context).size.height * 0.27,
left: MediaQuery.of(context).size.height * 0.15,
child: Container(
height: MediaQuery.of(context).size.height * 0.08,
width: MediaQuery.of(context).size.width * 0.30,
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(17),
bottomRight: Radius.circular(17))),
),
)
])
],
);
}
}
I'm not sure that the original UI will be achieved.我不确定原始用户界面是否会实现。 So, here is the suggestion below the graph create a Row widget and add three widgets of card then try changing the border shape based on your shape
因此,这是图表下方的建议,创建一个 Row 小部件并添加三个卡片小部件,然后尝试根据您的形状更改边框形状
you should use CustomClipper .你应该使用 CustomClipper 。 read the documentation https://api.flutter.dev/flutter/rendering/CustomClipper-class.html
阅读文档https://api.flutter.dev/flutter/rendering/CustomClipper-class.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.