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.
		
		
		
		
		
			
		
			
				
	
	
		
			73 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			Dart
		
	
			
		
		
	
	
			73 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			Dart
		
	
| import 'package:flutter/material.dart';
 | |
| import 'package:hmg_patient_app_new/core/enums.dart';
 | |
| import 'package:hmg_patient_app_new/core/utils/utils.dart';
 | |
| import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
 | |
| import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
 | |
| 
 | |
| class CustomChipWidget extends StatelessWidget {
 | |
|   final ChipTypeEnum chipType;
 | |
|   final String chipText;
 | |
|   final String? iconAsset;
 | |
|   final VoidCallback? onTap;
 | |
|   final bool isSelected;
 | |
|   final double borderRadius;
 | |
|   final EdgeInsetsGeometry padding;
 | |
| 
 | |
|   const CustomChipWidget({
 | |
|     super.key,
 | |
|     required this.chipType,
 | |
|     required this.chipText,
 | |
|     this.iconAsset,
 | |
|     this.onTap,
 | |
|     this.isSelected = false,
 | |
|     this.borderRadius = 12,
 | |
|     this.padding = const EdgeInsets.all(8),
 | |
|   });
 | |
| 
 | |
|   @override
 | |
|   Widget build(BuildContext context) {
 | |
|     final hasIcon = iconAsset != null;
 | |
|     final hasOnTap = onTap != null || hasIcon;
 | |
| 
 | |
|     return Container(
 | |
|       decoration: BoxDecoration(
 | |
|         borderRadius: BorderRadius.circular(borderRadius),
 | |
|         color: isSelected ? chipType.color : chipType.backgroundColor,
 | |
|         border: Border.all(
 | |
|           color: chipType.color,
 | |
|           width: isSelected ? 0 : 1,
 | |
|         ),
 | |
|       ),
 | |
|       child: InkWell(
 | |
|         onTap: hasOnTap ? onTap : null,
 | |
|         borderRadius: BorderRadius.circular(borderRadius),
 | |
|         child: Container(
 | |
|           padding: padding,
 | |
|           decoration: BoxDecoration(
 | |
|             borderRadius: BorderRadius.circular(borderRadius),
 | |
|           ),
 | |
|           child: Row(
 | |
|             mainAxisSize: MainAxisSize.min,
 | |
|             children: [
 | |
|               if (iconAsset != null) ...[
 | |
|                 Utils.buildSvgWithAssets(icon: iconAsset!),
 | |
|                 const SizedBox(width: 6),
 | |
|               ],
 | |
|               Text(
 | |
|                 chipText.toUpperCase(),
 | |
|                 style: context.dynamicTextStyle(
 | |
|                   fontWeight: FontWeight.w500,
 | |
|                   fontSize: 14,
 | |
|                   color: isSelected ? Colors.white : chipType.color,
 | |
|                   letterSpacing: 0.1,
 | |
|                   isLanguageSwitcher: true,
 | |
|                 ),
 | |
|               ),
 | |
|             ],
 | |
|           ),
 | |
|         ),
 | |
|       ),
 | |
|     );
 | |
|   }
 | |
| }
 |