68 lines
1.6 KiB
Dart
68 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({
|
|
required this.isSelected,
|
|
required this.label,
|
|
required this.tap,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return CustomPaint(
|
|
painter: isSelected ? CurvedBottomPainter() : null,
|
|
child: GestureDetector(
|
|
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),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
onTap: tap,
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|