|
|
|
@ -1,5 +1,6 @@
|
|
|
|
import 'dart:io';
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:flutter_screenshot_blocker/flutter_screenshot_blocker.dart';
|
|
|
|
import 'package:hmg_patient_app/core/model/notifications/get_notifications_response_model.dart';
|
|
|
|
import 'package:hmg_patient_app/core/model/notifications/get_notifications_response_model.dart';
|
|
|
|
import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
|
|
|
|
import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
|
|
|
|
import 'package:hmg_patient_app/theme/colors.dart';
|
|
|
|
import 'package:hmg_patient_app/theme/colors.dart';
|
|
|
|
@ -68,93 +69,103 @@ class _NotificationsDetailsPageState extends State<NotificationsDetailsPage> {
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
return AppScaffold(
|
|
|
|
return ScreenshotBlockerWidget(
|
|
|
|
isShowAppBar: true,
|
|
|
|
blockScreenshots: true, // makes this widget appear black in screenshots
|
|
|
|
showNewAppBar: true,
|
|
|
|
detectScreenshots: true, // listen for screenshot attempts
|
|
|
|
showNewAppBarTitle: true,
|
|
|
|
onScreenshotDetected: (event) {
|
|
|
|
isShowDecPage: false,
|
|
|
|
// event.type → 'screenshot_taken' or 'screenshot_blocked'
|
|
|
|
appBarTitle: TranslationBase.of(context).notificationDetails,
|
|
|
|
// ScaffoldMessenger.of(context).showSnackBar(
|
|
|
|
body: ListView(
|
|
|
|
// SnackBar(content: Text('Screenshots are not allowed!')),
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
// );
|
|
|
|
padding: EdgeInsets.all(21),
|
|
|
|
},
|
|
|
|
children: [
|
|
|
|
child: AppScaffold(
|
|
|
|
Text(
|
|
|
|
isShowAppBar: true,
|
|
|
|
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.notification.createdOn!)) +
|
|
|
|
showNewAppBar: true,
|
|
|
|
" " +
|
|
|
|
showNewAppBarTitle: true,
|
|
|
|
DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(widget.notification.createdOn!), false),
|
|
|
|
isShowDecPage: false,
|
|
|
|
style: TextStyle(
|
|
|
|
appBarTitle: TranslationBase.of(context).notificationDetails,
|
|
|
|
fontSize: 16,
|
|
|
|
body: ListView(
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
color: Color(0xff2E303A),
|
|
|
|
padding: EdgeInsets.all(21),
|
|
|
|
letterSpacing: -0.64,
|
|
|
|
children: [
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
),
|
|
|
|
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.notification.createdOn!)) +
|
|
|
|
SizedBox(height: 18),
|
|
|
|
" " +
|
|
|
|
Text(
|
|
|
|
DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(widget.notification.createdOn!), false),
|
|
|
|
widget.notification.message ?? "",
|
|
|
|
style: TextStyle(
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 16,
|
|
|
|
fontSize: 12,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
color: Color(0xff2E303A),
|
|
|
|
color: Color(0xff575757),
|
|
|
|
letterSpacing: -0.64,
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height: 18),
|
|
|
|
if (widget.notification.notificationType == "2")
|
|
|
|
Text(
|
|
|
|
Padding(
|
|
|
|
widget.notification.message ?? "",
|
|
|
|
padding: const EdgeInsets.only(top: 18),
|
|
|
|
style: TextStyle(
|
|
|
|
child: YoutubePlayer(
|
|
|
|
fontSize: 12,
|
|
|
|
controller: _controller,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
showVideoProgressIndicator: true,
|
|
|
|
color: Color(0xff575757),
|
|
|
|
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (widget.notification.messageTypeData != null)
|
|
|
|
if (widget.notification.notificationType == "2")
|
|
|
|
if (widget.notification.messageTypeData!.length != 0 && widget.notification.notificationType != "2")
|
|
|
|
|
|
|
|
Padding(
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.only(top: 18),
|
|
|
|
padding: const EdgeInsets.only(top: 18),
|
|
|
|
child: Image.network(widget.notification.messageTypeData!, loadingBuilder: (BuildContext context, Widget child, ImageChunkEvent? loadingProgress) {
|
|
|
|
child: YoutubePlayer(
|
|
|
|
if (loadingProgress == null) return child;
|
|
|
|
controller: _controller,
|
|
|
|
return Center(
|
|
|
|
showVideoProgressIndicator: true,
|
|
|
|
child: SizedBox(
|
|
|
|
),
|
|
|
|
width: 40.0,
|
|
|
|
|
|
|
|
height: 40.0,
|
|
|
|
|
|
|
|
child: AppCircularProgressIndicator(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}, fit: BoxFit.fill),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height: 18),
|
|
|
|
if (widget.notification.messageTypeData != null)
|
|
|
|
(widget.notification.isExternalRedirect.toString() == "true")
|
|
|
|
if (widget.notification.messageTypeData!.length != 0 && widget.notification.notificationType != "2")
|
|
|
|
? DefaultButton(
|
|
|
|
Padding(
|
|
|
|
projectViewModel.isArabic ? widget.notification.redirectButtonTextAr! : widget.notification.redirectButtonTextEn!,
|
|
|
|
padding: const EdgeInsets.only(top: 18),
|
|
|
|
() {
|
|
|
|
child: Image.network(widget.notification.messageTypeData!, loadingBuilder: (BuildContext context, Widget child, ImageChunkEvent? loadingProgress) {
|
|
|
|
if (Platform.isIOS) {
|
|
|
|
if (loadingProgress == null) return child;
|
|
|
|
launchUrl(Uri.parse(widget.notification.externalRedirectURLIos.toString()));
|
|
|
|
return Center(
|
|
|
|
} else {
|
|
|
|
child: SizedBox(
|
|
|
|
launchUrl(Uri.parse(widget.notification.externalRedirectURLAndroid.toString()));
|
|
|
|
width: 40.0,
|
|
|
|
}
|
|
|
|
height: 40.0,
|
|
|
|
},
|
|
|
|
child: AppCircularProgressIndicator(),
|
|
|
|
color: CustomColors.accentColor,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
: SizedBox(),
|
|
|
|
}, fit: BoxFit.fill),
|
|
|
|
// Text(
|
|
|
|
),
|
|
|
|
// widget.notification.message!.trim(),
|
|
|
|
SizedBox(height: 18),
|
|
|
|
// style: TextStyle(
|
|
|
|
(widget.notification.isExternalRedirect.toString() == "true")
|
|
|
|
// fontSize: 12,
|
|
|
|
? DefaultButton(
|
|
|
|
// fontWeight: FontWeight.w600,
|
|
|
|
projectViewModel.isArabic ? widget.notification.redirectButtonTextAr! : widget.notification.redirectButtonTextEn!,
|
|
|
|
// color: Color(0xff575757),
|
|
|
|
() {
|
|
|
|
// letterSpacing: -0.48,
|
|
|
|
if (Platform.isIOS) {
|
|
|
|
// ),
|
|
|
|
launchUrl(Uri.parse(widget.notification.externalRedirectURLIos.toString()));
|
|
|
|
// ),
|
|
|
|
} else {
|
|
|
|
// Text(
|
|
|
|
launchUrl(Uri.parse(widget.notification.externalRedirectURLAndroid.toString()));
|
|
|
|
// widget.notification.message.trim(),
|
|
|
|
}
|
|
|
|
// style: TextStyle(
|
|
|
|
},
|
|
|
|
// fontSize: 12,
|
|
|
|
color: CustomColors.accentColor,
|
|
|
|
// fontWeight: FontWeight.w600,
|
|
|
|
)
|
|
|
|
// color: Color(0xff575757),
|
|
|
|
: SizedBox(),
|
|
|
|
// letterSpacing: -0.48,
|
|
|
|
// Text(
|
|
|
|
// ),
|
|
|
|
// widget.notification.message!.trim(),
|
|
|
|
// ),
|
|
|
|
// style: TextStyle(
|
|
|
|
],
|
|
|
|
// fontSize: 12,
|
|
|
|
|
|
|
|
// fontWeight: FontWeight.w600,
|
|
|
|
|
|
|
|
// color: Color(0xff575757),
|
|
|
|
|
|
|
|
// letterSpacing: -0.48,
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// Text(
|
|
|
|
|
|
|
|
// widget.notification.message.trim(),
|
|
|
|
|
|
|
|
// style: TextStyle(
|
|
|
|
|
|
|
|
// fontSize: 12,
|
|
|
|
|
|
|
|
// fontWeight: FontWeight.w600,
|
|
|
|
|
|
|
|
// color: Color(0xff575757),
|
|
|
|
|
|
|
|
// letterSpacing: -0.48,
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|