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/lib/pages/DrawerPages/notifications/notification_details_page.dart

141 lines
4.8 KiB
Dart

7 months ago
import 'package:hmg_patient_app/core/model/notifications/get_notifications_response_model.dart';
import 'package:hmg_patient_app/uitl/date_uitl.dart';
import 'package:hmg_patient_app/uitl/translations_delegate_base.dart';
import 'package:hmg_patient_app/widgets/others/app_scaffold_widget.dart';
import 'package:hmg_patient_app/widgets/progress_indicator/app_circular_progress_Indeicator.dart';
import 'package:flutter/material.dart';
4 years ago
import 'package:youtube_player_flutter/youtube_player_flutter.dart';
4 years ago
class NotificationsDetailsPage extends StatefulWidget {
final GetNotificationsResponseModel notification;
NotificationsDetailsPage({required this.notification});
4 years ago
@override
State<NotificationsDetailsPage> createState() => _NotificationsDetailsPageState();
}
class _NotificationsDetailsPageState extends State<NotificationsDetailsPage> {
late YoutubePlayerController _controller;
4 years ago
@override
void initState() {
_controller = YoutubePlayerController(
2 years ago
initialVideoId: getVideoURL(),
4 years ago
flags: YoutubePlayerFlags(
autoPlay: true,
4 years ago
mute: false,
4 years ago
),
);
super.initState();
}
getDateForm(String date) {
DateTime d = DateUtil.convertStringToDate(date);
String monthName = DateUtil.getMonth(d.month).toString();
TimeOfDay timeOfDay = TimeOfDay(hour: d.hour, minute: d.minute);
String minute = timeOfDay.minute < 10 ? timeOfDay.minute.toString().padLeft(2, '0') : timeOfDay.minute.toString();
String hour = '${timeOfDay.hourOfPeriod}:$minute';
if (timeOfDay.period == DayPeriod.am) {
hour = hour + "AM";
} else {
{
hour = hour + "PM";
}
}
return monthName + ',${d.day},${d.year}, $hour';
}
2 years ago
String getVideoURL() {
4 years ago
if (widget.notification.videoURL != null && widget.notification.notificationType == "2") {
String videoId;
videoId = YoutubePlayer.convertUrlToId(widget.notification.videoURL)!;
4 years ago
print(videoId); // BBAyRBTfsOU
return videoId;
2 years ago
}else{
return "";
4 years ago
}
4 years ago
}
@override
Widget build(BuildContext context) {
return AppScaffold(
isShowAppBar: true,
showNewAppBar: true,
showNewAppBarTitle: true,
4 years ago
isShowDecPage: false,
appBarTitle: TranslationBase.of(context).notificationDetails,
body: ListView(
physics: BouncingScrollPhysics(),
padding: EdgeInsets.all(21),
children: [
Text(
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.notification.createdOn!)) +
" " +
DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(widget.notification.createdOn!), false),
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Color(0xff2E303A),
letterSpacing: -0.64,
),
),
SizedBox(height: 18),
Text(
1 year ago
widget.notification.message ?? "",
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Color(0xff575757),
letterSpacing: -0.48,
),
),
4 years ago
if (widget.notification.notificationType == "2")
Padding(
padding: const EdgeInsets.only(top: 18),
child: YoutubePlayer(
controller: _controller,
showVideoProgressIndicator: true,
),
),
3 years ago
if (widget.notification.messageTypeData != null)
if (widget.notification.messageTypeData!.length != 0 && widget.notification.notificationType != "2")
3 years ago
Padding(
padding: const EdgeInsets.only(top: 18),
child: Image.network(widget.notification.messageTypeData!, loadingBuilder: (BuildContext context, Widget child, ImageChunkEvent? loadingProgress) {
3 years ago
if (loadingProgress == null) return child;
return Center(
child: SizedBox(
width: 40.0,
height: 40.0,
child: AppCircularProgressIndicator(),
),
);
}, fit: BoxFit.fill),
),
SizedBox(height: 18),
// Text(
Merge branch 'development_v3.3' of http://34.17.52.79/Haroon6138/diplomatic-quarter into dev_v3.13.6 # Conflicts: # lib/config/config.dart # lib/core/model/labs/patient_lab_orders.dart # lib/core/model/labs/request_patient_lab_special_result.dart # lib/core/model/labs/request_send_lab_report_email.dart # lib/core/model/radiology/final_radiology.dart # lib/core/model/radiology/request_send_rad_report_email.dart # lib/core/model/rate/appoitment_rated.dart # lib/core/service/client/base_app_client.dart # lib/core/service/medical/labs_service.dart # lib/core/service/medical/radiology_service.dart # lib/core/viewModels/medical/labs_view_model.dart # lib/core/viewModels/medical/radiology_view_model.dart # lib/models/Authentication/check_activation_code_request.dart # lib/models/FamilyFiles/GetAllSharedRecordsByStatusReq.dart # lib/pages/BookAppointment/BookSuccess.dart # lib/pages/BookAppointment/QRCode.dart # lib/pages/DrawerPages/family/my-family.dart # lib/pages/DrawerPages/notifications/notification_details_page.dart # lib/pages/MyAppointments/AppointmentDetails.dart # lib/pages/MyAppointments/MyAppointments.dart # lib/pages/MyAppointments/widgets/AppointmentActions.dart # lib/pages/ToDoList/ToDo.dart # lib/pages/landing/landing_page.dart # lib/pages/livecare/widgets/clinic_list.dart # lib/pages/login/confirm-login.dart # lib/pages/login/login.dart # lib/pages/medical/labs/laboratory_result_page.dart # lib/pages/medical/radiology/radiology_details_page.dart # lib/services/authentication/auth_provider.dart # lib/splashPage.dart # lib/uitl/push-notification-handler.dart # lib/widgets/drawer/app_drawer_widget.dart
2 years ago
// 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,
// ),
// ),
],
),
);
}
}