[英]how to increase the border radius limit in flutter?
I want to crop the top right corner a bit more but even on increasing the border radius.我想更多地裁剪右上角,但即使增加边框半径也是如此。 It is not exceeding the center point of the container.
它不超过容器的中心点。 Can anyone tell how can i obtain design as shown in the pic.
谁能告诉我如何获得如图所示的设计。
My Code:-我的代码:-
Material(
clipBehavior: Clip.antiAlias,
color: Colors.blue,
shape: BeveledRectangleBorder(
borderRadius: BorderRadius.only(
topRight: Radius.elliptical(40,90),
),
),
child: Container(
height: 100,
width: 180,
),
),
Expected:-预期的:-
Current One:-当前一个:-
For custom shapes, you can define CustomClipper
(you don't need any packages for that):对于自定义形状,您可以定义
CustomClipper
(您不需要任何包):
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark().copyWith(scaffoldBackgroundColor: darkBlue),
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: ClipPath(
clipper: ShapeClipper(),
child: Container(color: Colors.red, width: 300, height: 200),
),
),
),
);
}
}
class ShapeClipper extends CustomClipper<Path> {
@override
Path getClip(Size size) {
return Path()
..lineTo(0.0, size.height)
..lineTo(size.width, size.height)
..lineTo(size.width - 100, 0.0)
..close();
}
@override
bool shouldReclip(ShapeClipper oldClipper) => false;
}
This should cover your case, just adjust the ShapeClipper
with specific values.这应该涵盖您的情况,只需使用特定值调整
ShapeClipper
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.