|
|
|
|
@ -4,12 +4,32 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:youtube_player_flutter/youtube_player_flutter.dart';
|
|
|
|
|
|
|
|
|
|
class NotificationsDetailsPage extends StatelessWidget {
|
|
|
|
|
class NotificationsDetailsPage extends StatefulWidget {
|
|
|
|
|
final GetNotificationsResponseModel notification;
|
|
|
|
|
|
|
|
|
|
NotificationsDetailsPage({this.notification});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<NotificationsDetailsPage> createState() => _NotificationsDetailsPageState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _NotificationsDetailsPageState extends State<NotificationsDetailsPage> {
|
|
|
|
|
YoutubePlayerController _controller;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
_controller = YoutubePlayerController(
|
|
|
|
|
initialVideoId: getVideoURL(),
|
|
|
|
|
flags: YoutubePlayerFlags(
|
|
|
|
|
autoPlay: true,
|
|
|
|
|
mute: true,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getDateForm(String date) {
|
|
|
|
|
DateTime d = DateUtil.convertStringToDate(date);
|
|
|
|
|
String monthName = DateUtil.getMonth(d.month).toString();
|
|
|
|
|
@ -27,6 +47,13 @@ class NotificationsDetailsPage extends StatelessWidget {
|
|
|
|
|
return monthName + ',${d.day},${d.year}, $hour';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String getVideoURL() {
|
|
|
|
|
String videoId;
|
|
|
|
|
videoId = YoutubePlayer.convertUrlToId(widget.notification.videoURL);
|
|
|
|
|
print(videoId); // BBAyRBTfsOU
|
|
|
|
|
return videoId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
@ -40,9 +67,9 @@ class NotificationsDetailsPage extends StatelessWidget {
|
|
|
|
|
padding: EdgeInsets.all(21),
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(notification.createdOn)) +
|
|
|
|
|
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.notification.createdOn)) +
|
|
|
|
|
" " +
|
|
|
|
|
DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(notification.createdOn), false),
|
|
|
|
|
DateUtil.formatDateToTimeLang(DateUtil.convertStringToDate(widget.notification.createdOn), false),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
@ -50,10 +77,18 @@ class NotificationsDetailsPage extends StatelessWidget {
|
|
|
|
|
letterSpacing: -0.64,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (notification.messageTypeData.length != 0)
|
|
|
|
|
if (widget.notification.notificationType == "2")
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(top: 18),
|
|
|
|
|
child: YoutubePlayer(
|
|
|
|
|
controller: _controller,
|
|
|
|
|
showVideoProgressIndicator: true,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (widget.notification.messageTypeData.length != 0 && widget.notification.notificationType != "2")
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(top: 18),
|
|
|
|
|
child: Image.network(notification.messageTypeData, loadingBuilder: (BuildContext context, Widget child, ImageChunkEvent loadingProgress) {
|
|
|
|
|
child: Image.network(widget.notification.messageTypeData, loadingBuilder: (BuildContext context, Widget child, ImageChunkEvent loadingProgress) {
|
|
|
|
|
if (loadingProgress == null) return child;
|
|
|
|
|
return Center(
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
@ -66,7 +101,7 @@ class NotificationsDetailsPage extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 18),
|
|
|
|
|
Text(
|
|
|
|
|
notification.message.trim(),
|
|
|
|
|
widget.notification.message.trim(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
|