Download & Share options added for Ready Medical Report.

dev_v3.13.6_penguin_confirmation
haroon amjad 10 months ago
parent b5eaedb721
commit 32cf61d1bf

@ -2137,4 +2137,7 @@ const Map localizedValues = {
"EROnlineCheckInWaitTurnInstruction": {"en": "Please wait in the waiting area until called by the nurse.", "ar": "يرجى الانتظار في منطقة الانتظار حتى يتم استدعاؤك من قبل الممرضة."},
"EROnlineCheckInHoldPhoneInstruction": {"en": "Hold the phone 1 to 2 cm from the NFC sign displayed on the board", "ar": "امسك الهاتف على مسافة 1 إلى 2 سم من علامة NFC المعروضة على اللوحة"},
"EROnlineCheckInTapOnCheckIn": {"en": "Tap on the check-in button within the app", "ar": "اضغط على زر تسجيل الدخول داخل التطبيق"},
"download": {"en": "Download", "ar": "تحميل"},
"share": {"en": "Share", "ar": "يشارك"},
};

@ -24,6 +24,7 @@ import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:open_filex/open_filex.dart';
import 'package:path_provider/path_provider.dart';
import 'package:provider/provider.dart';
import 'package:share_plus/share_plus.dart';
class ReportListWidget extends StatelessWidget {
final List<Reports> reportList;
@ -131,31 +132,48 @@ class ReportListWidget extends StatelessWidget {
if (reportList[index].status == 2)
Row(
children: [
// InkWell(
// onTap: () {
// getMedicalReportPDF(report);
// },
// child: Padding(
// padding: const EdgeInsets.only(right: 11.0, left: 11.0),
// child: Text(TranslationBase.of(context).viewReport,
// style: TextStyle(
// fontSize: 12,
// fontWeight: FontWeight.w600,
// fontStyle: FontStyle.italic,
// color: CustomColors.accentColor,
// letterSpacing: -0.48,
// height: 18 / 12,
// decoration: TextDecoration.underline)),
// ),
// ),
IconButton(
icon: Icon(Icons.email),
color: Color(0xff28323A),
constraints: BoxConstraints(),
padding: EdgeInsets.zero,
onPressed: () {
showConfirmMessage(reportList[index]);
})
InkWell(
onTap: () {
getMedicalReportPDF(report, false);
},
child: Padding(
padding: const EdgeInsets.only(right: 11.0, left: 11.0),
child: Text(TranslationBase.of(context).download,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
fontStyle: FontStyle.italic,
color: CustomColors.accentColor,
letterSpacing: -0.48,
height: 18 / 12,
decoration: TextDecoration.underline)),
),
),
InkWell(
onTap: () {
getMedicalReportPDF(report, true);
},
child: Padding(
padding: const EdgeInsets.only(right: 11.0, left: 11.0),
child: Text(TranslationBase.of(context).share,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
fontStyle: FontStyle.italic,
color: CustomColors.accentColor,
letterSpacing: -0.48,
height: 18 / 12,
decoration: TextDecoration.underline)),
),
),
// IconButton(
// icon: Icon(Icons.email),
// color: Color(0xff28323A),
// constraints: BoxConstraints(),
// padding: EdgeInsets.zero,
// onPressed: () {
// showConfirmMessage(reportList[index]);
// })
],
),
],
@ -187,7 +205,7 @@ class ReportListWidget extends StatelessWidget {
);
}
void getMedicalReportPDF(Reports report) {
void getMedicalReportPDF(Reports report, bool isShare) {
GifLoaderDialogUtils.showMyDialog(AppGlobal.context);
ReportsService _reportsService = locator<ReportsService>();
_reportsService
@ -195,11 +213,15 @@ class ReportListWidget extends StatelessWidget {
DateUtil.convertDateToString(report.requestDate!), report.setupId!)
.then((value) async {
GifLoaderDialogUtils.hideDialog(AppGlobal.context);
try {
String path = await _createFileFromString(value["MedicalReportBase64"], "pdf");
OpenFilex.open(path);
} catch (ex) {
AppToast.showErrorToast(message: "Cannot open file.");
String path = await _createFileFromString(value["MedicalReportBase64"], "pdf");
if (isShare) {
Share.shareXFiles([XFile(path)], text: "Medical Report");
} else {
try {
OpenFilex.open(path);
} catch (ex) {
AppToast.showErrorToast(message: "Cannot open file.");
}
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(AppGlobal.context);

@ -3042,6 +3042,9 @@ class TranslationBase {
String get EROnlineCheckInWaitTurn => localizedValues["EROnlineCheckInWaitTurn"][locale.languageCode];
String get EROnlineCheckInWaitTurnInstruction => localizedValues["EROnlineCheckInWaitTurnInstruction"][locale.languageCode];
String get download => localizedValues["download"][locale.languageCode];
String get share => localizedValues["share"][locale.languageCode];
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

Loading…
Cancel
Save