custom chips implemented
							parent
							
								
									1fe659bf62
								
							
						
					
					
						commit
						003a161b52
					
				| @ -0,0 +1,57 @@ | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:hmg_patient_app_new/core/app_assets.dart'; | ||||
| import 'package:hmg_patient_app_new/core/utils/size_utils.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'; | ||||
| import 'package:hmg_patient_app_new/theme/colors.dart'; | ||||
| import 'package:smooth_corner/smooth_corner.dart'; | ||||
| 
 | ||||
| class AppCustomChipWidget extends StatelessWidget { | ||||
|   AppCustomChipWidget({ | ||||
|     super.key, | ||||
|     required this.labelText, | ||||
|     this.textColor = AppColors.textColor, | ||||
|     this.backgroundColor = AppColors.greyColor, | ||||
|     this.iconSize = 12, | ||||
|     this.icon = "", | ||||
|     this.iconColor = AppColors.textColor, | ||||
|   }); | ||||
| 
 | ||||
|   String? labelText; | ||||
|   Color? textColor; | ||||
|   Color? backgroundColor; | ||||
|   num iconSize; | ||||
|   String icon; | ||||
|   Color iconColor; | ||||
| 
 | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return ChipTheme( | ||||
|       data: ChipThemeData( | ||||
|         padding: EdgeInsets.all(0.0), | ||||
|         shape: SmoothRectangleBorder( | ||||
|           side: BorderSide( | ||||
|             width: 0.0, | ||||
|             color: Colors.transparent, // Crucially, set color to transparent | ||||
|             style: BorderStyle.none, | ||||
|           ), | ||||
|           borderRadius: BorderRadius.circular(8.0), // Apply a border radius of 16.0 | ||||
|         ), | ||||
|       ), | ||||
|       child: icon.isNotEmpty | ||||
|           ? Chip( | ||||
|               avatar: icon.isNotEmpty ? Utils.buildSvgWithAssets(icon: icon, width: iconSize.h, height: iconSize.h, iconColor: iconColor) : SizedBox.shrink(), | ||||
|               label: labelText!.toText10(weight: FontWeight.w500, letterSpacing: -0.64, color: textColor), | ||||
|               padding: EdgeInsets.all(0.0), | ||||
|               labelPadding: EdgeInsets.only(left: -4.h, right: 8.h), | ||||
|               backgroundColor: backgroundColor, | ||||
|             ) | ||||
|           : Chip( | ||||
|               label: labelText!.toText10(weight: FontWeight.w500, letterSpacing: -0.64, color: textColor), | ||||
|               padding: EdgeInsets.all(0.0), | ||||
|               backgroundColor: backgroundColor, | ||||
|             ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
					Loading…
					
					
				
		Reference in New Issue
	
	 Haroon Amjad
						Haroon Amjad