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.
		
		
		
		
		
			
		
			
				
	
	
		
			61 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Dart
		
	
			
		
		
	
	
			61 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			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:flutter/material.dart';
 | |
| import 'package:flutter_svg/flutter_svg.dart';
 | |
| 
 | |
| class AttachmentOptions extends StatelessWidget {
 | |
|   VoidCallback onCameraTap;
 | |
|   VoidCallback onGalleryTap;
 | |
|   VoidCallback onFilesTap;
 | |
|   bool showFilesOption;
 | |
| 
 | |
|   AttachmentOptions({Key? key, required this.onCameraTap, required this.onGalleryTap, required this.onFilesTap, this.showFilesOption = true}) : super(key: key);
 | |
| 
 | |
|   @override
 | |
|   Widget build(BuildContext context) {
 | |
|     return SizedBox(
 | |
|       width: double.infinity,
 | |
|       child: Column(
 | |
|         crossAxisAlignment: CrossAxisAlignment.start,
 | |
|         children: [
 | |
|           "Upload Attachment".toSectionHeading(),
 | |
|           "Select from gallery or open camera".toText11(weight: FontWeight.w500),
 | |
|           GridView(
 | |
|             gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 105 / 105, crossAxisSpacing: 9, mainAxisSpacing: 9),
 | |
|             physics: const NeverScrollableScrollPhysics(),
 | |
|             padding: const EdgeInsets.only(top: 21, bottom: 14),
 | |
|             shrinkWrap: true,
 | |
|             children: [
 | |
|               itemView("open_camera.svg", "Open\nCamera", onCameraTap),
 | |
|               itemView("gallery.svg", "Upload from\nGallery", onGalleryTap),
 | |
|               if (showFilesOption) itemView("files.svg", "Upload from\nFiles", onFilesTap),
 | |
|             ],
 | |
|           )
 | |
|         ],
 | |
|       ).paddingOnly(left: 21, right: 21, bottom: 21),
 | |
|     );
 | |
|   }
 | |
| 
 | |
|   Widget itemView(String icon, String title, VoidCallback onTap) {
 | |
|     return InkWell(
 | |
|       onTap: onTap,
 | |
|       child: Column(
 | |
|         crossAxisAlignment: CrossAxisAlignment.start,
 | |
|         mainAxisAlignment: MainAxisAlignment.spaceBetween,
 | |
|         children: [
 | |
|           SvgPicture.asset(
 | |
|             "assets/images/$icon",
 | |
|           ),
 | |
|           title.toText11(isBold: true),
 | |
|         ],
 | |
|       ).paddingOnly(left: 13, right: 13, top: 16, bottom: 12).expanded.objectContainerBorderView(
 | |
|             disablePadding: true,
 | |
|             radius: 10,
 | |
|             color: AppColors.greyF7Color.withOpacity(.48),
 | |
|             borderColor: AppColors.lightGreyEFColor.withOpacity(.48),
 | |
|           ),
 | |
|     );
 | |
|   }
 | |
| }
 |