Merge branch 'master' into haroon_dev

# Conflicts:
#	lib/core/app_assets.dart
#	lib/presentation/prescriptions/prescription_detail_page.dart
pull/21/head
haroon amjad 2 months ago
commit 851bd569b4

@ -0,0 +1,6 @@
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="40" height="40" rx="8" fill="#EFEFF0"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.0002 20.25C18.2082 20.25 16.7502 18.792 16.7502 17C16.7502 15.208 18.2082 13.75 20.0002 13.75C21.7922 13.75 23.2502 15.208 23.2502 17C23.2502 18.792 21.7922 20.25 20.0002 20.25ZM20.0002 15.25C19.0352 15.25 18.2502 16.035 18.2502 17C18.2502 17.965 19.0352 18.75 20.0002 18.75C20.9652 18.75 21.7502 17.965 21.7502 17C21.7502 16.035 20.9652 15.25 20.0002 15.25Z" fill="#2E3039"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.2232 26.035C18.7032 26.496 19.3342 26.75 20.0002 26.75C20.6662 26.75 21.2972 26.496 21.7772 26.034C22.0112 25.809 22.2512 25.581 22.4942 25.351C25.4901 22.5091 29.2201 18.9708 27.1592 14.016C25.9742 11.165 23.0962 9.25 20.0002 9.25C16.9042 9.25 14.0272 11.165 12.8422 14.016C10.7882 18.953 14.4872 22.474 17.4592 25.303L17.4879 25.3304C17.7361 25.5671 17.9815 25.801 18.2232 26.035ZM14.2272 14.592C15.1822 12.294 17.5022 10.75 20.0002 10.75C22.4982 10.75 24.8192 12.294 25.7752 14.592C27.4392 18.594 24.4012 21.476 21.4622 24.263C21.4065 24.316 21.3508 24.3688 21.2954 24.4216C21.107 24.6005 20.9203 24.7779 20.7372 24.954C20.5382 25.145 20.2762 25.25 20.0002 25.25C19.7242 25.25 19.4622 25.144 19.2652 24.955C19.0132 24.711 18.7552 24.465 18.4932 24.216C15.5813 21.4441 12.5693 18.5768 14.2272 14.592Z" fill="#2E3039"/>
<path d="M22.7182 30.75L17.2821 30.75C14.0511 30.75 12.4292 30.75 11.6312 29.566C11.5542 29.451 11.4871 29.332 11.4321 29.212C10.8225 27.9067 11.8042 26.5074 13.1621 24.572L13.1642 24.569C13.4022 24.23 13.8701 24.148 14.2091 24.386C14.5481 24.624 14.6302 25.092 14.3922 25.431C13.3132 26.969 12.5662 28.096 12.7942 28.583C12.8182 28.635 12.8451 28.682 12.8761 28.729C13.2271 29.25 14.8401 29.25 17.2821 29.25L22.7182 29.25C25.1601 29.25 26.7732 29.25 27.1252 28.728C27.1562 28.682 27.1832 28.635 27.2042 28.588C27.4342 28.096 26.6872 26.969 25.6082 25.431C25.3702 25.092 25.4522 24.624 25.7912 24.386C26.1302 24.148 26.5981 24.23 26.8361 24.569C28.1951 26.506 29.1772 27.906 28.5662 29.217C28.5132 29.332 28.4472 29.451 28.3702 29.565C27.5712 30.75 25.9492 30.75 22.7182 30.75Z" fill="#2E3039"/>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

