update patient manager window menu
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:fl_downloader/fl_downloader.dart';
|
||||||
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_apis/mih_claim_statement_generation_api.dart';
|
import 'package:mzansi_innovation_hub/mih_apis/mih_claim_statement_generation_api.dart';
|
||||||
@@ -5,6 +8,7 @@ import 'package:mzansi_innovation_hub/mih_apis/mih_file_api.dart';
|
|||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_window.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_delete_message.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_delete_message.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_error_message.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_success_message.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_success_message.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_env/env.dart';
|
import 'package:mzansi_innovation_hub/mih_env/env.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
|
||||||
@@ -15,6 +19,9 @@ import 'package:mzansi_innovation_hub/mih_objects/claim_statement_file.dart';
|
|||||||
import 'package:mzansi_innovation_hub/mih_objects/patients.dart';
|
import 'package:mzansi_innovation_hub/mih_objects/patients.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/patient_profile/pat_profile/list_builders/build_file_view.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/patient_profile/pat_profile/list_builders/build_file_view.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:supertokens_flutter/http.dart' as http;
|
||||||
|
import 'package:http/http.dart' as http2;
|
||||||
|
import "package:universal_html/html.dart" as html;
|
||||||
|
|
||||||
class BuildClaimStatementFileList extends StatefulWidget {
|
class BuildClaimStatementFileList extends StatefulWidget {
|
||||||
final AppUser signedInUser;
|
final AppUser signedInUser;
|
||||||
@@ -46,6 +53,8 @@ class _BuildClaimStatementFileListState
|
|||||||
final baseAPI = AppEnviroment.baseApiUrl;
|
final baseAPI = AppEnviroment.baseApiUrl;
|
||||||
final basefile = AppEnviroment.baseFileUrl;
|
final basefile = AppEnviroment.baseFileUrl;
|
||||||
String fileUrl = "";
|
String fileUrl = "";
|
||||||
|
int progress = 0;
|
||||||
|
late StreamSubscription progressStream;
|
||||||
|
|
||||||
Future<String> getFileUrlApiCall(String filePath) async {
|
Future<String> getFileUrlApiCall(String filePath) async {
|
||||||
String teporaryFileUrl = "";
|
String teporaryFileUrl = "";
|
||||||
@@ -106,16 +115,135 @@ class _BuildClaimStatementFileListState
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getFileName(String path) {
|
||||||
|
//print(pdfLink.split(".")[1]);
|
||||||
|
return path.split("/").last;
|
||||||
|
}
|
||||||
|
|
||||||
|
void printDocument(String link, String path) async {
|
||||||
|
http2.Response response = await http.get(Uri.parse(link));
|
||||||
|
var pdfData = response.bodyBytes;
|
||||||
|
Navigator.of(context).pushNamed(
|
||||||
|
'/file-veiwer/print-preview',
|
||||||
|
arguments: PrintPreviewArguments(
|
||||||
|
pdfData,
|
||||||
|
getFileName(path),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void nativeFileDownload(String fileLink) async {
|
||||||
|
var permission = await FlDownloader.requestPermission();
|
||||||
|
if (permission == StoragePermissionStatus.granted) {
|
||||||
|
try {
|
||||||
|
mihLoadingPopUp();
|
||||||
|
await FlDownloader.download(fileLink);
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
} on Exception catch (error) {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
print(error);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print("denied");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void viewFilePopUp(String fileName, String filePath, int fileID, String url) {
|
void viewFilePopUp(String fileName, String filePath, int fileID, String url) {
|
||||||
bool hasAccessToDelete = false;
|
bool hasAccessToDelete = false;
|
||||||
if (widget.type == "business") {
|
if (widget.type == "business") {
|
||||||
hasAccessToDelete = true;
|
hasAccessToDelete = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<SpeedDialChild>? menuList = [
|
||||||
|
SpeedDialChild(
|
||||||
|
child: Icon(
|
||||||
|
Icons.download,
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
),
|
||||||
|
label: "Download",
|
||||||
|
labelBackgroundColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
backgroundColor: MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
|
onTap: () {
|
||||||
|
if (MzanziInnovationHub.of(context)!.theme.getPlatform() == "Web") {
|
||||||
|
html.window.open(url, 'download');
|
||||||
|
} else {
|
||||||
|
nativeFileDownload(url);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
];
|
||||||
|
menuList.add(
|
||||||
|
SpeedDialChild(
|
||||||
|
child: Icon(
|
||||||
|
Icons.print,
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
),
|
||||||
|
label: "Print",
|
||||||
|
labelBackgroundColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
backgroundColor: MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
|
onTap: () {
|
||||||
|
printDocument(url, filePath);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
menuList.add(
|
||||||
|
SpeedDialChild(
|
||||||
|
child: Icon(
|
||||||
|
Icons.fullscreen,
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
),
|
||||||
|
label: "Full Screen",
|
||||||
|
labelBackgroundColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
backgroundColor: MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
|
onTap: () {
|
||||||
|
printDocument(url, filePath);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (hasAccessToDelete) {
|
||||||
|
menuList.add(
|
||||||
|
SpeedDialChild(
|
||||||
|
child: Icon(
|
||||||
|
Icons.delete,
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
),
|
||||||
|
label: "Delete Document",
|
||||||
|
labelBackgroundColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
backgroundColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
|
onTap: () {
|
||||||
|
deleteFilePopUp(filePath, fileID);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
builder: (context) => MihPackageWindow(
|
builder: (context) => MihPackageWindow(
|
||||||
fullscreen: true,
|
fullscreen: false,
|
||||||
windowTitle: fileName,
|
windowTitle: fileName,
|
||||||
windowBody: Column(
|
windowBody: Column(
|
||||||
children: [
|
children: [
|
||||||
@@ -129,30 +257,7 @@ class _BuildClaimStatementFileListState
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
menuOptions: hasAccessToDelete
|
menuOptions: menuList,
|
||||||
? [
|
|
||||||
SpeedDialChild(
|
|
||||||
child: Icon(
|
|
||||||
Icons.delete,
|
|
||||||
color:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
),
|
|
||||||
label: "Delete Document",
|
|
||||||
labelBackgroundColor:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.successColor(),
|
|
||||||
labelStyle: TextStyle(
|
|
||||||
color:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
backgroundColor:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.successColor(),
|
|
||||||
onTap: () {
|
|
||||||
deleteFilePopUp(filePath, fileID);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
]
|
|
||||||
: null,
|
|
||||||
onWindowTapClose: () {
|
onWindowTapClose: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
@@ -160,12 +265,41 @@ class _BuildClaimStatementFileListState
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mihLoadingPopUp() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return const Mihloadingcircle();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// TODO: implement dispose
|
// TODO: implement dispose
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
FlDownloader.initialize();
|
||||||
|
progressStream = FlDownloader.progressStream.listen((event) {
|
||||||
|
if (event.status == DownloadStatus.successful) {
|
||||||
|
setState(() {
|
||||||
|
progress = event.progress;
|
||||||
|
});
|
||||||
|
//Navigator.of(context).pop();
|
||||||
|
print("Progress $progress%: Success Downloading");
|
||||||
|
FlDownloader.openFile(filePath: event.filePath);
|
||||||
|
} else if (event.status == DownloadStatus.failed) {
|
||||||
|
print("Progress $progress%: Error Downloading");
|
||||||
|
} else if (event.status == DownloadStatus.running) {
|
||||||
|
print("Progress $progress%: Download Running");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (widget.files.isNotEmpty) {
|
if (widget.files.isNotEmpty) {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import 'package:mzansi_innovation_hub/mih_objects/arguments.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:syncfusion_flutter_core/theme.dart';
|
import 'package:syncfusion_flutter_core/theme.dart';
|
||||||
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';
|
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';
|
||||||
import "package:universal_html/html.dart" as html;
|
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:fl_downloader/fl_downloader.dart';
|
import 'package:fl_downloader/fl_downloader.dart';
|
||||||
|
|
||||||
@@ -117,10 +116,7 @@ class _BuildFileViewState extends State<BuildFileView> {
|
|||||||
if (getExtType(widget.path).toLowerCase() == "pdf") {
|
if (getExtType(widget.path).toLowerCase() == "pdf") {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: 500,
|
height: 500,
|
||||||
child: Stack(
|
child: SfPdfViewerTheme(
|
||||||
fit: StackFit.expand,
|
|
||||||
children: [
|
|
||||||
SfPdfViewerTheme(
|
|
||||||
data: SfPdfViewerThemeData(
|
data: SfPdfViewerThemeData(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
@@ -131,134 +127,17 @@ class _BuildFileViewState extends State<BuildFileView> {
|
|||||||
interactionMode: PdfInteractionMode.pan,
|
interactionMode: PdfInteractionMode.pan,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Positioned(
|
|
||||||
bottom: 10,
|
|
||||||
right: 10,
|
|
||||||
width: 50,
|
|
||||||
height: 50,
|
|
||||||
child: IconButton.filled(
|
|
||||||
iconSize: 35,
|
|
||||||
padding: const EdgeInsets.all(0),
|
|
||||||
onPressed: () {
|
|
||||||
printDocument();
|
|
||||||
},
|
|
||||||
icon: Icon(
|
|
||||||
Icons.print,
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
bottom: 10,
|
|
||||||
left: 10,
|
|
||||||
width: 50,
|
|
||||||
height: 50,
|
|
||||||
child: IconButton.filled(
|
|
||||||
iconSize: 35,
|
|
||||||
padding: const EdgeInsets.all(0),
|
|
||||||
onPressed: () async {
|
|
||||||
// debugPrint(
|
|
||||||
// "I'm here ${MzanziInnovationHub.of(context)!.theme.getPlatform()}");
|
|
||||||
if (MzanziInnovationHub.of(context)!.theme.getPlatform() ==
|
|
||||||
"Web") {
|
|
||||||
html.window.open(
|
|
||||||
widget.link,
|
|
||||||
// '${AppEnviroment.baseFileUrl}/mih/$filePath',
|
|
||||||
'download');
|
|
||||||
} else {
|
|
||||||
// print("Here");
|
|
||||||
// var permission = await FlDownloader.requestPermission();
|
|
||||||
// if (permission == StoragePermissionStatus.granted) {
|
|
||||||
// await FlDownloader.download(widget.link);
|
|
||||||
// } else {
|
|
||||||
// print("denied");
|
|
||||||
// }
|
|
||||||
nativeFileDownload(widget.link);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
icon: Icon(
|
|
||||||
Icons.download,
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: 500,
|
height: 500,
|
||||||
child: Stack(
|
child: InteractiveViewer(
|
||||||
fit: StackFit.expand,
|
|
||||||
children: [
|
|
||||||
InteractiveViewer(
|
|
||||||
//constrained: true,
|
//constrained: true,
|
||||||
//clipBehavior: Clip.antiAlias,
|
//clipBehavior: Clip.antiAlias,
|
||||||
maxScale: 5.0,
|
maxScale: 5.0,
|
||||||
//minScale: 0.,
|
//minScale: 0.,
|
||||||
child: Image.network(widget.link),
|
child: Image.network(widget.link),
|
||||||
),
|
),
|
||||||
Positioned(
|
|
||||||
bottom: 10,
|
|
||||||
right: 10,
|
|
||||||
width: 50,
|
|
||||||
height: 50,
|
|
||||||
child: IconButton.filled(
|
|
||||||
iconSize: 35,
|
|
||||||
padding: const EdgeInsets.all(0),
|
|
||||||
onPressed: () {
|
|
||||||
//expandImage(width, height);
|
|
||||||
Navigator.of(context).pushNamed(
|
|
||||||
'/file-veiwer',
|
|
||||||
arguments: FileViewArguments(
|
|
||||||
widget.link,
|
|
||||||
widget.path,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
icon: Icon(
|
|
||||||
Icons.fullscreen,
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
bottom: 10,
|
|
||||||
left: 10,
|
|
||||||
width: 50,
|
|
||||||
height: 50,
|
|
||||||
child: IconButton.filled(
|
|
||||||
iconSize: 35,
|
|
||||||
padding: const EdgeInsets.all(0),
|
|
||||||
onPressed: () async {
|
|
||||||
// debugPrint("I'm here ");
|
|
||||||
// debugPrint(
|
|
||||||
// "I'm here ${MzanziInnovationHub.of(context)!.theme.getPlatform()}");
|
|
||||||
if (MzanziInnovationHub.of(context)!.theme.getPlatform() ==
|
|
||||||
"Web") {
|
|
||||||
html.window.open(
|
|
||||||
widget.link,
|
|
||||||
// '${AppEnviroment.baseFileUrl}/mih/$filePath',
|
|
||||||
'download');
|
|
||||||
} else {
|
|
||||||
//print("Here");
|
|
||||||
// var permission = await FlDownloader.requestPermission();
|
|
||||||
// if (permission == StoragePermissionStatus.granted) {
|
|
||||||
// await FlDownloader.download(widget.link);
|
|
||||||
// } else {
|
|
||||||
// print("denied");
|
|
||||||
// }
|
|
||||||
nativeFileDownload(widget.link);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
icon: Icon(
|
|
||||||
Icons.download,
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:fl_downloader/fl_downloader.dart';
|
import 'package:fl_downloader/fl_downloader.dart';
|
||||||
@@ -50,6 +51,8 @@ class _BuildFilesListState extends State<BuildFilesList> {
|
|||||||
final baseAPI = AppEnviroment.baseApiUrl;
|
final baseAPI = AppEnviroment.baseApiUrl;
|
||||||
final basefile = AppEnviroment.baseFileUrl;
|
final basefile = AppEnviroment.baseFileUrl;
|
||||||
String fileUrl = "";
|
String fileUrl = "";
|
||||||
|
int progress = 0;
|
||||||
|
late StreamSubscription progressStream;
|
||||||
|
|
||||||
Future<String> getFileUrlApiCall(String filePath) async {
|
Future<String> getFileUrlApiCall(String filePath) async {
|
||||||
String teporaryFileUrl = "";
|
String teporaryFileUrl = "";
|
||||||
@@ -200,18 +203,8 @@ class _BuildFilesListState extends State<BuildFilesList> {
|
|||||||
if (widget.type == "business") {
|
if (widget.type == "business") {
|
||||||
hasAccessToDelete = true;
|
hasAccessToDelete = true;
|
||||||
}
|
}
|
||||||
showDialog(
|
|
||||||
context: context,
|
List<SpeedDialChild>? menuList = [
|
||||||
barrierDismissible: false,
|
|
||||||
builder: (context) => MihPackageWindow(
|
|
||||||
fullscreen: false,
|
|
||||||
windowTitle: fileName,
|
|
||||||
windowBody: BuildFileView(
|
|
||||||
link: url,
|
|
||||||
path: filePath,
|
|
||||||
//pdfLink: '${AppEnviroment.baseFileUrl}/mih/$filePath',
|
|
||||||
),
|
|
||||||
menuOptions: [
|
|
||||||
SpeedDialChild(
|
SpeedDialChild(
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.download,
|
Icons.download,
|
||||||
@@ -224,18 +217,18 @@ class _BuildFilesListState extends State<BuildFilesList> {
|
|||||||
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
backgroundColor:
|
backgroundColor: MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
MzanziInnovationHub.of(context)!.theme.successColor(),
|
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (MzanziInnovationHub.of(context)!.theme.getPlatform() ==
|
if (MzanziInnovationHub.of(context)!.theme.getPlatform() == "Web") {
|
||||||
"Web") {
|
|
||||||
html.window.open(url, 'download');
|
html.window.open(url, 'download');
|
||||||
} else {
|
} else {
|
||||||
nativeFileDownload(url);
|
nativeFileDownload(url);
|
||||||
}
|
}
|
||||||
printDocument(url, filePath);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
];
|
||||||
|
if (filePath.split(".").last.toLowerCase() == "pdf") {
|
||||||
|
menuList.add(
|
||||||
SpeedDialChild(
|
SpeedDialChild(
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.print,
|
Icons.print,
|
||||||
@@ -254,39 +247,18 @@ class _BuildFilesListState extends State<BuildFilesList> {
|
|||||||
printDocument(url, filePath);
|
printDocument(url, filePath);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
hasAccessToDelete == true
|
);
|
||||||
? SpeedDialChild(
|
menuList.add(
|
||||||
child: Icon(
|
SpeedDialChild(
|
||||||
Icons.delete,
|
|
||||||
color:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
),
|
|
||||||
label: "Delete Document",
|
|
||||||
labelBackgroundColor:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.successColor(),
|
|
||||||
labelStyle: TextStyle(
|
|
||||||
color:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
backgroundColor:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.successColor(),
|
|
||||||
onTap: () {
|
|
||||||
deleteFilePopUp(filePath, fileID);
|
|
||||||
},
|
|
||||||
)
|
|
||||||
: SpeedDialChild(
|
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.fullscreen,
|
Icons.fullscreen,
|
||||||
color:
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
),
|
),
|
||||||
label: "Full Screen",
|
label: "Full Screen",
|
||||||
labelBackgroundColor:
|
labelBackgroundColor:
|
||||||
MzanziInnovationHub.of(context)!.theme.successColor(),
|
MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
labelStyle: TextStyle(
|
labelStyle: TextStyle(
|
||||||
color:
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
@@ -295,7 +267,69 @@ class _BuildFilesListState extends State<BuildFilesList> {
|
|||||||
printDocument(url, filePath);
|
printDocument(url, filePath);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
);
|
||||||
|
} else {
|
||||||
|
menuList.add(
|
||||||
|
SpeedDialChild(
|
||||||
|
child: Icon(
|
||||||
|
Icons.fullscreen,
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
),
|
||||||
|
label: "Full Screen",
|
||||||
|
labelBackgroundColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
backgroundColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).pushNamed(
|
||||||
|
'/file-veiwer',
|
||||||
|
arguments: FileViewArguments(
|
||||||
|
url,
|
||||||
|
filePath,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (hasAccessToDelete) {
|
||||||
|
menuList.add(
|
||||||
|
SpeedDialChild(
|
||||||
|
child: Icon(
|
||||||
|
Icons.delete,
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
),
|
||||||
|
label: "Delete Document",
|
||||||
|
labelBackgroundColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
backgroundColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
|
onTap: () {
|
||||||
|
deleteFilePopUp(filePath, fileID);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: false,
|
||||||
|
builder: (context) => MihPackageWindow(
|
||||||
|
fullscreen: false,
|
||||||
|
windowTitle: fileName,
|
||||||
|
windowBody: BuildFileView(
|
||||||
|
link: url,
|
||||||
|
path: filePath,
|
||||||
|
//pdfLink: '${AppEnviroment.baseFileUrl}/mih/$filePath',
|
||||||
|
),
|
||||||
|
menuOptions: menuList,
|
||||||
onWindowTapClose: () {
|
onWindowTapClose: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
@@ -318,6 +352,26 @@ class _BuildFilesListState extends State<BuildFilesList> {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
FlDownloader.initialize();
|
||||||
|
progressStream = FlDownloader.progressStream.listen((event) {
|
||||||
|
if (event.status == DownloadStatus.successful) {
|
||||||
|
setState(() {
|
||||||
|
progress = event.progress;
|
||||||
|
});
|
||||||
|
//Navigator.of(context).pop();
|
||||||
|
print("Progress $progress%: Success Downloading");
|
||||||
|
FlDownloader.openFile(filePath: event.filePath);
|
||||||
|
} else if (event.status == DownloadStatus.failed) {
|
||||||
|
print("Progress $progress%: Error Downloading");
|
||||||
|
} else if (event.status == DownloadStatus.running) {
|
||||||
|
print("Progress $progress%: Download Running");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (widget.files.isNotEmpty) {
|
if (widget.files.isNotEmpty) {
|
||||||
|
|||||||
Reference in New Issue
Block a user