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.
		
		
		
		
		
			
		
			
	
	
		
			90 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			Dart
		
	
		
		
			
		
	
	
			90 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			Dart
		
	
| 
								 
											2 months ago
										 
									 | 
							
								import 'package:hmg_patient_app_new/extensions/int_extensions.dart';
							 | 
						||
| 
								 | 
							
								import 'package:flutter/material.dart';
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								void showMyBottomSheet(BuildContext context, {required Widget child, required VoidCallback callBackFunc, String? type}) {
							 | 
						||
| 
								 | 
							
								  showModalBottomSheet<String>(
							 | 
						||
| 
								 | 
							
								    context: context,
							 | 
						||
| 
								 | 
							
								    isScrollControlled: true,
							 | 
						||
| 
								 | 
							
								    backgroundColor: Colors.transparent,
							 | 
						||
| 
								 | 
							
								    builder: (BuildContext context) {
							 | 
						||
| 
								 | 
							
								      return Container(
							 | 
						||
| 
								 | 
							
								      constraints:  BoxConstraints(
							 | 
						||
| 
								 | 
							
								      maxHeight: type =='CONTINUE_ACTION' ? MediaQuery.of(context).size.height *.75 :  double.infinity,),
							 | 
						||
| 
								 | 
							
								        decoration: const BoxDecoration(
							 | 
						||
| 
								 | 
							
								          color: Colors.white,
							 | 
						||
| 
								 | 
							
								          borderRadius: BorderRadius.only(
							 | 
						||
| 
								 | 
							
								            topRight: Radius.circular(25),
							 | 
						||
| 
								 | 
							
								            topLeft: Radius.circular(25),
							 | 
						||
| 
								 | 
							
								          ),
							 | 
						||
| 
								 | 
							
								        ),
							 | 
						||
| 
								 | 
							
								        padding: MediaQuery.of(context).viewInsets,
							 | 
						||
| 
								 | 
							
								        clipBehavior: Clip.antiAlias,
							 | 
						||
| 
								 | 
							
								        child:SingleChildScrollView(child: Column(
							 | 
						||
| 
								 | 
							
								          mainAxisAlignment: MainAxisAlignment.center,
							 | 
						||
| 
								 | 
							
								          mainAxisSize: MainAxisSize.min,
							 | 
						||
| 
								 | 
							
								          children: <Widget>[
							 | 
						||
| 
								 | 
							
								            13.height,
							 | 
						||
| 
								 | 
							
								            Container(
							 | 
						||
| 
								 | 
							
								              height: 6,
							 | 
						||
| 
								 | 
							
								              width: 60,
							 | 
						||
| 
								 | 
							
								              decoration: const BoxDecoration(
							 | 
						||
| 
								 | 
							
								                color: Color(0xff9A9A9A),
							 | 
						||
| 
								 | 
							
								                borderRadius: BorderRadius.all(
							 | 
						||
| 
								 | 
							
								                  Radius.circular(20),
							 | 
						||
| 
								 | 
							
								                ),
							 | 
						||
| 
								 | 
							
								              ),
							 | 
						||
| 
								 | 
							
								            ),
							 | 
						||
| 
								 | 
							
								            8.height,
							 | 
						||
| 
								 | 
							
								            child,
							 | 
						||
| 
								 | 
							
								          ],
							 | 
						||
| 
								 | 
							
								        )),
							 | 
						||
| 
								 | 
							
								      );
							 | 
						||
| 
								 | 
							
								    },
							 | 
						||
| 
								 | 
							
								  ).then((value) {
							 | 
						||
| 
								 | 
							
								    // print("BACK FROM DELEGATE!!!!");
							 | 
						||
| 
								 | 
							
								    // print("value: $value");
							 | 
						||
| 
								 | 
							
								    if (value == "delegate_reload") {
							 | 
						||
| 
								 | 
							
								      callBackFunc();
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								  });
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								class BottomSheetItem extends StatelessWidget {
							 | 
						||
| 
								 | 
							
								  final Function onTap;
							 | 
						||
| 
								 | 
							
								  final IconData icon;
							 | 
						||
| 
								 | 
							
								  final String title;
							 | 
						||
| 
								 | 
							
								  final Color color;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  const BottomSheetItem({Key? key, required this.onTap, required this.title, required this.icon, this.color = Colors.black}) : super(key: key);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  @override
							 | 
						||
| 
								 | 
							
								  Widget build(BuildContext context) {
							 | 
						||
| 
								 | 
							
								    return InkWell(
							 | 
						||
| 
								 | 
							
								      onTap: () {
							 | 
						||
| 
								 | 
							
								        if (onTap != null) {
							 | 
						||
| 
								 | 
							
								          Navigator.pop(context);
							 | 
						||
| 
								 | 
							
								          onTap();
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								      },
							 | 
						||
| 
								 | 
							
								      child: Padding(
							 | 
						||
| 
								 | 
							
								        padding: EdgeInsets.symmetric(horizontal: 18.0, vertical: 18.0),
							 | 
						||
| 
								 | 
							
								        child: Row(
							 | 
						||
| 
								 | 
							
								          children: <Widget>[
							 | 
						||
| 
								 | 
							
								            if (icon != null)
							 | 
						||
| 
								 | 
							
								              Icon(
							 | 
						||
| 
								 | 
							
								                icon,
							 | 
						||
| 
								 | 
							
								                color: color,
							 | 
						||
| 
								 | 
							
								                size: 18.0,
							 | 
						||
| 
								 | 
							
								              ),
							 | 
						||
| 
								 | 
							
								            if (icon != null) SizedBox(width: 24.0),
							 | 
						||
| 
								 | 
							
								            Text(
							 | 
						||
| 
								 | 
							
								              title ?? "",
							 | 
						||
| 
								 | 
							
								              style: TextStyle(color: color),
							 | 
						||
| 
								 | 
							
								            ),
							 | 
						||
| 
								 | 
							
								          ],
							 | 
						||
| 
								 | 
							
								        ),
							 | 
						||
| 
								 | 
							
								      ),
							 | 
						||
| 
								 | 
							
								    );
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								}
							 |