Houshan-Basa/lib/ui/widgets/components/shapes/vertical_ribbon.dart

68 lines
1.8 KiB
Dart

import 'package:flutter/material.dart';
import 'package:hoshan/ui/theme/colors.dart';
import 'package:hoshan/ui/theme/text.dart';
class VerticalRibbon extends StatelessWidget {
final String text;
const VerticalRibbon({super.key, required this.text});
@override
Widget build(BuildContext context) {
return Stack(
children: [
RotatedBox(
quarterTurns: 3,
child: Container(
margin: const EdgeInsets.only(left: 1),
padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 8)
.copyWith(left: 46),
decoration: BoxDecoration(
color: AppColors.red.defaultShade,
borderRadius: BorderRadius.circular(4)),
child: Text(
text,
style: AppTextStyles.body4
.copyWith(color: Colors.white, fontWeight: FontWeight.bold),
),
),
),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: Center(
child: ClipPath(
clipper: RoundedTriangle(),
child: Container(
height: 24,
// width: 24,
decoration: const BoxDecoration(
color: Colors.white,
),
),
),
),
)
],
);
}
}
class RoundedTriangle extends CustomClipper<Path> {
@override
Path getClip(Size size) {
final Path path = Path();
path.lineTo(size.width / 2, 0);
path.lineTo(size.width, size.height);
path.lineTo(0, size.height);
path.lineTo(size.width / 2, 0);
path.close();
return path;
}
@override
bool shouldReclip(covariant CustomClipper<Path> oldClipper) {
return false;
}
}