@ -0,0 +1,8 @@
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="40" height="40" rx="8" fill="#EFEFF0"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.0686 9.25H16.9572C15.3515 9.24998 14.0704 9.24997 13.0656 9.38481C12.0278 9.52407 11.1733 9.81941 10.4972 10.4943C9.82085 11.1694 9.5247 12.0229 9.38509 13.0594C9.24997 14.0626 9.24998 15.3416 9.25 16.9442L9.25 23.0558C9.24998 24.6583 9.24997 25.9374 9.38509 26.9406C9.5247 27.9771 9.82085 28.8306 10.4972 29.5057C11.1733 30.1806 12.0278 30.4759 13.0656 30.6152C14.0704 30.75 15.3515 30.75 16.9572 30.75H17.0686C18.6742 30.75 19.9554 30.75 20.9602 30.6152C21.9979 30.4759 22.8525 30.1806 23.5286 29.5057C24.4805 28.5556 24.6872 27.2403 24.7495 25.5273C24.7646 25.1133 24.4412 24.7655 24.0273 24.7505C23.6133 24.7354 23.2655 25.0588 23.2505 25.4727C23.1882 27.1846 22.9697 27.9442 22.4689 28.4441C22.1181 28.7943 21.6326 29.0115 20.7607 29.1285C19.8673 29.2484 18.687 29.25 17.0129 29.25C15.3388 29.25 14.1585 29.2484 13.2651 29.1285C12.3932 29.0115 11.9077 28.7943 11.5569 28.4441C11.2062 28.094 10.9888 27.61 10.8717 26.7403C10.7516 25.8489 10.75 24.6712 10.75 23L10.75 17C10.75 15.3288 10.7516 14.1511 10.8717 13.2597C10.9888 12.39 11.2062 11.906 11.5569 11.5559C11.9077 11.2057 12.3932 10.9885 13.2651 10.8715C13.3037 10.8663 13.3428 10.8613 13.3825 10.8566C13.4624 11.3334 13.5361 11.7509 13.636 12.0912C13.7551 12.497 13.9337 12.8781 14.2775 13.1831C14.6331 13.4985 15.0426 13.6311 15.4813 13.6917C15.8948 13.7489 16.4052 13.75 17.0001 13.75C17.5948 13.75 18.1053 13.7489 18.5188 13.6917C18.9575 13.6311 19.367 13.4985 19.7226 13.1831C20.0664 12.8781 20.245 12.497 20.3641 12.0912C20.4642 11.7502 20.538 11.3317 20.6181 10.8536C20.6664 10.8593 20.7139 10.8652 20.7607 10.8715C21.6326 10.9885 22.1181 11.2057 22.4689 11.5559C22.9697 12.0558 23.1882 12.8154 23.2505 14.5273C23.2655 14.9412 23.6133 15.2646 24.0273 15.2495C24.4412 15.2345 24.7646 14.8867 24.7495 14.4727C24.6872 12.7597 24.4805 11.4444 23.5286 10.4943C22.8525 9.81941 21.9979 9.52407 20.9602 9.38481C19.9554 9.24997 18.6743 9.24998 17.0686 9.25ZM19.1118 10.7642C18.5114 10.7504 17.8195 10.75 17.0129 10.75C16.1948 10.75 15.4947 10.7504 14.8884 10.7648C14.9568 11.1659 15.0107 11.4487 15.0753 11.6688C15.1519 11.9296 15.2199 12.0139 15.273 12.061C15.3314 12.1129 15.4224 12.1693 15.6866 12.2058C15.976 12.2458 16.371 12.25 17.0001 12.25C17.6291 12.25 18.0241 12.2458 18.3135 12.2058C18.5777 12.1693 18.6687 12.1129 18.7271 12.061C18.7802 12.0139 18.8482 11.9296 18.9248 11.6688C18.9894 11.4486 19.0433 11.1656 19.1118 10.7642Z" fill="#2E3039"/>
<path d="M16 26.25C15.5858 26.25 15.25 26.5858 15.25 27C15.25 27.4142 15.5858 27.75 16 27.75L18 27.75C18.4142 27.75 18.75 27.4142 18.75 27C18.75 26.5858 18.4142 26.25 18 26.25L16 26.25Z" fill="#2E3039"/>
<path d="M28.5663 14.9488C29.9102 16.2323 30.75 18.0153 30.75 19.9912C30.75 21.9671 29.9102 23.7501 28.5663 25.0336C28.2667 25.3197 27.792 25.3088 27.5059 25.0092C27.2198 24.7097 27.2307 24.2349 27.5303 23.9488C28.5981 22.929 29.25 21.53 29.25 19.9912C29.25 18.4524 28.5981 17.0534 27.5303 16.0336C27.2307 15.7475 27.2198 15.2728 27.5059 14.9732C27.792 14.6737 28.2667 14.6627 28.5663 14.9488Z" fill="#2E3039"/>
<path d="M26.518 17.1988C27.259 17.9065 27.7259 18.894 27.7259 19.9912C27.7259 21.0884 27.259 22.076 26.518 22.7836C26.2184 23.0697 25.7437 23.0588 25.4576 22.7592C25.1715 22.4597 25.1825 21.9849 25.482 21.6988C25.9469 21.2548 26.2259 20.6514 26.2259 19.9912C26.2259 19.3311 25.9469 18.7276 25.482 18.2836C25.1825 17.9975 25.1715 17.5228 25.4576 17.2232C25.7437 16.9237 26.2184 16.9127 26.518 17.1988Z" fill="#2E3039"/>
<path d="M24 19.2408C24.4142 19.2408 24.75 19.5766 24.75 19.9908V19.9998C24.75 20.414 24.4142 20.7498 24 20.7498C23.5858 20.7498 23.25 20.414 23.25 19.9998V19.9908C23.25 19.5766 23.5858 19.2408 24 19.2408Z" fill="#2E3039"/>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

@ -0,0 +1,10 @@
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="40" height="40" rx="8" fill="#EFEFF0"/>
<path d="M16.2239 11.2491C16.6376 11.2286 16.9564 10.8766 16.9359 10.4629C16.9154 10.0492 16.5634 9.73043 16.1497 9.75094C14.0291 9.85603 12.4618 10.1708 11.3163 11.3163C10.1708 12.4618 9.85603 14.0291 9.75094 16.1497C9.73043 16.5634 10.0492 16.9154 10.4629 16.9359C10.8766 16.9564 11.2286 16.6376 11.2491 16.2239C11.3521 14.145 11.6599 13.0941 12.377 12.377C13.0941 11.6599 14.145 11.3521 16.2239 11.2491Z" fill="#2E3039"/>
<path d="M23.8504 9.75094C23.4367 9.73043 23.0847 10.0492 23.0642 10.4629C23.0437 10.8766 23.3624 11.2286 23.7761 11.2491C25.855 11.3521 26.906 11.6599 27.623 12.377C28.3401 13.0941 28.6479 14.145 28.7509 16.2239C28.7714 16.6376 29.1234 16.9564 29.5371 16.9359C29.9508 16.9154 30.2696 16.5634 30.2491 16.1497C30.144 14.0291 29.8292 12.4618 28.6837 11.3163C27.5382 10.1708 25.9709 9.85603 23.8504 9.75094Z" fill="#2E3039"/>
<path d="M11.2491 23.7761C11.2286 23.3624 10.8766 23.0437 10.4629 23.0642C10.0492 23.0847 9.73043 23.4367 9.75094 23.8504C9.85603 25.9709 10.1708 27.5382 11.3163 28.6837C12.4618 29.8292 14.0291 30.144 16.1497 30.2491C16.5634 30.2696 16.9154 29.9508 16.9359 29.5371C16.9564 29.1234 16.6376 28.7714 16.2239 28.7509C14.145 28.6479 13.0941 28.3401 12.377 27.623C11.6599 26.906 11.3521 25.855 11.2491 23.7761Z" fill="#2E3039"/>
<path d="M30.2491 23.8504C30.2696 23.4367 29.9508 23.0847 29.5371 23.0642C29.1234 23.0437 28.7714 23.3624 28.7509 23.7761C28.6479 25.855 28.3401 26.906 27.623 27.623C26.906 28.3401 25.855 28.6479 23.7761 28.7509C23.3624 28.7714 23.0437 29.1234 23.0642 29.5371C23.0847 29.9508 23.4367 30.2696 23.8504 30.2491C25.9709 30.144 27.5382 29.8292 28.6837 28.6837C29.8292 27.5382 30.144 25.9709 30.2491 23.8504Z" fill="#2E3039"/>
<path d="M20.75 15C20.75 14.5858 20.4142 14.25 20 14.25C19.5858 14.25 19.25 14.5858 19.25 15L19.25 25C19.25 25.4142 19.5858 25.75 20 25.75C20.4142 25.75 20.75 25.4142 20.75 25L20.75 15Z" fill="#2E3039"/>
<path d="M16.75 17C16.75 16.5858 16.4142 16.25 16 16.25C15.5858 16.25 15.25 16.5858 15.25 17L15.25 23C15.25 23.4142 15.5858 23.75 16 23.75C16.4142 23.75 16.75 23.4142 16.75 23L16.75 17Z" fill="#2E3039"/>
<path d="M24.75 17C24.75 16.5858 24.4142 16.25 24 16.25C23.5858 16.25 23.25 16.5858 23.25 17L23.25 23C23.25 23.4142 23.5858 23.75 24 23.75C24.4142 23.75 24.75 23.4142 24.75 23L24.75 17Z" fill="#2E3039"/>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

