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.
		
		
		
		
		
			
		
			
	
	
		
			83 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			Dart
		
	
		
		
			
		
	
	
			83 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			Dart
		
	
| 
											2 months ago
										 | import 'package:flutter/material.dart'; | ||
|  | import 'package:hmg_patient_app_new/core/app_assets.dart'; | ||
|  | import 'package:hmg_patient_app_new/core/app_export.dart'; | ||
|  | import 'package:hmg_patient_app_new/core/utils/utils.dart'; | ||
|  | import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; | ||
|  | import 'package:hmg_patient_app_new/presentation/lab/search_lab_report.dart'; | ||
|  | import 'package:hmg_patient_app_new/theme/colors.dart'; | ||
|  | 
 | ||
|  | void showCommonBottomSheet(BuildContext context, {required Widget child, required VoidCallback callBackFunc, String? title, required double height, bool isCloseButtonVisible = true}) { | ||
|  |   showModalBottomSheet<String>( | ||
|  |       context: context, | ||
|  |       isScrollControlled: true, | ||
|  |       backgroundColor: AppColors.scaffoldBgColor, | ||
|  |       builder: (BuildContext context) { | ||
|  |         return Container( | ||
|  |           height: height, | ||
|  |           decoration: const BoxDecoration( | ||
|  |             borderRadius: BorderRadius.vertical(top: Radius.circular(20)), | ||
|  |           ), | ||
|  |           child: ButtonSheetContent( | ||
|  |             title: title!, | ||
|  |             isCloseButtonVisible: isCloseButtonVisible, | ||
|  |             child: child, | ||
|  |           ), | ||
|  |         ); | ||
|  |       }).then((value) { | ||
|  |     callBackFunc(); | ||
|  |   }); | ||
|  | } | ||
|  | 
 | ||
|  | class ButtonSheetContent extends StatelessWidget { | ||
|  |   final Widget child; | ||
|  |   final String title; | ||
|  |   final bool isCloseButtonVisible; | ||
|  | 
 | ||
|  |   const ButtonSheetContent({super.key, required this.child, required this.isCloseButtonVisible, required this.title}); | ||
|  | 
 | ||
|  |   @override | ||
|  |   Widget build(BuildContext context) { | ||
|  |     return   Column( | ||
|  |         crossAxisAlignment: CrossAxisAlignment.start, | ||
|  |         children: [ | ||
|  |           SizedBox(height: 20.h,), | ||
|  |           Center( | ||
|  |             child: Container( | ||
|  |               margin: const EdgeInsets.only(top: 18, bottom: 12), | ||
|  |               height: 4, | ||
|  |               width: 40.h, | ||
|  |               decoration: BoxDecoration( | ||
|  |                 color: Colors.grey[400], | ||
|  |                 borderRadius: BorderRadius.circular(2), | ||
|  |               ), | ||
|  |             ), | ||
|  |           ), | ||
|  | 
 | ||
|  |           // Close button
 | ||
|  |           isCloseButtonVisible | ||
|  |               ?   Padding( | ||
|  |     padding: EdgeInsets.symmetric(horizontal: 16), child: Utils.buildSvgWithAssets(    icon: AppAssets.closeBottomNav, | ||
|  |                       width: 32, | ||
|  |                       height: 32).onPress((){ | ||
|  |                         Navigator.of(context).pop(); | ||
|  |                       }), | ||
|  |                 ) | ||
|  |               : SizedBox(), | ||
|  | 
 | ||
|  |           SizedBox(height: 20,), | ||
|  |           Padding( | ||
|  |             padding: EdgeInsets.symmetric(horizontal: 16), | ||
|  |             child: Text( | ||
|  |               title, | ||
|  |               style: TextStyle(fontSize: 27.h, fontWeight: FontWeight.bold), | ||
|  |             ), | ||
|  |           ), | ||
|  |           const SizedBox(height: 16), | ||
|  | 
 | ||
|  |     Expanded(child:  child) | ||
|  |         ], | ||
|  |       ); | ||
|  | 
 | ||
|  |   } | ||
|  | } |