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.
		
		
		
		
		
			
		
			
	
	
		
			152 lines
		
	
	
		
			5.1 KiB
		
	
	
	
		
			Dart
		
	
		
		
			
		
	
	
			152 lines
		
	
	
		
			5.1 KiB
		
	
	
	
		
			Dart
		
	
|   
											2 months ago
										 | import 'package:hmg_patient_app_new/theme/colors.dart'; | ||
|  | import 'package:flutter/material.dart'; | ||
|  | import 'package:flutter/widgets.dart'; | ||
|  | import 'package:hmg_patient_app_new/extensions/int_extensions.dart'; | ||
|  | import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; | ||
|  | import 'package:shimmer/shimmer.dart'; | ||
|  | import 'package:sizer/sizer.dart'; | ||
|  | 
 | ||
|  | extension WidgetExtensions on Widget { | ||
|  |   Widget onPress(VoidCallback onTap) => InkWell(onTap: onTap, child: this); | ||
|  | 
 | ||
|  |   Widget get expanded => Expanded(child: this); | ||
|  | 
 | ||
|  |   Widget get center => Center(child: this); | ||
|  | 
 | ||
|  |   Widget circle(double _value) => ClipRRect(borderRadius: BorderRadius.circular(_value), child: this); | ||
|  | 
 | ||
|  |   Widget paddingAll(double _value) => Padding(padding: EdgeInsets.all(_value), child: this); | ||
|  | 
 | ||
|  |   Widget paddingSymmetrical(double horizontal, double vertical) => Padding(padding: EdgeInsets.symmetric(horizontal: horizontal, vertical: vertical), child: this); | ||
|  | 
 | ||
|  |   Widget paddingOnly({double left = 0.0, double right = 0.0, double top = 0.0, double bottom = 0.0}) => | ||
|  |       Padding(padding: EdgeInsets.only(left: left, right: right, top: top, bottom: bottom), child: this); | ||
|  | 
 | ||
|  |   Widget toExpanded({int flex = 1}) => Expanded(flex: flex, child: this); | ||
|  | 
 | ||
|  |   Widget toShimmer({bool isShow = true, bool isTransparent = false}) => isShow | ||
|  |       ? Shimmer.fromColors( | ||
|  |           baseColor: Color(0xffb9bebe), | ||
|  |           highlightColor: Colors.white, | ||
|  |           child: Container( | ||
|  |             color: isTransparent ? Colors.transparent : Colors.white.withOpacity(0.3), | ||
|  |             child: this, | ||
|  |           ), | ||
|  |         ) | ||
|  |       : Container( | ||
|  |           child: this, | ||
|  |         ); | ||
|  | 
 | ||
|  |   Widget animatedSwither() => AnimatedSwitcher( | ||
|  |         duration: const Duration(milliseconds: 500), | ||
|  |         // transitionBuilder: (Widget child, Animation<double> animation) {
 | ||
|  |         //   return ScaleTransition(scale: animation, child: child);
 | ||
|  |         // },
 | ||
|  |         switchInCurve: Curves.linearToEaseOut, | ||
|  |         switchOutCurve: Curves.linearToEaseOut, | ||
|  |         child: this, | ||
|  |       ); | ||
|  | 
 | ||
|  |   Widget objectContainerView({String title = "", String note = "", bool disablePadding = false, double radius = 15}) { | ||
|  |     return Container( | ||
|  |       padding: disablePadding ? EdgeInsets.zero : const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14), | ||
|  |       decoration: BoxDecoration( | ||
|  |         color: Colors.white, | ||
|  |         borderRadius: BorderRadius.circular(radius), | ||
|  |         boxShadow: [ | ||
|  |           BoxShadow( | ||
|  |             color: const Color(0xff000000).withOpacity(.15), | ||
|  |             blurRadius: 26, | ||
|  |             offset: const Offset(0, -3), | ||
|  |           ), | ||
|  |         ], | ||
|  |       ), | ||
|  |       alignment: Alignment.center, | ||
|  |       child: Column( | ||
|  |         crossAxisAlignment: CrossAxisAlignment.start, | ||
|  |         mainAxisSize: MainAxisSize.min, | ||
|  |         children: [ | ||
|  |           if (title.isNotEmpty) title.toText16(), | ||
|  |           if (title.isNotEmpty) 12.height, | ||
|  |           this, | ||
|  |           if (note.isNotEmpty) note.toText11(), | ||
|  |         ], | ||
|  |       ), | ||
|  |     ); | ||
|  |   } | ||
|  | 
 | ||
