I want to make a shape as seen in the photo below with container in Flutter.
How can that shape be made?
I want to make a shape as seen in the photo below with container in Flutter.
How can that shape be made?
You can use this paint:
class CustomDraw2 extends CustomClipper<Path> {
@override
Path getClip(Size size) {
var path = Path();
path.moveTo(size.width * 0.5, 0);
path.lineTo(size.width, 0);
path.lineTo(size.width, size.width - size.width * 0.5);
path.lineTo(size.width * 0.5, 0);
path.close();
return path;
}
@override
bool shouldReclip(CustomClipper<Path> oldClipper) {
return false;
}
}
and use it like this:
Container(
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(borderRadius: BorderRadius.circular(16)),
child: Stack(
children: [
Container(
color: Colors.brown,
height: 100,
width: 100,
),
Positioned(
top: 0,
right: 0,
bottom: 0,
left: 0,
child: ClipPath(
clipper: CustomDraw2(),
child: Container(
color: Colors.red,
child: Icon(
Icons.check,
color: Colors.white,
),
),
),
),
Positioned(
top: 4,
right: 4,
child: Icon(
Icons.check,
color: Colors.white,
),
),
],
),
)
Try below code hope its help to you, I have try this using rotated_corner_decoration
package
Widget:
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
side: const BorderSide(color: Colors.blue)),
child: Container(
height: 150,
width: 200,
padding: const EdgeInsets.all(12),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: const [
SizedBox(height: 20,),
Text('\$125',style: TextStyle(fontSize: 30,color: Colors.blue),),
Text('Annually',style: TextStyle(fontSize: 15),),
Text('Plan',style: TextStyle(fontSize: 15),),
],
),
foregroundDecoration: const RotatedCornerDecoration(
color: Colors.blue,
geometry: BadgeGeometry(width: 48, height: 48),
textSpan: TextSpan(
text: '✔',
style: TextStyle(
fontSize: 10,
letterSpacing: 1,
fontWeight: FontWeight.bold,
shadows: [BoxShadow(color: Colors.yellowAccent, blurRadius: 4)],
),
),
),
),
),
Result