|
|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_screenshot_blocker/flutter_screenshot_blocker.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/extensions/string_extensions.dart';
|
|
|
|
|
@ -20,28 +21,38 @@ class NotificationDetailsPage extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return CollapsingListView(
|
|
|
|
|
title: LocaleKeys.notificationDetails.tr(),
|
|
|
|
|
// trailing: IconButton(
|
|
|
|
|
// icon: Icon(
|
|
|
|
|
// Icons.share_outlined,
|
|
|
|
|
// size: 24.h,
|
|
|
|
|
// color: AppColors.textColor,
|
|
|
|
|
// ),
|
|
|
|
|
// onPressed: () {
|
|
|
|
|
// _shareNotification();
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(height: 24.h),
|
|
|
|
|
// Notification content card
|
|
|
|
|
_buildNotificationCard(context),
|
|
|
|
|
SizedBox(height: 24.h),
|
|
|
|
|
],
|
|
|
|
|
).paddingSymmetrical(24.w, 0.h),
|
|
|
|
|
return ScreenshotBlockerWidget(
|
|
|
|
|
blockScreenshots: true, // makes this widget appear black in screenshots
|
|
|
|
|
detectScreenshots: true, // listen for screenshot attempts
|
|
|
|
|
onScreenshotDetected: (event) {
|
|
|
|
|
// event.type → 'screenshot_taken' or 'screenshot_blocked'
|
|
|
|
|
// ScaffoldMessenger.of(context).showSnackBar(
|
|
|
|
|
// SnackBar(content: Text('Screenshots are not allowed!')),
|
|
|
|
|
// );
|
|
|
|
|
},
|
|
|
|
|
child: CollapsingListView(
|
|
|
|
|
title: LocaleKeys.notificationDetails.tr(),
|
|
|
|
|
// trailing: IconButton(
|
|
|
|
|
// icon: Icon(
|
|
|
|
|
// Icons.share_outlined,
|
|
|
|
|
// size: 24.h,
|
|
|
|
|
// color: AppColors.textColor,
|
|
|
|
|
// ),
|
|
|
|
|
// onPressed: () {
|
|
|
|
|
// _shareNotification();
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(height: 24.h),
|
|
|
|
|
// Notification content card
|
|
|
|
|
_buildNotificationCard(context),
|
|
|
|
|
SizedBox(height: 24.h),
|
|
|
|
|
],
|
|
|
|
|
).paddingSymmetrical(24.w, 0.h),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
@ -109,9 +120,9 @@ class NotificationDetailsPage extends StatelessWidget {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.messageNotification.tr().toText14(
|
|
|
|
|
weight: FontWeight.w600,
|
|
|
|
|
color: AppColors.greyTextColor,
|
|
|
|
|
),
|
|
|
|
|
weight: FontWeight.w600,
|
|
|
|
|
color: AppColors.greyTextColor,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 8.h),
|
|
|
|
|
notification.message!.toText16(
|
|
|
|
|
weight: FontWeight.w400,
|
|
|
|
|
@ -123,8 +134,7 @@ class NotificationDetailsPage extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
// Notification image (if MessageType is "image")
|
|
|
|
|
if (notification.messageType != null &&
|
|
|
|
|
notification.messageType!.toLowerCase() == "image")
|
|
|
|
|
if (notification.messageType != null && notification.messageType!.toLowerCase() == "image")
|
|
|
|
|
Builder(
|
|
|
|
|
builder: (context) {
|
|
|
|
|
// Try to get image URL from videoURL or messageTypeData
|
|
|
|
|
@ -147,9 +157,9 @@ class NotificationDetailsPage extends StatelessWidget {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.attachedImage.tr().toText14(
|
|
|
|
|
weight: FontWeight.w600,
|
|
|
|
|
color: AppColors.greyTextColor,
|
|
|
|
|
),
|
|
|
|
|
weight: FontWeight.w600,
|
|
|
|
|
color: AppColors.greyTextColor,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 8.h),
|
|
|
|
|
ClipRRect(
|
|
|
|
|
borderRadius: BorderRadius.circular(12.h),
|
|
|
|
|
@ -177,8 +187,8 @@ class NotificationDetailsPage extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 8.h),
|
|
|
|
|
LocaleKeys.failedToLoadImage.tr().toText12(
|
|
|
|
|
color: AppColors.greyTextColor,
|
|
|
|
|
),
|
|
|
|
|
color: AppColors.greyTextColor,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 4.h),
|
|
|
|
|
Text(
|
|
|
|
|
imageUrl!,
|
|
|
|
|
@ -205,10 +215,7 @@ class NotificationDetailsPage extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: CircularProgressIndicator(
|
|
|
|
|
value: loadingProgress.expectedTotalBytes != null
|
|
|
|
|
? loadingProgress.cumulativeBytesLoaded /
|
|
|
|
|
loadingProgress.expectedTotalBytes!
|
|
|
|
|
: null,
|
|
|
|
|
value: loadingProgress.expectedTotalBytes != null ? loadingProgress.cumulativeBytesLoaded / loadingProgress.expectedTotalBytes! : null,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
@ -249,7 +256,8 @@ ${notification.message ?? 'Notification'}
|
|
|
|
|
Time: ${_formatTime(notification.isSentOn)}
|
|
|
|
|
Date: ${_formatDate(notification.isSentOn)}
|
|
|
|
|
${notification.notificationType != null ? '\nType: ${notification.notificationType}' : ''}
|
|
|
|
|
'''.trim();
|
|
|
|
|
'''
|
|
|
|
|
.trim();
|
|
|
|
|
|
|
|
|
|
await Share.share(shareText);
|
|
|
|
|
}
|
|
|
|
|
@ -274,4 +282,3 @@ ${notification.notificationType != null ? '\nType: ${notification.notificationTy
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|