FreekakeApp/lib/components/curve_bottom_border_tab.dart
2025-05-07 13:56:17 +07:00

69 lines
1.6 KiB
Dart

import 'package:flutter/material.dart';
class CurvedBottomBorderTab extends StatelessWidget {
final bool isSelected;
final String label;
final VoidCallback tap;
const CurvedBottomBorderTab({
super.key,
required this.isSelected,
required this.label,
required this.tap,
});
@override
Widget build(BuildContext context) {
return CustomPaint(
painter: isSelected ? CurvedBottomPainter() : null,
child: GestureDetector(
onTap: tap,
child: Container(
width: 110,
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
color: Colors.transparent,
child: Center(
child: Text(
label,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color:
isSelected
? const Color.fromARGB(255, 255, 255, 255)
: const Color.fromARGB(255, 197, 194, 194),
),
),
),
),
),
);
}
}
class CurvedBottomPainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
final paint =
Paint()
..color = Colors.white
..strokeWidth = 2
..style = PaintingStyle.stroke;
final path =
Path()
..moveTo(0, size.height)
..quadraticBezierTo(
size.width / 2,
size.height - 8,
size.width,
size.height,
);
canvas.drawPath(path, paint);
}
@override
bool shouldRepaint(CustomPainter oldDelegate) => false;
}