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.
HMG_Patient_App_New/lib/widgets/attachment_options.dart

124 lines
4.2 KiB
Dart

import 'package:easy_localization/easy_localization.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.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/generated/locale_keys.g.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);
late AppState? appState;
@override
Widget build(BuildContext context) {
appState = getIt.get<AppState>();
return SizedBox(
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// "Upload Attachment".toSectionHeading(),
// "Select from gallery or open camera".toText11(isBold: true),
checkInOptionCard(
AppAssets.ask_doctor_icon,
LocaleKeys.openCamera.tr(context: context),
"",
).onPress(() {
onCameraTap();
}),
SizedBox(height: 16.h),
checkInOptionCard(
AppAssets.ask_doctor_icon,
LocaleKeys.openGallery.tr(context: context),
"",
).onPress(() {
onGalleryTap();
}),
SizedBox(height: 16.h),
checkInOptionCard(
AppAssets.ask_doctor_icon,
LocaleKeys.openFiles.tr(context: context),
"",
).onPress(() {
onFilesTap();
}),
],
).paddingOnly(),
);
}
Widget checkInOptionCard(String icon, String title, String subTitle) {
return Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 20.r,
hasShadow: false,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Utils.buildSvgWithAssets(icon: icon, width: 24.h, height: 24.h, fit: BoxFit.fill, iconColor: AppColors.textColor),
// SizedBox(height: 16.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
title.toText16(isBold: true, color: AppColors.textColor),
// subTitle.toText12(isBold: true, color: AppColors.greyTextColor),
],
),
),
Transform.flip(
flipX: appState!.isArabic(),
child: Utils.buildSvgWithAssets(
icon: AppAssets.forward_arrow_icon_small,
iconColor: AppColors.blackColor,
width: 18.h,
height: 13.h,
fit: BoxFit.contain,
),
),
],
),
],
).paddingAll(16.h),
);
}
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/svg/$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),
),
);
}
}