tab menu color
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
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;
|
||||
}
|
||||
@@ -28,7 +28,7 @@ class TabMenuButton extends StatelessWidget {
|
||||
height: 20,
|
||||
colorFilter: ColorFilter.mode(
|
||||
isSelected
|
||||
? const Color.fromARGB(255, 106, 24, 207)
|
||||
? const Color.fromARGB(255, 10, 144, 16)
|
||||
: Colors.white,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
@@ -43,13 +43,16 @@ class TabMenuButton extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
isSelected
|
||||
? const Color.fromARGB(255, 199, 204, 212).withOpacity(0)
|
||||
: Colors.transparent,
|
||||
? const Color.fromARGB(255, 10, 144, 16).withOpacity(0)
|
||||
: const Color.fromARGB(0, 0, 0, 0),
|
||||
|
||||
border:
|
||||
isSelected
|
||||
? const Border(
|
||||
top: BorderSide(color: Colors.white, width: 2),
|
||||
bottom: BorderSide(
|
||||
color: Color.fromARGB(255, 255, 255, 255),
|
||||
width: 2,
|
||||
),
|
||||
)
|
||||
: null,
|
||||
// borderRadius: BorderRadius.circular(20),
|
||||
@@ -63,7 +66,7 @@ class TabMenuButton extends StatelessWidget {
|
||||
color:
|
||||
isSelected
|
||||
? const Color.fromARGB(255, 255, 255, 255)
|
||||
: const Color.fromARGB(255, 0, 0, 0),
|
||||
: const Color.fromARGB(255, 197, 194, 194),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user