update file view to work with window builder
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:patient_manager/main.dart';
|
|||||||
import 'package:patient_manager/mih_objects/arguments.dart';
|
import 'package:patient_manager/mih_objects/arguments.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;
|
||||||
|
|
||||||
class BuildFileView extends StatefulWidget {
|
class BuildFileView extends StatefulWidget {
|
||||||
final String link;
|
final String link;
|
||||||
@@ -41,89 +42,135 @@ class _BuildFileViewState extends State<BuildFileView> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// double width = MediaQuery.sizeOf(context).width;
|
// double width = MediaQuery.sizeOf(context).width;
|
||||||
// double height = MediaQuery.sizeOf(context).height;
|
//double height = MediaQuery.sizeOf(context).height;
|
||||||
if (getExtType(widget.path).toLowerCase() == "pdf") {
|
if (getExtType(widget.path).toLowerCase() == "pdf") {
|
||||||
//print(widget.pdfLink);
|
//print(widget.pdfLink);
|
||||||
return Stack(
|
return Expanded(
|
||||||
children: [
|
child: Stack(
|
||||||
Column(
|
children: [
|
||||||
children: [
|
Padding(
|
||||||
Expanded(
|
padding: const EdgeInsets.all(10),
|
||||||
child: SfPdfViewerTheme(
|
child: Column(
|
||||||
data: SfPdfViewerThemeData(
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
backgroundColor:
|
mainAxisSize: MainAxisSize.max,
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: SfPdfViewerTheme(
|
||||||
|
data: SfPdfViewerThemeData(
|
||||||
|
backgroundColor: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.primaryColor(),
|
||||||
|
),
|
||||||
|
child: SfPdfViewer.network(
|
||||||
|
widget.link,
|
||||||
|
controller: pdfViewerController,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
child: SfPdfViewer.network(
|
],
|
||||||
widget.link,
|
|
||||||
controller: pdfViewerController,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
top: 5,
|
|
||||||
right: 5,
|
|
||||||
width: 50,
|
|
||||||
height: 50,
|
|
||||||
child: IconButton.filled(
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pushNamed(
|
|
||||||
'/file-veiwer',
|
|
||||||
arguments: FileViewArguments(
|
|
||||||
widget.link,
|
|
||||||
widget.path,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
icon: Icon(
|
|
||||||
Icons.fullscreen,
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
size: 35,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
Positioned(
|
||||||
],
|
bottom: 10,
|
||||||
|
right: 10,
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
child: IconButton.filled(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pushNamed(
|
||||||
|
'/file-veiwer',
|
||||||
|
arguments: FileViewArguments(
|
||||||
|
widget.link,
|
||||||
|
widget.path,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: Icon(
|
||||||
|
Icons.fullscreen,
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
bottom: 10,
|
||||||
|
left: 10,
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
child: IconButton.filled(
|
||||||
|
onPressed: () {
|
||||||
|
html.window.open(
|
||||||
|
widget.link,
|
||||||
|
// '${AppEnviroment.baseFileUrl}/mih/$filePath',
|
||||||
|
'download');
|
||||||
|
},
|
||||||
|
icon: Icon(
|
||||||
|
Icons.download,
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return Stack(
|
return Expanded(
|
||||||
children: [
|
child: Stack(
|
||||||
Column(
|
fit: StackFit.expand,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Padding(
|
||||||
child: InteractiveViewer(
|
padding: const EdgeInsets.all(10.0),
|
||||||
maxScale: 5.0,
|
child: InteractiveViewer(
|
||||||
//minScale: 0.,
|
maxScale: 5.0,
|
||||||
child: Image.network(widget.link),
|
//minScale: 0.,
|
||||||
),
|
child: Image.network(widget.link),
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
top: 5,
|
|
||||||
right: 5,
|
|
||||||
width: 50,
|
|
||||||
height: 50,
|
|
||||||
child: IconButton.filled(
|
|
||||||
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(),
|
|
||||||
size: 35,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
Positioned(
|
||||||
],
|
bottom: 10,
|
||||||
|
right: 10,
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
child: IconButton.filled(
|
||||||
|
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(),
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
bottom: 10,
|
||||||
|
left: 10,
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
child: IconButton.filled(
|
||||||
|
onPressed: () {
|
||||||
|
html.window.open(
|
||||||
|
widget.link,
|
||||||
|
// '${AppEnviroment.baseFileUrl}/mih/$filePath',
|
||||||
|
'download');
|
||||||
|
},
|
||||||
|
icon: Icon(
|
||||||
|
Icons.download,
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:patient_manager/mih_components/mih_layout/mih_window.dart';
|
||||||
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
||||||
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_delete_message.dart';
|
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_delete_message.dart';
|
||||||
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_error_message.dart';
|
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_error_message.dart';
|
||||||
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_success_message.dart';
|
import 'package:patient_manager/mih_components/mih_pop_up_messages/mih_success_message.dart';
|
||||||
import 'package:patient_manager/mih_components/mih_inputs_and_buttons/mih_button.dart';
|
|
||||||
import 'package:patient_manager/mih_env/env.dart';
|
import 'package:patient_manager/mih_env/env.dart';
|
||||||
import 'package:patient_manager/main.dart';
|
import 'package:patient_manager/main.dart';
|
||||||
import 'package:patient_manager/mih_packages/patient_profile/builder/build_file_view.dart';
|
import 'package:patient_manager/mih_packages/patient_profile/builder/build_file_view.dart';
|
||||||
@@ -16,7 +16,6 @@ import 'package:patient_manager/mih_objects/business_user.dart';
|
|||||||
import 'package:patient_manager/mih_objects/files.dart';
|
import 'package:patient_manager/mih_objects/files.dart';
|
||||||
import 'package:patient_manager/mih_objects/patients.dart';
|
import 'package:patient_manager/mih_objects/patients.dart';
|
||||||
import 'package:supertokens_flutter/http.dart' as http;
|
import 'package:supertokens_flutter/http.dart' as http;
|
||||||
import "package:universal_html/html.dart" as html;
|
|
||||||
|
|
||||||
class BuildFilesList extends StatefulWidget {
|
class BuildFilesList extends StatefulWidget {
|
||||||
final AppUser signedInUser;
|
final AppUser signedInUser;
|
||||||
@@ -191,103 +190,132 @@ class _BuildFilesListState extends State<BuildFilesList> {
|
|||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
builder: (context) => Dialog(
|
builder: (context) => MIHWindow(
|
||||||
child: Stack(
|
windowTitle: fileName,
|
||||||
children: [
|
windowItems: [
|
||||||
Container(
|
BuildFileView(
|
||||||
padding: const EdgeInsets.all(10.0),
|
link: url,
|
||||||
width: 800.0,
|
path: filePath,
|
||||||
//height: 475.0,
|
//pdfLink: '${AppEnviroment.baseFileUrl}/mih/$filePath',
|
||||||
decoration: BoxDecoration(
|
),
|
||||||
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
],
|
||||||
borderRadius: BorderRadius.circular(25.0),
|
actionItems: [
|
||||||
border: Border.all(
|
IconButton(
|
||||||
color:
|
onPressed: () {
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
deleteFilePopUp(filePath, fileID);
|
||||||
width: 5.0),
|
},
|
||||||
),
|
icon: Icon(
|
||||||
child: Column(
|
size: 35,
|
||||||
mainAxisSize: MainAxisSize.min,
|
Icons.delete,
|
||||||
children: [
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
const SizedBox(
|
|
||||||
height: 25,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
fileName,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
color: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.secondaryColor(),
|
|
||||||
fontSize: 35.0,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25.0),
|
|
||||||
Expanded(
|
|
||||||
child: BuildFileView(
|
|
||||||
link: url,
|
|
||||||
path: filePath,
|
|
||||||
//pdfLink: '${AppEnviroment.baseFileUrl}/mih/$filePath',
|
|
||||||
)),
|
|
||||||
const SizedBox(height: 30.0),
|
|
||||||
SizedBox(
|
|
||||||
width: 300,
|
|
||||||
height: 50,
|
|
||||||
child: MIHButton(
|
|
||||||
onTap: () {
|
|
||||||
html.window.open(
|
|
||||||
url,
|
|
||||||
// '${AppEnviroment.baseFileUrl}/mih/$filePath',
|
|
||||||
'download');
|
|
||||||
},
|
|
||||||
buttonText: "Dowload",
|
|
||||||
buttonColor: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.secondaryColor(),
|
|
||||||
textColor:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Positioned(
|
),
|
||||||
top: 5,
|
],
|
||||||
right: 5,
|
onTapClose: () {
|
||||||
width: 50,
|
Navigator.pop(context);
|
||||||
height: 50,
|
},
|
||||||
child: IconButton(
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
icon: Icon(
|
|
||||||
Icons.close,
|
|
||||||
color: MzanziInnovationHub.of(context)!.theme.errorColor(),
|
|
||||||
size: 35,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
top: 5,
|
|
||||||
left: 5,
|
|
||||||
width: 50,
|
|
||||||
height: 50,
|
|
||||||
child: IconButton(
|
|
||||||
onPressed: () {
|
|
||||||
deleteFilePopUp(filePath, fileID);
|
|
||||||
},
|
|
||||||
icon: Icon(
|
|
||||||
Icons.delete,
|
|
||||||
color:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
// showDialog(
|
||||||
|
// context: context,
|
||||||
|
// barrierDismissible: false,
|
||||||
|
// builder: (context) => Dialog(
|
||||||
|
// child: Stack(
|
||||||
|
// children: [
|
||||||
|
// Container(
|
||||||
|
// padding: const EdgeInsets.all(10.0),
|
||||||
|
// width: 800.0,
|
||||||
|
// //height: 475.0,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
// borderRadius: BorderRadius.circular(25.0),
|
||||||
|
// border: Border.all(
|
||||||
|
// color:
|
||||||
|
// MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
// width: 5.0),
|
||||||
|
// ),
|
||||||
|
// child: Column(
|
||||||
|
// mainAxisSize: MainAxisSize.min,
|
||||||
|
// children: [
|
||||||
|
// const SizedBox(
|
||||||
|
// height: 25,
|
||||||
|
// ),
|
||||||
|
// Text(
|
||||||
|
// fileName,
|
||||||
|
// textAlign: TextAlign.center,
|
||||||
|
// style: TextStyle(
|
||||||
|
// color: MzanziInnovationHub.of(context)!
|
||||||
|
// .theme
|
||||||
|
// .secondaryColor(),
|
||||||
|
// fontSize: 35.0,
|
||||||
|
// fontWeight: FontWeight.bold,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// const SizedBox(height: 25.0),
|
||||||
|
// Expanded(
|
||||||
|
// child: BuildFileView(
|
||||||
|
// link: url,
|
||||||
|
// path: filePath,
|
||||||
|
// //pdfLink: '${AppEnviroment.baseFileUrl}/mih/$filePath',
|
||||||
|
// )),
|
||||||
|
// const SizedBox(height: 30.0),
|
||||||
|
// SizedBox(
|
||||||
|
// width: 300,
|
||||||
|
// height: 50,
|
||||||
|
// child: MIHButton(
|
||||||
|
// onTap: () {
|
||||||
|
// html.window.open(
|
||||||
|
// url,
|
||||||
|
// // '${AppEnviroment.baseFileUrl}/mih/$filePath',
|
||||||
|
// 'download');
|
||||||
|
// },
|
||||||
|
// buttonText: "Dowload",
|
||||||
|
// buttonColor: MzanziInnovationHub.of(context)!
|
||||||
|
// .theme
|
||||||
|
// .secondaryColor(),
|
||||||
|
// textColor:
|
||||||
|
// MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
// ),
|
||||||
|
// )
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// Positioned(
|
||||||
|
// top: 5,
|
||||||
|
// right: 5,
|
||||||
|
// width: 50,
|
||||||
|
// height: 50,
|
||||||
|
// child: IconButton(
|
||||||
|
// onPressed: () {
|
||||||
|
// Navigator.pop(context);
|
||||||
|
// },
|
||||||
|
// icon: Icon(
|
||||||
|
// Icons.close,
|
||||||
|
// color: MzanziInnovationHub.of(context)!.theme.errorColor(),
|
||||||
|
// size: 35,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// Positioned(
|
||||||
|
// top: 5,
|
||||||
|
// left: 5,
|
||||||
|
// width: 50,
|
||||||
|
// height: 50,
|
||||||
|
// child: IconButton(
|
||||||
|
// onPressed: () {
|
||||||
|
// deleteFilePopUp(filePath, fileID);
|
||||||
|
// },
|
||||||
|
// icon: Icon(
|
||||||
|
// Icons.delete,
|
||||||
|
// color:
|
||||||
|
// MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
Reference in New Issue
Block a user