@ -0,0 +1,4 @@
<svg width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12.5 1.25C8.04419 1.25 4.42789 4.84151 4.42786 9.27697C4.42776 10.3087 4.35838 11.0873 3.88271 11.7872C3.81656 11.8831 3.72879 12.0032 3.63289 12.1345C3.46634 12.3625 3.27527 12.624 3.13033 12.8505C2.87452 13.2503 2.62459 13.7324 2.53868 14.2942C2.25836 16.127 3.55056 17.3136 4.83746 17.8454C9.37016 19.7182 15.6298 19.7182 20.1625 17.8454C21.4494 17.3136 22.7416 16.127 22.4613 14.2942C22.3754 13.7324 22.1255 13.2503 21.8697 12.8505C21.7247 12.624 21.5337 12.3625 21.3671 12.1345C21.2712 12.0033 21.1835 11.8832 21.1173 11.7873C20.6416 11.0874 20.5722 10.3088 20.5721 9.27703C20.5721 4.84155 16.9558 1.25 12.5 1.25Z" fill="white"/>
<path d="M12.4985 22.7477C13.5187 22.7477 14.4742 22.4563 15.2776 21.9511C15.9906 21.5027 16.3472 21.2785 16.2224 20.9057C16.0976 20.533 15.6057 20.5747 14.6217 20.6582C13.2146 20.7776 11.7824 20.7776 10.3752 20.6582C9.39126 20.5747 8.8993 20.533 8.77454 20.9057C8.64977 21.2784 9.0063 21.5027 9.71934 21.9511C10.5227 22.4563 11.4782 22.7477 12.4985 22.7477Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.in-app-payments</key>
<array>
<string>merchant.com.hmgwebservices</string>
<string>merchant.com.hmgwebservices.uat</string>
</array>
<key>com.apple.developer.nfc.readersession.formats</key>
<array>
<string>TAG</string>
</array>
</dict>
</plist>

@ -13,6 +13,7 @@ class AppAssets {
static const String email = '$svgBasePath/email.svg';
static const String globe = '$svgBasePath/globe.svg';
static const String cancel = '$svgBasePath/cancel.svg';
static const String bell = '$svgBasePath/bell.svg';
static const String login1 = '$svgBasePath/login1.svg';
static const String tamara = '$svgBasePath/tamara.svg';
static const String confirm = '$svgBasePath/confirm.svg';
@ -84,12 +85,14 @@ class AppAssets {
static const String uae_dirham_symbol = '$svgBasePath/uae_dirham_symbol.svg';
static const String directions_icon = '$svgBasePath/directions_icon.svg';
static const String apple_pay_button = '$svgBasePath/pay_with_apple_pay.svg';
static const String bell = '$svgBasePath/bell.svg';
static const String reminder_bell = '$svgBasePath/reminder_bell.svg';
static const String rebook_appointment_icon = '$svgBasePath/rebook_appointment_icon.svg';
static const String report_icon = '$svgBasePath/report_icon.svg';
static const String radiology_icon = '$svgBasePath/radiology_icon.svg';
static const String prescription_item_icon = '$svgBasePath/prescription_item_icon.svg';
static const String checkin_location_icon = '$svgBasePath/checkin_location_icon.svg';
static const String checkin_nfc_icon = '$svgBasePath/checkin_nfc_icon.svg';
static const String checkin_qr_icon = '$svgBasePath/checkin_qr_icon.svg';
//bottom navigation//
static const String homeBottom = '$svgBasePath/home_bottom.svg';

@ -1,12 +1,18 @@
import 'dart:async';
import 'dart:collection';
import 'dart:convert';
import 'dart:io';
import 'dart:ui';
import 'package:device_calendar/device_calendar.dart';
import 'package:flutter/widgets.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/presentation/prescriptions/prescription_reminder_view.dart';
import 'package:hmg_patient_app_new/services/dialog_service.dart';
import 'package:hmg_patient_app_new/services/permission_service.dart';
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
import 'package:jiffy/jiffy.dart';
import 'package:manage_calendar_events/manage_calendar_events.dart' as ios;
import 'package:permission_handler/permission_handler.dart';
@ -49,94 +55,6 @@ class CalendarUtils {
// return _completer!.future;
// }
Future<Map<Permission, PermissionStatus>> requestPermissions() async {
var permissionResults = [Permission.calendarFullAccess].request();
return permissionResults;
}
// showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted,
// {required Function() onSuccess, String? title, String? description, Function(int)? onMultiDateSuccess, bool isMultiAllowed = false}) async {
// if (Platform.isAndroid) {
// if (await PermissionService.isCalendarPermissionEnabled()) {
// _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted,
// onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess, isMultiAllowed: isMultiAllowed);
// } else {
// // Utils.showPermissionConsentDialog(context, TranslationBase.of(context).calendarPermission, () async {
// // if (await Permission.calendarFullAccess.request().isGranted) {
// // _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted,
// // onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess, isMultiAllowed: isMultiAllowed);
// // }
// // });
// }
// } else {
// if (await Permission.calendarWriteOnly.request().isGranted) {
// if (await Permission.calendarFullAccess.request().isGranted) {
// _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted,
// onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess, isMultiAllowed: isMultiAllowed);
// }
// }
// }
// }
// Future<void> _showReminderDialog(BuildContext providedContext, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted,
// {required Function onSuccess, String? title, String? description, Function(int)? onMultiDateSuccess, bool? isMultiAllowed}) async {
// return showDialog<void>(
// context: providedContext,
// barrierDismissible: true, // user must tap button!
// builder: (BuildContext context) {
// return Dialog(
// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(0.0)),
// insetPadding: EdgeInsets.all(21),
// child: ReminderDialog(
// onClick: (int i) async {
// String text = "";
// if (i == 0) {
// // Before 30 mints
// dateTime = Jiffy.parseFromDateTime(dateTime).subtract(minutes: 30).dateTime;
// text = "30 minutes";
// // dateTime.add(new Duration(minutes: -30));
// } else if (i == 1) {
// // Before 1 hour
// // dateTime.add(new Duration(minutes: -60));
// dateTime = Jiffy.parseFromDateTime(dateTime).subtract(hours: 1).dateTime;
// text = "1 hours";
// } else if (i == 2) {
// // Before 1 hour and 30 mints
// // dateTime.add(new Duration(minutes: -90));
// dateTime = Jiffy.parseFromDateTime(dateTime).subtract(hours: 1, minutes: 30).dateTime;
// text = "1 hours 30 minutes";
// } else if (i == 3) {
// // Before 2 hours
// // dateTime.add(new Duration(minutes: -120));
// dateTime = Jiffy.parseFromDateTime(dateTime).subtract(hours: 2).dateTime;
// text = "2 hours";
// }
// if (!isMultiAllowed!) {
// if (onMultiDateSuccess == null) {
// CalendarUtils calendarUtils = await CalendarUtils.getInstance();
// await calendarUtils.createOrUpdateEvent(
// title: title ?? "TranslationBase.of(providedContext).reminderTitle".needTranslation + " " + doctorName,
// description: description ?? "At " + appoDateFormatted + " " + appoTimeFormatted,
// scheduleDateTime: dateTime,
// eventId: eventId, location: '');
// onSuccess();
// }
// } else {
// onMultiDateSuccess!(i);
// }
// // await _analytics.logEvent(
// // name: name.trim().toLowerCase(),
// // parameters: safeParameters,
// // );
// // todo @sikander discuss analytics for reminder
// // locator<GAnalytics>().appointment.appointment_reminder_time(reminde_before: text);
// },
// ),
// );
// },
// );
// }
static Future<CalendarUtils> getInstance() async {
tzl.initializeTimeZones();
if (_completer != null) {
@ -265,3 +183,134 @@ class CalendarUtils {
return await deviceCalendarPlugin.createCalendar(calendarName, calendarColor: calendarColor, localAccountName: localAccountName);
}
}
Future<Map<Permission, PermissionStatus>> requestPermissions() async {
var permissionResults = [Permission.calendarFullAccess].request();
return permissionResults;
}
showReminderBottomSheet(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted,
{required Function() onSuccess, String? title, String? description, Function(int)? onMultiDateSuccess, bool isMultiAllowed = false}) async {
if (Platform.isAndroid) {
if (await PermissionService.isCalendarPermissionEnabled()) {
_showReminderBottomSheet(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted,
onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess, isMultiAllowed: isMultiAllowed);
} else {
// Utils.showPermissionConsentDialog(context, TranslationBase.of(context).calendarPermission, () async {
// if (await Permission.calendarFullAccess.request().isGranted) {
// _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted,
// onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess, isMultiAllowed: isMultiAllowed);
// }
// });
}
} else {
if (await Permission.calendarWriteOnly.request().isGranted) {
if (await Permission.calendarFullAccess.request().isGranted) {
_showReminderBottomSheet(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted,
onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess, isMultiAllowed: isMultiAllowed);
}
}
}
}
Future<void> _showReminderBottomSheet(BuildContext providedContext, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted,
{required Function onSuccess, String? title, String? description, Function(int)? onMultiDateSuccess, bool? isMultiAllowed}) async {
showCommonBottomSheetWithoutHeight(providedContext, title: "Set the timer of reminder".needTranslation, child: PrescriptionReminderView(
setReminder: (int value) async {
if (!isMultiAllowed!) {
if (onMultiDateSuccess == null) {
CalendarUtils calendarUtils = await CalendarUtils.getInstance();
await calendarUtils.createOrUpdateEvent(
title: title ?? "You have appointment with Dr. ".needTranslation + doctorName,
description: description ?? "At " + appoDateFormatted + " " + appoTimeFormatted,
scheduleDateTime: dateTime,
eventId: eventId,
location: '');
onSuccess();
}
} else {
onMultiDateSuccess!(value);
}
},
), callBackFunc: () {}, isFullScreen: false);
}
setCalender(BuildContext context,
{required String eventId, required int selectedMinutes, int? frequencyNumber, required int days, required String orderDate, required String itemDescriptionN, required String route}) async {
DateTime actualDate = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day, 8, 0);
frequencyNumber ??= 2; //Some time frequency number is null so by default will be 2
int remainingDays = days - (Jiffy.parseFromDateTime(DateTime.now()).diff(Jiffy.parseFromDateTime(DateUtil.convertStringToDate(orderDate)), unit: Unit.day) as int);
if (remainingDays.isNegative) {
getIt.get<DialogService>().showErrorBottomSheet(message: "Prescription date has been already passed you can not add a reminder for this prescription.");
return;
}
CalendarUtils calendarUtils = await CalendarUtils.getInstance();
try {
for (int i = 0; i < remainingDays; i++) {
//event for number of days.
for (int j = 0; j < frequencyNumber; j++) {
// event for number of times per day.
if (j != 0) {
actualDate.add(new Duration(hours: 8)); // 8 hours addition for daily dose.
}
//Time subtraction from actual reminder time. like before 30, or 1 hour.
actualDate = Jiffy.parseFromDateTime(actualDate).subtract(minutes: selectedMinutes).dateTime;
calendarUtils.createOrUpdateEvent(
title: "$itemDescriptionN} Prescription Reminder",
description: "$itemDescriptionN $frequencyNumber $route ",
scheduleDateTime: actualDate,
eventId: eventId + (i.toString() + j.toString()),
location: '', //event id with varitions
);
actualDate = DateTime(actualDate.year, actualDate.month, actualDate.day, 8, 0);
}
actualDate = Jiffy.parseFromDateTime(actualDate).add(days: 1).dateTime;
}
} catch (ex) {
getIt.get<DialogService>().showErrorBottomSheet(message: "catch:$ex");
}
}
Future<void> checkAndRemove(hasReminder, {bool delete = false, String itemDescriptionN = ""}) async {
final ios.CalendarPlugin _myPlugin = ios.CalendarPlugin();
CalendarUtils calendarUtils = await CalendarUtils.getInstance();
DateTime startEventsDate = Jiffy.parseFromDateTime(DateTime.now()).subtract(days: 30).dateTime;
DateTime endEventsDate = Jiffy.parseFromDateTime(DateTime.now()).add(days: 120).dateTime;
RetrieveEventsParams params = RetrieveEventsParams(startDate: startEventsDate, endDate: endEventsDate);
if (calendarUtils.calendars != null) {
if (Platform.isAndroid) {
await processEvents(calendarUtils.calendars, calendarUtils, params, delete, itemDescriptionN,hasReminder);
} else {
List<ios.Calendar>? iosCalendars = await _myPlugin.getCalendars();
if (iosCalendars != null) {
await processEvents(iosCalendars.map((cal) => Calendar(id: cal.id, name: cal.name, accountName: cal.accountName)).toList(), calendarUtils, params, delete, itemDescriptionN,hasReminder);
}
}
}
}
Future<void> processEvents(List<Calendar> calendars, calendarUtils, params, delete, String itemDescriptionN, hasReminder) async {
for (var calendar in calendars) {
Result<UnmodifiableListView<Event>> events = await calendarUtils.retrieveEvents(calendar.id!, params);
for (var event in events.data!) {
if (event.title!.contains(itemDescriptionN)) {
if (delete) {
await calendarUtils.deleteEvent(calendar, event);
// AppToast.showSuccessToast(message: TranslationBase.of(context).reminderCancelSuccess);
hasReminder = false;
} else {
hasReminder = false;
// setState(() {
// hasReminder = true;
// });
}
}
}
}
}

@ -205,9 +205,9 @@ extension EmailValidator on String {
style: TextStyle(fontSize: 19.fSize, fontWeight: isBold ? FontWeight.bold : FontWeight.normal, color: color ?? AppColors.blackColor, letterSpacing: -0.4),
);
Widget toText20({Color? color, bool isBold = false}) => Text(
Widget toText20({Color? color,FontWeight? weight, bool isBold = false}) => Text(
this,
style: TextStyle(fontSize: 20.fSize, fontWeight: isBold ? FontWeight.bold : FontWeight.normal, color: color ?? AppColors.blackColor, letterSpacing: -0.4),
style: TextStyle(fontSize: 20.fSize, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), color: color ?? AppColors.blackColor, letterSpacing: -0.4),
);
Widget toText21({Color? color, bool isBold = false, FontWeight? weight, int? maxlines}) => Text(

@ -39,6 +39,20 @@ extension WidgetExtensions on Widget {
child: this,
);
Widget toShimmer2({bool isShow = true, double radius = 20}) => isShow
? Shimmer.fromColors(
baseColor: const Color(0xffe8eff0),
highlightColor: Colors.white,
child: ClipRRect(
borderRadius: BorderRadius.circular(radius),
child: Container(
color: Colors.white,
child: this,
),
),
)
: this;
Widget animatedSwither() => AnimatedSwitcher(
duration: const Duration(milliseconds: 500),
// transitionBuilder: (Widget child, Animation<double> animation) {

@ -50,6 +50,10 @@ class PrescriptionsViewModel extends ChangeNotifier {
}
}
notify() {
notifyListeners();
}
setIsSortByClinic(bool value) {
isSortByClinic = value;
if (isSortByClinic) {

@ -18,6 +18,7 @@ import 'package:hmg_patient_app_new/features/prescriptions/models/resp_models/pa
import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/appointments/appointment_payment_page.dart';
import 'package:hmg_patient_app_new/presentation/appointments/widgets/appointment_checkin_bottom_sheet.dart';
import 'package:hmg_patient_app_new/presentation/appointments/widgets/appointment_doctor_card.dart';
import 'package:hmg_patient_app_new/presentation/prescriptions/prescription_detail_page.dart';
import 'package:hmg_patient_app_new/presentation/prescriptions/prescriptions_list_page.dart';
@ -517,7 +518,13 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
case 50:
// return LocaleKeys.confirmLiveCare.tr();
case 90:
// return LocaleKeys.checkinOption.tr();
showCommonBottomSheetWithoutHeight(context,
title: LocaleKeys.onlineCheckIn.tr(),
child: AppointmentCheckinBottomSheet(
patientAppointmentHistoryResponseModel: widget.patientAppointmentHistoryResponseModel,
),
callBackFunc: () {},
isFullScreen: false);
default:
// return "No Action".needTranslation;
}

@ -0,0 +1,44 @@
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.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/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
class AppointmentCheckinBottomSheet extends StatelessWidget {
AppointmentCheckinBottomSheet({super.key, required this.patientAppointmentHistoryResponseModel});
PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel;
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
checkInOptionCard(AppAssets.checkin_location_icon, "Live Location".needTranslation, "".needTranslation),
SizedBox(height: 16.h),
checkInOptionCard(AppAssets.checkin_nfc_icon, "NFC (Near Field Communication)".needTranslation, "".needTranslation),
SizedBox(height: 16.h),
checkInOptionCard(AppAssets.checkin_qr_icon, "QR Code".needTranslation, "".needTranslation),
],
);
}
Widget checkInOptionCard(String icon, String title, String subTitle) {
return Container(
height: 120.h,
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 20.h,
hasShadow: false,
),
child: Column(
children: [
Utils.buildSvgWithAssets(icon: icon),
],
),
);
}
}

@ -4,6 +4,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_staggered_animations/flutter_staggered_animations.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/utils/calendar_utils.dart';
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
@ -12,9 +13,12 @@ import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/prescriptions/models/resp_models/patient_prescriptions_response_model.dart';
import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/prescriptions/prescription_item_view.dart';
import 'package:hmg_patient_app_new/presentation/prescriptions/prescription_reminder_view.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart';
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
import 'package:hmg_patient_app_new/widgets/shimmer/movies_shimmer_widget.dart';
import 'package:provider/provider.dart';
@ -34,6 +38,9 @@ class _PrescriptionDetailPageState extends State<PrescriptionDetailPage> {
@override
void initState() {
checkAndRemove(false);
// locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context);
// WidgetsBinding.instance.addPostFrameCallback((_) => locationUtils.getCurrentLocation());
scheduleMicrotask(() {
prescriptionsViewModel.setPrescriptionsDetailsLoading();
prescriptionsViewModel.getPrescriptionDetails(widget.prescriptionsResponseModel);
@ -118,194 +125,14 @@ class _PrescriptionDetailPageState extends State<PrescriptionDetailPage> {
itemCount: prescriptionVM.isPrescriptionsDetailsLoading ? 5 : prescriptionVM.prescriptionDetailsList.length,
itemBuilder: (context, index) {
return prescriptionVM.isPrescriptionsDetailsLoading
? const MoviesShimmerWidget()
? PrescriptionItemView(prescriptionVM: prescriptionVM, index: index, isLoading: true)
: AnimationConfiguration.staggeredList(
position: index,
duration: const Duration(milliseconds: 500),
child: SlideAnimation(
verticalOffset: 100.0,
child: FadeInAnimation(
child: AnimatedContainer(
duration: Duration(milliseconds: 300),
curve: Curves.easeInOut,
margin: EdgeInsets.symmetric(vertical: 8.h),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 16.h),
Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Image.network(
prescriptionVM.prescriptionDetailsList[index].imageThumbUrl!,
width: 60.h,
height: 60.h,
fit: BoxFit.fill,
).circle(100),
SizedBox(width: 8.h),
Expanded(
child: prescriptionVM.prescriptionDetailsList[index].itemDescription!.toText16(isBold: true, maxlines: 2),
),
],
).paddingSymmetrical(16.h, 0.h),
SizedBox(height: 16.h),
Wrap(
direction: Axis.horizontal,
spacing: 6.h,
runSpacing: 6.h,
children: [
Row(
mainAxisSize: MainAxisSize.min,
children: [
CustomButton(
text: "${LocaleKeys.route.tr(context: context)}: ${prescriptionVM.prescriptionDetailsList[index].route}",
onPressed: () {},
backgroundColor: AppColors.greyColor,
borderColor: AppColors.greyColor,
textColor: AppColors.blackColor,
fontSize: 10,
fontWeight: FontWeight.w500,
borderRadius: 8,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 30.h,
),
],
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
CustomButton(
text: "${LocaleKeys.frequency.tr(context: context)}: ${prescriptionVM.prescriptionDetailsList[index].frequency}",
onPressed: () {},
backgroundColor: AppColors.greyColor,
borderColor: AppColors.greyColor,
textColor: AppColors.blackColor,
fontSize: 10,
fontWeight: FontWeight.w500,
borderRadius: 8,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 30.h,
),
],
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
CustomButton(
text: "${LocaleKeys.dailyDoses.tr(context: context)}: ${prescriptionVM.prescriptionDetailsList[index].doseDailyQuantity}",
onPressed: () {},
backgroundColor: AppColors.greyColor,
borderColor: AppColors.greyColor,
textColor: AppColors.blackColor,
fontSize: 10,
fontWeight: FontWeight.w500,
borderRadius: 8,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 30.h,
),
],
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
CustomButton(
text: "${LocaleKeys.days.tr(context: context)}: ${prescriptionVM.prescriptionDetailsList[index].days}",
onPressed: () {},
backgroundColor: AppColors.greyColor,
borderColor: AppColors.greyColor,
textColor: AppColors.blackColor,
fontSize: 10,
fontWeight: FontWeight.w500,
borderRadius: 8,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 30.h,
),
],
),
],
).paddingSymmetrical(16.h, 0.h),
SizedBox(height: 8.h),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Utils.buildSvgWithAssets(icon: AppAssets.prescription_remarks_icon, width: 18.h, height: 18.h),
SizedBox(width: 9.h),
Expanded(child: "${LocaleKeys.remarks.tr(context: context)}: ${prescriptionVM.prescriptionDetailsList[index].remarks!}".toText10(isBold: true)),
],
).paddingSymmetrical(16.h, 0.h),
SizedBox(height: 14.h),
Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h),
SizedBox(height: 14.h),
Row(
mainAxisSize: MainAxisSize.max,
children: [
Utils.buildSvgWithAssets(icon: AppAssets.prescription_reminder_icon, width: 35.h, height: 35.h),
SizedBox(width: 8.h),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.setReminder.tr(context: context).toText13(isBold: true),
"Notify me before the consumption time".toText10(color: AppColors.textColorLight),
],
),
SizedBox(width: 12.h),
Switch(
activeColor: AppColors.successColor,
activeTrackColor: AppColors.successColor.withValues(alpha: .15),
value: prescriptionVM.prescriptionDetailsList[index].hasReminder!,
onChanged: (newValue) {
setState(() {
prescriptionVM.setPrescriptionItemReminder(newValue, prescriptionVM.prescriptionDetailsList[index]);
});
},
),
],
).paddingSymmetrical(16.h, 0.h),
SizedBox(height: 14.h),
Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h),
Row(
children: [
Expanded(
child: CustomButton(
text: LocaleKeys.checkAvailability.tr(context: context),
onPressed: () {},
backgroundColor: AppColors.primaryRedColor.withOpacity(0.1),
borderColor: AppColors.primaryRedColor.withOpacity(0.0),
textColor: AppColors.primaryRedColor,
fontSize: 13,
fontWeight: FontWeight.w500,
borderRadius: 12,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 40.h,
),
),
SizedBox(width: 16.h),
Expanded(
child: CustomButton(
text: LocaleKeys.readInstructions.tr(context: context),
onPressed: () {},
backgroundColor: AppColors.primaryRedColor,
borderColor: AppColors.primaryRedColor,
textColor: AppColors.whiteColor,
fontSize: 13,
fontWeight: FontWeight.w500,
borderRadius: 12,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 40.h,
),
),
],
).paddingSymmetrical(16.h, 16.h),
],
)
],
),
),
child: PrescriptionItemView(prescriptionVM: prescriptionVM, index: index),
),
),
);

@ -0,0 +1,233 @@
import 'package:easy_localization/easy_localization.dart';
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/calendar_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/features/prescriptions/prescriptions_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
class PrescriptionItemView extends StatelessWidget {
int index;
PrescriptionsViewModel prescriptionVM;
bool isLoading;
PrescriptionItemView({Key? key, required this.prescriptionVM, required this.index, this.isLoading = false}) : super(key: key);
@override
Widget build(BuildContext context) {
return AnimatedContainer(
duration: Duration(milliseconds: 300),
curve: Curves.easeInOut,
margin: EdgeInsets.symmetric(vertical: 8.h),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 16.h),
Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
spacing: 8.h,
children: [
Image.network(
isLoading ? "" : prescriptionVM.prescriptionDetailsList[index].imageThumbUrl!,
width: 60.h,
height: 60.h,
errorBuilder: (cxt, child, tr) {
return SizedBox(height: 60, width: 60);
},
fit: BoxFit.fill,
).toShimmer2(isShow: isLoading).circle(100),
Expanded(
child: (isLoading ? "" : prescriptionVM.prescriptionDetailsList[index].itemDescription!).toText16(isBold: true, maxlines: 2).toShimmer2(isShow: isLoading),
),
],
).paddingSymmetrical(16.h, 0.h),
SizedBox(height: 16.h),
Wrap(
direction: Axis.horizontal,
spacing: 6.h,
runSpacing: 6.h,
children: [
Row(
mainAxisSize: MainAxisSize.min,
children: [
CustomButton(
text: "${LocaleKeys.route.tr(context: context)}: ${isLoading ? "" : prescriptionVM.prescriptionDetailsList[index].route}",
onPressed: () {},
backgroundColor: AppColors.greyColor,
borderColor: AppColors.greyColor,
textColor: AppColors.blackColor,
fontSize: 10,
fontWeight: FontWeight.w500,
borderRadius: 8,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 30.h,
).toShimmer2(isShow: isLoading),
],
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
CustomButton(
text: "${LocaleKeys.frequency.tr(context: context)}: ${isLoading ? "" : prescriptionVM.prescriptionDetailsList[index].frequency}",
onPressed: () {},
backgroundColor: AppColors.greyColor,
borderColor: AppColors.greyColor,
textColor: AppColors.blackColor,
fontSize: 10,
fontWeight: FontWeight.w500,
borderRadius: 8,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 30.h,
).toShimmer2(isShow: isLoading),
],
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
CustomButton(
text: "${LocaleKeys.dailyDoses.tr(context: context)}: ${isLoading ? "" : prescriptionVM.prescriptionDetailsList[index].doseDailyQuantity}",
onPressed: () {},
backgroundColor: AppColors.greyColor,
borderColor: AppColors.greyColor,
textColor: AppColors.blackColor,
fontSize: 10,
fontWeight: FontWeight.w500,
borderRadius: 8,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 30.h,
).toShimmer2(isShow: isLoading),
],
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
CustomButton(
text: "${LocaleKeys.days.tr(context: context)}: ${isLoading ? "" : prescriptionVM.prescriptionDetailsList[index].days}",
onPressed: () {},
backgroundColor: AppColors.greyColor,
borderColor: AppColors.greyColor,
textColor: AppColors.blackColor,
fontSize: 10,
fontWeight: FontWeight.w500,
borderRadius: 8,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 30.h,
).toShimmer2(isShow: isLoading),
],
),
],
).paddingSymmetrical(16.h, 0.h),
SizedBox(height: 8.h),
if (!isLoading)
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Utils.buildSvgWithAssets(icon: AppAssets.prescription_remarks_icon, width: 18.h, height: 18.h),
SizedBox(width: 9.h),
Expanded(child: "${LocaleKeys.remarks.tr(context: context)}: ${isLoading ? "" : prescriptionVM.prescriptionDetailsList[index].remarks!}".toText10(isBold: true)),
],
).paddingSymmetrical(16.h, 0.h),
SizedBox(height: 14.h),
Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h),
SizedBox(height: 14.h),
Row(
mainAxisSize: MainAxisSize.max,
children: [
Utils.buildSvgWithAssets(icon: AppAssets.prescription_reminder_icon, width: 35.h, height: 35.h).toShimmer2(isShow: isLoading),
SizedBox(width: 8.h),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.setReminder.tr(context: context).toText13(isBold: true),
"Notify me before the consumption time".toText10(color: AppColors.textColorLight),
],
).toShimmer2(isShow: isLoading).expanded,
Switch(
activeColor: AppColors.successColor,
activeTrackColor: AppColors.successColor.withValues(alpha: .15),
value: isLoading ? false : prescriptionVM.prescriptionDetailsList[index].hasReminder!,
onChanged: (newValue) async {
if (prescriptionVM.prescriptionDetailsList[index].hasReminder ?? false) {
await checkAndRemove(prescriptionVM.prescriptionDetailsList[index].hasReminder, delete: true);
prescriptionVM.notify();
return;
}
DateTime startDate = DateTime.now();
DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionVM.prescriptionDetailsList[index].days!.toInt());
showReminderBottomSheet(
context,
endDate,
"",
prescriptionVM.prescriptionDetailsList[index].itemID.toString(),
"",
"",
title: "${prescriptionVM.prescriptionDetailsList[index].itemDescription} Prescription Reminder",
description:
"${prescriptionVM.prescriptionDetailsList[index].itemDescription} ${prescriptionVM.prescriptionDetailsList[index].frequency} ${prescriptionVM.prescriptionDetailsList[index].route} ",
onSuccess: () {
prescriptionVM.setPrescriptionItemReminder(newValue, prescriptionVM.prescriptionDetailsList[index]);
},
isMultiAllowed: true,
onMultiDateSuccess: (int selectedIndex) {
setCalender(context,
eventId: prescriptionVM.prescriptionDetailsList[index].itemID.toString(),
selectedMinutes: selectedIndex,
frequencyNumber: prescriptionVM.prescriptionDetailsList[index].frequencyNumber?.toInt(),
days: prescriptionVM.prescriptionDetailsList[index].days!.toInt(),
orderDate: prescriptionVM.prescriptionDetailsList[index].orderDate!,
itemDescriptionN: prescriptionVM.prescriptionDetailsList[index].itemDescription!,
route: prescriptionVM.prescriptionDetailsList[index].route!);
},
);
},
).toShimmer2(isShow: isLoading),
],
).paddingSymmetrical(16.h, 0.h),
SizedBox(height: 14.h),
Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h),
Row(
children: [
Expanded(
child: CustomButton(
text: LocaleKeys.checkAvailability.tr(context: context),
onPressed: () {},
backgroundColor: AppColors.primaryRedColor.withOpacity(0.1),
borderColor: AppColors.primaryRedColor.withOpacity(0.0),
textColor: AppColors.primaryRedColor,
fontSize: 13,
fontWeight: FontWeight.w500,
borderRadius: 12,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 40.h,
).toShimmer2(isShow: isLoading),
),
SizedBox(width: 16.h),
Expanded(
child: CustomButton(
text: LocaleKeys.readInstructions.tr(context: context),
onPressed: () {},
backgroundColor: AppColors.primaryRedColor,
borderColor: AppColors.primaryRedColor,
textColor: AppColors.whiteColor,
fontSize: 13,
fontWeight: FontWeight.w500,
borderRadius: 12,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 40.h,
).toShimmer2(isShow: isLoading),
),
],
).paddingSymmetrical(16.h, 16.h),
],
),
);
}
}

@ -0,0 +1,116 @@
import 'package:easy_localization/easy_localization.dart';
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/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:hmg_patient_app_new/widgets/buttons/custom_button.dart';
class PrescriptionReminderView extends StatefulWidget {
Function(int) setReminder;
PrescriptionReminderView({Key? key, required this.setReminder}) : super(key: key);
@override
_PrescriptionReminderViewState createState() {
return _PrescriptionReminderViewState();
}
}
class _PrescriptionReminderViewState extends State<PrescriptionReminderView> {
final List<int> _options = [15, 30, 60, 90];
int _selectedOption = 0; // Nullable to represent no selection initially
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.min,
spacing: 16.h,
children: [
Container(
width: double.infinity,
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24),
child: ListView.builder(
itemCount: _options.length,
physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.only(top: 8, bottom: 8),
shrinkWrap: true,
itemBuilder: (context, index) {
return Theme(
data: Theme.of(context).copyWith(
listTileTheme: ListTileThemeData(horizontalTitleGap: 4),
),
child: RadioListTile<int>(
title: Text(
"${_options[index]} minutes before".needTranslation,
style: TextStyle(
fontSize: 16.h,
fontWeight: FontWeight.w500,
),
),
value: index,
fillColor: WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.selected)) {
return AppColors.primaryRedColor;
}
return Color(0xffEEEEEE);
}),
contentPadding: EdgeInsets.only(left: 12.h, right: 12.h),
groupValue: _selectedOption,
onChanged: (int? newValue) {
setState(() {
_selectedOption = newValue!;
});
},
),
);
},
),
),
Row(
spacing: 16.h,
children: [
Expanded(
child: CustomButton(
text: LocaleKeys.cancel.tr(),
onPressed: () {
Navigator.of(context).pop();
},
backgroundColor: AppColors.secondaryLightRedColor,
borderColor: AppColors.secondaryLightRedColor,
textColor: AppColors.primaryRedColor,
icon: AppAssets.cancel,
iconColor: AppColors.primaryRedColor,
),
),
Expanded(
child: CustomButton(
text: LocaleKeys.setReminder.tr(),
onPressed: () {
Navigator.of(context).pop();
widget.setReminder(_selectedOption);
},
backgroundColor: AppColors.bgGreenColor,
borderColor: AppColors.bgGreenColor,
textColor: Colors.white,
icon: AppAssets.reminder_bell,
),
),
],
),
],
);
}
}

@ -12,6 +12,7 @@ class AppColors {
static const lightGray = Color(0xFFF4F5F7);
static const lightPurple = Color(0xFFB7A3E6);
static const scaffoldBgColor = Color(0xFFF8F8F8);
static const bottomSheetBgColor = Color(0xFFF8F8FA);
static const lightGreyEFColor = Color(0xffeaeaff);
static const greyF7Color = Color(0xffF7F7F7);
static const lightGrayColor = Color(0xff808080);

@ -103,3 +103,50 @@ class ButtonSheetContent extends StatelessWidget {
);
}
}
void showCommonBottomSheetWithoutHeight(
BuildContext context, {
required Widget child,
required VoidCallback callBackFunc,
String title = "",
bool isCloseButtonVisible = true,
bool isFullScreen = true,
}) {
showModalBottomSheet<String>(
sheetAnimationStyle: AnimationStyle(
duration: Duration(milliseconds: 500), // Custom animation duration
reverseDuration: Duration(milliseconds: 300), // Custom reverse animation duration
),
context: context,
isScrollControlled: true,
showDragHandle: false,
backgroundColor: AppColors.bottomSheetBgColor,
builder: (BuildContext context) {
return SafeArea(
top: false,
left: false,
right: false,
child: Container(
padding: EdgeInsets.only(left: 24, top: 24, right: 24, bottom: 12),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.bottomSheetBgColor, borderRadius: 24.h),
child: Column(
mainAxisSize: MainAxisSize.min,
spacing: 16.h,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
if (title.isNotEmpty) title.toText20(weight: FontWeight.w600).expanded,
Utils.buildSvgWithAssets(icon: AppAssets.close_bottom_sheet_icon, iconColor: Color(0xff2B353E)).onPress(() {
Navigator.of(context).pop();
}),
],
),
child,
],
)),
);
}).then((value) {
callBackFunc();
});
}

Loading…
Cancel
Save