You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
HMG_Patient_App_New/lib/widgets/chip/custom_selectable_chip.dart

56 lines
1.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_export.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
class CustomSelectableChip extends StatelessWidget {
final String label;
final bool selected;
final VoidCallback? onTap;
final Color activeColor;
final Color activeTextColor;
final Color inactiveBorderColor;
final Color inactiveTextColor;
const CustomSelectableChip({
super.key,
required this.label,
required this.selected,
this.onTap,
this.activeColor = const Color(0xFFD03C32), // red accent
this.activeTextColor = Colors.white,
this.inactiveBorderColor = const Color(0xFFE8E8E8),
this.inactiveTextColor = const Color(0xFF222222),
});
@override
Widget build(BuildContext context) {
final double radius = 8.0;
return AnimatedContainer(
duration: const Duration(milliseconds: 180),
padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 8.h),
decoration: BoxDecoration(
color: selected ? activeColor.withValues(alpha: 0.12) : AppColors.whiteColor,
borderRadius: BorderRadius.circular(radius),
border: Border.all(
color: selected ? activeColor : inactiveBorderColor,
width: 1,
),
),
child: InkWell(
borderRadius: BorderRadius.circular(radius),
onTap: onTap,
child: Text(
label,
style: TextStyle(
fontSize: 12.f,
fontWeight: FontWeight.w500,
color: selected ? activeTextColor : inactiveTextColor,
letterSpacing: -0.02 * 18,
height: 1.0,
),
),
),
);
}
}