|  |   Widget objectContainerBorderView( | ||
|  |       {String title = "", String note = "", bool disablePadding = false, double radius = 20, Color? color, Color borderColor = buttonColor, bool disableWidth = false, bool isAlignment = false}) { | ||
|  |     return Container( | ||
|  |       padding: disablePadding ? EdgeInsets.zero : const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14), | ||
|  |       decoration: BoxDecoration( | ||
|  |         borderRadius: BorderRadius.all( | ||
|  |           Radius.circular(radius), | ||
|  |         ), | ||
|  |         color: color, | ||
|  |         border: Border.all( | ||
|  |           color: borderColor, | ||
|  |           width: disableWidth ? 2 : 1, | ||
|  |         ), | ||
|  |       ), | ||
|  |       alignment: isAlignment ? Alignment.center : null, | ||
|  |       child: Column( | ||
|  |         crossAxisAlignment: CrossAxisAlignment.start, | ||
|  |         mainAxisSize: MainAxisSize.min, | ||
|  |         children: [ | ||
|  |           if (title.isNotEmpty) title.toText16(), | ||
|  |           if (title.isNotEmpty) 12.height, | ||
|  |           this, | ||
|  |           if (note.isNotEmpty) note.toText11(), | ||
|  |         ], | ||
|  |       ), | ||
|  |     ); | ||
|  |   } | ||
|  | } | ||
|  | 
 | ||
|  | //Height Spacers in percentages
 | ||
|  | Widget heightSpacer02per() => SizedBox(height: 0.2.h); | ||
|  | 
 | ||
|  | Widget heightSpacer04per() => SizedBox(height: 0.4.h); | ||
|  | 
 | ||
|  | Widget heightSpacer06per() => SizedBox(height: 0.6.h); | ||
|  | 
 | ||
|  | Widget heightSpacer08per() => SizedBox(height: 0.8.h); | ||
|  | 
 | ||
|  | Widget heightSpacer1per() => SizedBox(height: 1.h); | ||
|  | 
 | ||
|  | Widget heightSpacer2per() => SizedBox(height: 2.h); | ||
|  | 
 | ||
|  | Widget heightSpacer3per() => SizedBox(height: 3.h); | ||
|  | 
 | ||
|  | Widget heightSpacer4per() => SizedBox(height: 4.h); | ||
|  | 
 | ||
|  | Widget heightSpacer5per() => SizedBox(height: 5.h); | ||
|  | 
 | ||
|  | Widget heightSpacer8per() => SizedBox(height: 8.h); | ||
|  | 
 | ||
|  | Widget heightSpacer10per() => SizedBox(height: 10.h); | ||
|  | 
 | ||
|  | Widget heightSpacer15per() => SizedBox(height: 15.h); | ||
|  | 
 | ||
|  | Widget heightSpacer20per() => SizedBox(height: 20.h); | ||
|  | 
 | ||
|  | //Width Spacers in percentages
 | ||
|  | Widget widthSpacer02perc() => SizedBox(height: 0.2.w); | ||
|  | 
 | ||
|  | Widget widthSpacer04perc() => SizedBox(height: 0.4.w); | ||
|  | 
 | ||
|  | Widget widthSpacer06perc() => SizedBox(height: 0.6.w); | ||
|  | 
 | ||
|  | Widget widthSpacer08per() => SizedBox(height: 0.8.w); | ||
|  | 
 | ||
|  | Widget widthSpacer1per() => SizedBox(height: 1.w); | ||
|  | 
 | ||
|  | Widget widthSpacer2per() => SizedBox(height: 2.w); | ||
|  | 
 | ||
|  | Widget widthSpacer3per() => SizedBox(height: 3.w); | ||
|  | 
 | ||
|  | Widget widthSpacer4per() => SizedBox(height: 4.w); | ||
|  | 
 | ||
|  | Widget widthSpacer5per() => SizedBox(height: 5.w); |