Mark Attandence success animation and font settings
parent
203e5ac73c
commit
937c4c18b5
File diff suppressed because one or more lines are too long
@ -0,0 +1,99 @@
|
||||
class Advertisement {
|
||||
Advertisement({
|
||||
this.advertisementId,
|
||||
this.advertisementTitle,
|
||||
this.durationInSeconds,
|
||||
this.showDelete,
|
||||
this.acknowledgment,
|
||||
this.viewAttachFileColl,
|
||||
this.isActive,
|
||||
this.pageSize,
|
||||
this.pageNo,
|
||||
this.languageId,
|
||||
});
|
||||
|
||||
final int? advertisementId;
|
||||
final String? advertisementTitle;
|
||||
final int? durationInSeconds;
|
||||
final bool? showDelete;
|
||||
final dynamic acknowledgment;
|
||||
final List<ViewAttachFileColl>? viewAttachFileColl;
|
||||
final bool? isActive;
|
||||
final dynamic pageSize;
|
||||
final dynamic pageNo;
|
||||
final dynamic languageId;
|
||||
|
||||
factory Advertisement.fromJson(Map<String, dynamic> json) => Advertisement(
|
||||
advertisementId: json["advertisementId"] == null ? null : json["advertisementId"],
|
||||
advertisementTitle: json["advertisementTitle"] == null ? null : json["advertisementTitle"],
|
||||
durationInSeconds: json["durationInSeconds"] == null ? null : json["durationInSeconds"],
|
||||
showDelete: json["showDelete"] == null ? null : json["showDelete"],
|
||||
acknowledgment: json["acknowledgment"],
|
||||
viewAttachFileColl: json["viewAttachFileColl"] == null ? null : List<ViewAttachFileColl>.from(json["viewAttachFileColl"].map((x) => ViewAttachFileColl.fromJson(x))),
|
||||
isActive: json["isActive"] == null ? null : json["isActive"],
|
||||
pageSize: json["pageSize"],
|
||||
pageNo: json["pageNo"],
|
||||
languageId: json["languageId"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"advertisementId": advertisementId == null ? null : advertisementId,
|
||||
"advertisementTitle": advertisementTitle == null ? null : advertisementTitle,
|
||||
"durationInSeconds": durationInSeconds == null ? null : durationInSeconds,
|
||||
"showDelete": showDelete == null ? null : showDelete,
|
||||
"acknowledgment": acknowledgment,
|
||||
"viewAttachFileColl": viewAttachFileColl == null ? null : List<dynamic>.from(viewAttachFileColl!.map((x) => x.toJson())),
|
||||
"isActive": isActive == null ? null : isActive,
|
||||
"pageSize": pageSize,
|
||||
"pageNo": pageNo,
|
||||
"languageId": languageId,
|
||||
};
|
||||
}
|
||||
|
||||
class ViewAttachFileColl {
|
||||
ViewAttachFileColl({
|
||||
this.attachmentId,
|
||||
this.fileName,
|
||||
this.contentType,
|
||||
this.attachFileStream,
|
||||
this.base64String,
|
||||
this.isActive,
|
||||
this.referenceItemId,
|
||||
this.content,
|
||||
this.filePath,
|
||||
});
|
||||
|
||||
final dynamic attachmentId;
|
||||
final String? fileName;
|
||||
final String? contentType;
|
||||
final dynamic attachFileStream;
|
||||
final String? base64String;
|
||||
final dynamic isActive;
|
||||
final dynamic referenceItemId;
|
||||
final dynamic content;
|
||||
final dynamic filePath;
|
||||
|
||||
factory ViewAttachFileColl.fromJson(Map<String, dynamic> json) => ViewAttachFileColl(
|
||||
attachmentId: json["attachmentId"],
|
||||
fileName: json["fileName"] == null ? null : json["fileName"],
|
||||
contentType: json["contentType"] == null ? null : json["contentType"],
|
||||
attachFileStream: json["attachFileStream"],
|
||||
base64String: json["base64String"] == null ? null : json["base64String"],
|
||||
isActive: json["isActive"],
|
||||
referenceItemId: json["referenceItemId"],
|
||||
content: json["content"],
|
||||
filePath: json["filePath"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"attachmentId": attachmentId,
|
||||
"fileName": fileName == null ? null : fileName,
|
||||
"contentType": contentType == null ? null : contentType,
|
||||
"attachFileStream": attachFileStream,
|
||||
"base64String": base64String == null ? null : base64String,
|
||||
"isActive": isActive,
|
||||
"referenceItemId": referenceItemId,
|
||||
"content": content,
|
||||
"filePath": filePath,
|
||||
};
|
||||
}
|
||||
@ -0,0 +1,195 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final itgRes = itgResFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:mohem_flutter_app/models/itg/itg_response_model.dart';
|
||||
|
||||
ItgMainRes itgResFromJson(String str) => ItgMainRes.fromJson(json.decode(str));
|
||||
|
||||
String itgResToJson(ItgMainRes data) => json.encode(data.toJson());
|
||||
|
||||
class ItgMainRes {
|
||||
ItgMainRes({
|
||||
this.date,
|
||||
this.languageId,
|
||||
this.serviceName,
|
||||
this.time,
|
||||
this.androidLink,
|
||||
this.authenticationTokenId,
|
||||
this.data,
|
||||
this.dataw,
|
||||
this.dietType,
|
||||
this.dietTypeId,
|
||||
this.errorCode,
|
||||
this.errorEndUserMessage,
|
||||
this.errorEndUserMessageN,
|
||||
this.errorMessage,
|
||||
this.errorType,
|
||||
this.foodCategory,
|
||||
this.iosLink,
|
||||
this.isAuthenticated,
|
||||
this.mealOrderStatus,
|
||||
this.mealType,
|
||||
this.messageStatus,
|
||||
this.numberOfResultRecords,
|
||||
this.patientBlodType,
|
||||
this.successMsg,
|
||||
this.successMsgN,
|
||||
this.vidaUpdatedResponse,
|
||||
this.itgRequest,
|
||||
this.itgFormAttachmentsList,
|
||||
this.message,
|
||||
this.mohemmItgDepartmentSectionsList,
|
||||
this.mohemmItgPendingTaskResponseItem,
|
||||
this.mohemmItgProjectDepartmentsList,
|
||||
this.mohemmItgResponseItem,
|
||||
this.mohemmItgSectionTopicsList,
|
||||
this.mohemmItgTicketDetailsList,
|
||||
this.mohemmItgTicketTransactionsList,
|
||||
this.mohemmItgTicketsByEmployeeList,
|
||||
this.mohemmItgProjectsList,
|
||||
this.mohemmItgTicketTypesList,
|
||||
this.referenceNumber,
|
||||
this.requestType,
|
||||
this.totalCount,
|
||||
this.statuseCode,
|
||||
});
|
||||
|
||||
final dynamic date;
|
||||
final int? languageId;
|
||||
final int? serviceName;
|
||||
final dynamic time;
|
||||
final dynamic androidLink;
|
||||
final dynamic authenticationTokenId;
|
||||
final dynamic data;
|
||||
final bool? dataw;
|
||||
final int? dietType;
|
||||
final int? dietTypeId;
|
||||
final dynamic errorCode;
|
||||
final dynamic errorEndUserMessage;
|
||||
final dynamic errorEndUserMessageN;
|
||||
final dynamic errorMessage;
|
||||
final int? errorType;
|
||||
final int? foodCategory;
|
||||
final dynamic iosLink;
|
||||
final bool? isAuthenticated;
|
||||
final int? mealOrderStatus;
|
||||
final int? mealType;
|
||||
final int? messageStatus;
|
||||
final int? numberOfResultRecords;
|
||||
final dynamic patientBlodType;
|
||||
final dynamic successMsg;
|
||||
final dynamic successMsgN;
|
||||
final dynamic vidaUpdatedResponse;
|
||||
final dynamic itgRequest;
|
||||
final dynamic itgFormAttachmentsList;
|
||||
final dynamic message;
|
||||
final dynamic mohemmItgDepartmentSectionsList;
|
||||
final dynamic mohemmItgPendingTaskResponseItem;
|
||||
final dynamic mohemmItgProjectDepartmentsList;
|
||||
final MohemmItgResponseItem? mohemmItgResponseItem;
|
||||
final dynamic mohemmItgSectionTopicsList;
|
||||
final dynamic mohemmItgTicketDetailsList;
|
||||
final dynamic mohemmItgTicketTransactionsList;
|
||||
final dynamic mohemmItgTicketsByEmployeeList;
|
||||
final dynamic mohemmItgProjectsList;
|
||||
final dynamic mohemmItgTicketTypesList;
|
||||
final dynamic referenceNumber;
|
||||
final dynamic requestType;
|
||||
final int? totalCount;
|
||||
final int? statuseCode;
|
||||
|
||||
factory ItgMainRes.fromJson(Map<String, dynamic> json) => ItgMainRes(
|
||||
date: json["Date"],
|
||||
languageId: json["LanguageID"] == null ? null : json["LanguageID"],
|
||||
serviceName: json["ServiceName"] == null ? null : json["ServiceName"],
|
||||
time: json["Time"],
|
||||
androidLink: json["AndroidLink"],
|
||||
authenticationTokenId: json["AuthenticationTokenID"],
|
||||
data: json["Data"],
|
||||
dataw: json["Dataw"] == null ? null : json["Dataw"],
|
||||
dietType: json["DietType"] == null ? null : json["DietType"],
|
||||
dietTypeId: json["DietTypeID"] == null ? null : json["DietTypeID"],
|
||||
errorCode: json["ErrorCode"],
|
||||
errorEndUserMessage: json["ErrorEndUserMessage"],
|
||||
errorEndUserMessageN: json["ErrorEndUserMessageN"],
|
||||
errorMessage: json["ErrorMessage"],
|
||||
errorType: json["ErrorType"] == null ? null : json["ErrorType"],
|
||||
foodCategory: json["FoodCategory"] == null ? null : json["FoodCategory"],
|
||||
iosLink: json["IOSLink"],
|
||||
isAuthenticated: json["IsAuthenticated"] == null ? null : json["IsAuthenticated"],
|
||||
mealOrderStatus: json["MealOrderStatus"] == null ? null : json["MealOrderStatus"],
|
||||
mealType: json["MealType"] == null ? null : json["MealType"],
|
||||
messageStatus: json["MessageStatus"] == null ? null : json["MessageStatus"],
|
||||
numberOfResultRecords: json["NumberOfResultRecords"] == null ? null : json["NumberOfResultRecords"],
|
||||
patientBlodType: json["PatientBlodType"],
|
||||
successMsg: json["SuccessMsg"],
|
||||
successMsgN: json["SuccessMsgN"],
|
||||
vidaUpdatedResponse: json["VidaUpdatedResponse"],
|
||||
itgRequest: json["ITGRequest"],
|
||||
itgFormAttachmentsList: json["Itg_FormAttachmentsList"],
|
||||
message: json["Message"],
|
||||
mohemmItgDepartmentSectionsList: json["Mohemm_ITG_DepartmentSectionsList"],
|
||||
mohemmItgPendingTaskResponseItem: json["Mohemm_ITG_Pending_Task_ResponseItem"],
|
||||
mohemmItgProjectDepartmentsList: json["Mohemm_ITG_ProjectDepartmentsList"],
|
||||
mohemmItgResponseItem: json["Mohemm_ITG_ResponseItem"] ==null ? null : MohemmItgResponseItem.fromJson(jsonDecode(json["Mohemm_ITG_ResponseItem"])),
|
||||
mohemmItgSectionTopicsList: json["Mohemm_ITG_SectionTopicsList"],
|
||||
mohemmItgTicketDetailsList: json["Mohemm_ITG_TicketDetailsList"],
|
||||
mohemmItgTicketTransactionsList: json["Mohemm_ITG_TicketTransactionsList"],
|
||||
mohemmItgTicketsByEmployeeList: json["Mohemm_ITG_TicketsByEmployeeList"],
|
||||
mohemmItgProjectsList: json["Mohemm_Itg_ProjectsList"],
|
||||
mohemmItgTicketTypesList: json["Mohemm_Itg_TicketTypesList"],
|
||||
referenceNumber: json["ReferenceNumber"],
|
||||
requestType: json["RequestType"],
|
||||
totalCount: json["TotalCount"] == null ? null : json["TotalCount"],
|
||||
statuseCode: json["statuseCode"] == null ? null : json["statuseCode"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"Date": date,
|
||||
"LanguageID": languageId == null ? null : languageId,
|
||||
"ServiceName": serviceName == null ? null : serviceName,
|
||||
"Time": time,
|
||||
"AndroidLink": androidLink,
|
||||
"AuthenticationTokenID": authenticationTokenId,
|
||||
"Data": data,
|
||||
"Dataw": dataw == null ? null : dataw,
|
||||
"DietType": dietType == null ? null : dietType,
|
||||
"DietTypeID": dietTypeId == null ? null : dietTypeId,
|
||||
"ErrorCode": errorCode,
|
||||
"ErrorEndUserMessage": errorEndUserMessage,
|
||||
"ErrorEndUserMessageN": errorEndUserMessageN,
|
||||
"ErrorMessage": errorMessage,
|
||||
"ErrorType": errorType == null ? null : errorType,
|
||||
"FoodCategory": foodCategory == null ? null : foodCategory,
|
||||
"IOSLink": iosLink,
|
||||
"IsAuthenticated": isAuthenticated == null ? null : isAuthenticated,
|
||||
"MealOrderStatus": mealOrderStatus == null ? null : mealOrderStatus,
|
||||
"MealType": mealType == null ? null : mealType,
|
||||
"MessageStatus": messageStatus == null ? null : messageStatus,
|
||||
"NumberOfResultRecords": numberOfResultRecords == null ? null : numberOfResultRecords,
|
||||
"PatientBlodType": patientBlodType,
|
||||
"SuccessMsg": successMsg,
|
||||
"SuccessMsgN": successMsgN,
|
||||
"VidaUpdatedResponse": vidaUpdatedResponse,
|
||||
"ITGRequest": itgRequest,
|
||||
"Itg_FormAttachmentsList": itgFormAttachmentsList,
|
||||
"Message": message,
|
||||
"Mohemm_ITG_DepartmentSectionsList": mohemmItgDepartmentSectionsList,
|
||||
"Mohemm_ITG_Pending_Task_ResponseItem": mohemmItgPendingTaskResponseItem,
|
||||
"Mohemm_ITG_ProjectDepartmentsList": mohemmItgProjectDepartmentsList,
|
||||
"Mohemm_ITG_ResponseItem": mohemmItgResponseItem == null ? null : mohemmItgResponseItem,
|
||||
"Mohemm_ITG_SectionTopicsList": mohemmItgSectionTopicsList,
|
||||
"Mohemm_ITG_TicketDetailsList": mohemmItgTicketDetailsList,
|
||||
"Mohemm_ITG_TicketTransactionsList": mohemmItgTicketTransactionsList,
|
||||
"Mohemm_ITG_TicketsByEmployeeList": mohemmItgTicketsByEmployeeList,
|
||||
"Mohemm_Itg_ProjectsList": mohemmItgProjectsList,
|
||||
"Mohemm_Itg_TicketTypesList": mohemmItgTicketTypesList,
|
||||
"ReferenceNumber": referenceNumber,
|
||||
"RequestType": requestType,
|
||||
"TotalCount": totalCount == null ? null : totalCount,
|
||||
"statuseCode": statuseCode == null ? null : statuseCode,
|
||||
};
|
||||
}
|
||||
@ -0,0 +1,159 @@
|
||||
// To parse this JSON data, do
|
||||
//
|
||||
// final mohemmItgResponseItem = mohemmItgResponseItemFromJson(jsonString);
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:mohem_flutter_app/models/itg/advertisement.dart';
|
||||
|
||||
MohemmItgResponseItem mohemmItgResponseItemFromJson(String str) => MohemmItgResponseItem.fromJson(json.decode(str));
|
||||
|
||||
String mohemmItgResponseItemToJson(MohemmItgResponseItem data) => json.encode(data.toJson());
|
||||
|
||||
class MohemmItgResponseItem {
|
||||
MohemmItgResponseItem({
|
||||
this.statusCode,
|
||||
this.message,
|
||||
this.originalErrMsg,
|
||||
this.result,
|
||||
});
|
||||
|
||||
final int? statusCode;
|
||||
final dynamic? message;
|
||||
final dynamic? originalErrMsg;
|
||||
final ItgResponseResult? result;
|
||||
|
||||
factory MohemmItgResponseItem.fromJson(Map<String, dynamic> json) => MohemmItgResponseItem(
|
||||
statusCode: json["statusCode"] == null ? null : json["statusCode"],
|
||||
message: json["message"],
|
||||
originalErrMsg: json["originalErrMsg"],
|
||||
result: json["result"] == null ? null : ItgResponseResult.fromJson(json["result"]),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"statusCode": statusCode == null ? null : statusCode,
|
||||
"message": message,
|
||||
"originalErrMsg": originalErrMsg,
|
||||
"result": result == null ? null : result!.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
class ItgResponseResult {
|
||||
ItgResponseResult({
|
||||
this.totalItemsCount,
|
||||
this.data,
|
||||
this.errormsg,
|
||||
});
|
||||
|
||||
final dynamic totalItemsCount;
|
||||
final ItgResponseData? data;
|
||||
final dynamic errormsg;
|
||||
|
||||
factory ItgResponseResult.fromJson(Map<String, dynamic> json) => ItgResponseResult(
|
||||
totalItemsCount: json["totalItemsCount"],
|
||||
data: json["data"] == null ? null : ItgResponseData.fromJson(json["data"]),
|
||||
errormsg: json["errormsg"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"totalItemsCount": totalItemsCount,
|
||||
"data": data == null ? null : data!.toJson(),
|
||||
"errormsg": errormsg,
|
||||
};
|
||||
}
|
||||
|
||||
class ItgResponseData {
|
||||
ItgResponseData({
|
||||
this.notificationMasterId,
|
||||
this.notificationType,
|
||||
this.referenceItemId,
|
||||
this.notificationTitle,
|
||||
this.enableAt,
|
||||
this.applicationItemId,
|
||||
this.startDate,
|
||||
this.endDate,
|
||||
this.isRepeat,
|
||||
this.channelId,
|
||||
this.serviceId,
|
||||
this.channelName,
|
||||
this.serviceName,
|
||||
this.isDeleted,
|
||||
this.showDelete,
|
||||
this.advertisement,
|
||||
this.survey,
|
||||
this.isActive,
|
||||
this.pageSize,
|
||||
this.pageNo,
|
||||
this.languageId,
|
||||
});
|
||||
|
||||
final String? notificationMasterId;
|
||||
final String? notificationType;
|
||||
final int? referenceItemId;
|
||||
final String? notificationTitle;
|
||||
final String? enableAt;
|
||||
final dynamic applicationItemId;
|
||||
final dynamic startDate;
|
||||
final dynamic endDate;
|
||||
final bool? isRepeat;
|
||||
final int? channelId;
|
||||
final int? serviceId;
|
||||
final String? channelName;
|
||||
final String? serviceName;
|
||||
final bool? isDeleted;
|
||||
final bool? showDelete;
|
||||
final Advertisement? advertisement;
|
||||
final dynamic survey;
|
||||
final dynamic isActive;
|
||||
final dynamic pageSize;
|
||||
final dynamic pageNo;
|
||||
final dynamic languageId;
|
||||
|
||||
factory ItgResponseData.fromJson(Map<String, dynamic> json) => ItgResponseData(
|
||||
notificationMasterId: json["notificationMasterId"] == null ? null : json["notificationMasterId"],
|
||||
notificationType: json["notificationType"] == null ? null : json["notificationType"],
|
||||
referenceItemId: json["referenceItemId"] == null ? null : json["referenceItemId"],
|
||||
notificationTitle: json["notificationTitle"] == null ? null : json["notificationTitle"],
|
||||
enableAt: json["enableAt"] == null ? null : json["enableAt"],
|
||||
applicationItemId: json["applicationItemId"],
|
||||
startDate: json["startDate"],
|
||||
endDate: json["endDate"],
|
||||
isRepeat: json["isRepeat"] == null ? null : json["isRepeat"],
|
||||
channelId: json["channelId"] == null ? null : json["channelId"],
|
||||
serviceId: json["serviceId"] == null ? null : json["serviceId"],
|
||||
channelName: json["channelName"] == null ? null : json["channelName"],
|
||||
serviceName: json["serviceName"] == null ? null : json["serviceName"],
|
||||
isDeleted: json["isDeleted"] == null ? null : json["isDeleted"],
|
||||
showDelete: json["showDelete"] == null ? null : json["showDelete"],
|
||||
advertisement: json["advertisement"] == null ? null : Advertisement.fromJson(json["advertisement"]),
|
||||
survey: json["survey"],
|
||||
isActive: json["isActive"],
|
||||
pageSize: json["pageSize"],
|
||||
pageNo: json["pageNo"],
|
||||
languageId: json["languageId"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"notificationMasterId": notificationMasterId == null ? null : notificationMasterId,
|
||||
"notificationType": notificationType == null ? null : notificationType,
|
||||
"referenceItemId": referenceItemId == null ? null : referenceItemId,
|
||||
"notificationTitle": notificationTitle == null ? null : notificationTitle,
|
||||
"enableAt": enableAt == null ? null : enableAt,
|
||||
"applicationItemId": applicationItemId,
|
||||
"startDate": startDate,
|
||||
"endDate": endDate,
|
||||
"isRepeat": isRepeat == null ? null : isRepeat,
|
||||
"channelId": channelId == null ? null : channelId,
|
||||
"serviceId": serviceId == null ? null : serviceId,
|
||||
"channelName": channelName == null ? null : channelName,
|
||||
"serviceName": serviceName == null ? null : serviceName,
|
||||
"isDeleted": isDeleted == null ? null : isDeleted,
|
||||
"showDelete": showDelete == null ? null : showDelete,
|
||||
"advertisement": advertisement,
|
||||
"survey": survey,
|
||||
"isActive": isActive,
|
||||
"pageSize": pageSize,
|
||||
"pageNo": pageNo,
|
||||
"languageId": languageId,
|
||||
};
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lottie/lottie.dart';
|
||||
|
||||
class SuccessDialog extends StatelessWidget {
|
||||
bool isFromDashboard;
|
||||
|
||||
SuccessDialog(this.isFromDashboard);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double size = MediaQuery.of(context).size.width / 1.8;
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: size,
|
||||
height: size,
|
||||
child: Card(
|
||||
child: Lottie.asset('assets/lottie/lt_success.json', repeat: false, reverse: false, onLoaded: (v) {
|
||||
print("calling_lottie " + v.seconds.toString());
|
||||
Future.delayed(Duration(seconds: 2)).then((value) {
|
||||
Navigator.pop(context);
|
||||
if (isFromDashboard) Navigator.pop(context);
|
||||
});
|
||||
}),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io' as Io;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:video_player/video_player.dart';
|
||||
|
||||
class MovieTheaterBody extends StatefulWidget {
|
||||
final String encodedBytes;
|
||||
|
||||
const MovieTheaterBody({required this.encodedBytes});
|
||||
|
||||
@override
|
||||
_MovieTheaterBodyState createState() => _MovieTheaterBodyState();
|
||||
}
|
||||
|
||||
class _MovieTheaterBodyState extends State<MovieTheaterBody> {
|
||||
late Future<VideoPlayerController> _futureController;
|
||||
late VideoPlayerController _controller;
|
||||
|
||||
Future<VideoPlayerController> createVideoPlayer() async {
|
||||
try {
|
||||
var decodedBytes = base64Decode(widget.encodedBytes);
|
||||
|
||||
var file = Io.File("decodedBezkoder.mp4");
|
||||
file.writeAsBytesSync(decodedBytes);
|
||||
|
||||
VideoPlayerController controller = VideoPlayerController.file(file);
|
||||
await controller.initialize();
|
||||
await controller.setLooping(true);
|
||||
return controller;
|
||||
} catch (e) {
|
||||
print("object0000000");
|
||||
print(e);
|
||||
return new VideoPlayerController.asset("dataSource");
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_futureController = createVideoPlayer();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Expanded(
|
||||
child: FutureBuilder(
|
||||
future: _futureController,
|
||||
builder: (context, snapshot) {
|
||||
//UST: 05/2021 - MovieTheaterBody - id:11 - 2pts - Criação
|
||||
if (snapshot.connectionState == ConnectionState.done && snapshot.data != null) {
|
||||
_controller = snapshot.data as VideoPlayerController;
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
AspectRatio(
|
||||
aspectRatio: _controller.value.aspectRatio,
|
||||
child: VideoPlayer(_controller),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 50,
|
||||
),
|
||||
FloatingActionButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
if (_controller.value.isPlaying) {
|
||||
_controller.pause();
|
||||
} else {
|
||||
// If the video is paused, play it.
|
||||
_controller.play();
|
||||
}
|
||||
});
|
||||
},
|
||||
backgroundColor: Colors.green[700],
|
||||
child: Icon(
|
||||
_controller.value.isPlaying ? Icons.pause : Icons.play_arrow,
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
} else {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue