NEW: create new file viewer with MIH package
This commit is contained in:
@@ -8,6 +8,7 @@ import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_authentic
|
|||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_banner_ad_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_banner_ad_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_calculator_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_calculator_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_calendar_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_calendar_provider.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_file_viewer_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_mine_sweeper_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_mine_sweeper_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_ai_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_ai_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_directory_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_directory_provider.dart';
|
||||||
@@ -141,6 +142,9 @@ class _MzansiInnovationHubState extends State<MzansiInnovationHub> {
|
|||||||
ChangeNotifierProvider(
|
ChangeNotifierProvider(
|
||||||
create: (context) => PatientManagerProvider(),
|
create: (context) => PatientManagerProvider(),
|
||||||
),
|
),
|
||||||
|
ChangeNotifierProvider(
|
||||||
|
create: (context) => MihFileViewerProvider(),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
child: MaterialApp.router(
|
child: MaterialApp.router(
|
||||||
title: AppEnviroment.getEnv() == "Dev"
|
title: AppEnviroment.getEnv() == "Dev"
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class MihFileViewerProvider extends ChangeNotifier {
|
||||||
|
String filePath;
|
||||||
|
String fileLink;
|
||||||
|
int toolIndex;
|
||||||
|
|
||||||
|
MihFileViewerProvider({
|
||||||
|
this.filePath = '',
|
||||||
|
this.fileLink = '',
|
||||||
|
this.toolIndex = 0,
|
||||||
|
});
|
||||||
|
|
||||||
|
void setToolIndex(int index) {
|
||||||
|
toolIndex = index;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setFilePath(String path) {
|
||||||
|
filePath = path;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setFileLink(String name) {
|
||||||
|
fileLink = name;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_layout/mih_print_prevew.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mih_file_viewer/components/mih_print_prevew.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/Example/package_test.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/Example/package_test.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_directory_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_directory_provider.dart';
|
||||||
@@ -11,6 +11,7 @@ import 'package:mzansi_innovation_hub/mih_packages/calendar/mzansi_calendar.dart
|
|||||||
import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/mih_auth_forgot_password.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/mih_auth_forgot_password.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/mih_auth_password_reset.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/mih_auth_password_reset.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/mih_authentication.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mih_authentication/mih_authentication.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_packages/mih_file_viewer/mih_fle_viewer.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mih_home/mih_home.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mih_home/mih_home.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mih_home/mih_route_error.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mih_home/mih_route_error.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mine_sweeper/mih_mine_sweeper.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mine_sweeper/mih_mine_sweeper.dart';
|
||||||
@@ -25,7 +26,6 @@ import 'package:ken_logger/ken_logger.dart';
|
|||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/components/mih_barcode_scanner.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/components/mih_barcode_scanner.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/mih_wallet.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/mih_wallet.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_manager/pat_manager.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_manager/pat_manager.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/components/full_screen_file.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/patient_profile.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/patient_profile.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/patient_set_up.dart';
|
import 'package:mzansi_innovation_hub/mih_packages/patient_manager/pat_profile/patient_set_up.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@@ -327,14 +327,7 @@ class MihGoRouter {
|
|||||||
path: MihGoRouterPaths.fileViewer,
|
path: MihGoRouterPaths.fileViewer,
|
||||||
builder: (BuildContext context, GoRouterState state) {
|
builder: (BuildContext context, GoRouterState state) {
|
||||||
KenLogger.success("MihGoRouter: fileViewer");
|
KenLogger.success("MihGoRouter: fileViewer");
|
||||||
final FileViewArguments? args = state.extra as FileViewArguments?;
|
return MihFleViewer();
|
||||||
if (args == null) {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
context.go(MihGoRouterPaths.mihHome);
|
|
||||||
});
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
}
|
|
||||||
return FullScreenFileViewer(arguments: args);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_action.dart';
|
||||||
|
import 'package:pdf/pdf.dart';
|
||||||
|
import 'package:printing/printing.dart';
|
||||||
|
import '../../../mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
||||||
|
|
||||||
|
class MIHPrintPreview extends StatefulWidget {
|
||||||
|
final PrintPreviewArguments arguments;
|
||||||
|
const MIHPrintPreview({
|
||||||
|
super.key,
|
||||||
|
required this.arguments,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MIHPrintPreview> createState() => _MIHPrintPreviewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MIHPrintPreviewState extends State<MIHPrintPreview> {
|
||||||
|
MihPackageAction getActionButton() {
|
||||||
|
return MihPackageAction(
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.close,
|
||||||
|
),
|
||||||
|
iconSize: 35,
|
||||||
|
onTap: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return PdfPreview(
|
||||||
|
pdfFileName: widget.arguments.fileName,
|
||||||
|
initialPageFormat: PdfPageFormat.a4,
|
||||||
|
loadingWidget: const Mihloadingcircle(),
|
||||||
|
actions: [getActionButton()],
|
||||||
|
build: (format) => widget.arguments.pdfData,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_action.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tools.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_file_viewer_provider.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_packages/mih_file_viewer/package_tools/mih_expandedFileView.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class MihFleViewer extends StatefulWidget {
|
||||||
|
const MihFleViewer({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MihFleViewer> createState() => _MihFleViewerState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MihFleViewerState extends State<MihFleViewer> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Consumer<MihFileViewerProvider>(
|
||||||
|
builder: (BuildContext context, MihFileViewerProvider fileViewerProvider,
|
||||||
|
Widget? child) {
|
||||||
|
return MihPackage(
|
||||||
|
appActionButton: getAction(),
|
||||||
|
appTools: getTools(),
|
||||||
|
appBody: getToolBody(),
|
||||||
|
appToolTitles: getToolTitle(),
|
||||||
|
selectedbodyIndex: fileViewerProvider.toolIndex,
|
||||||
|
onIndexChange: (newIndex) {
|
||||||
|
fileViewerProvider.setToolIndex(newIndex);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
MihPackageAction getAction() {
|
||||||
|
return MihPackageAction(
|
||||||
|
icon: const Icon(Icons.fullscreen_exit),
|
||||||
|
iconSize: 35,
|
||||||
|
onTap: () {
|
||||||
|
context.pop();
|
||||||
|
FocusScope.of(context).unfocus();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> getToolTitle() {
|
||||||
|
List<String> toolTitles = [
|
||||||
|
"File Viewer",
|
||||||
|
];
|
||||||
|
return toolTitles;
|
||||||
|
}
|
||||||
|
|
||||||
|
MihPackageTools getTools() {
|
||||||
|
Map<Widget, void Function()?> temp = {};
|
||||||
|
temp[const Icon(Icons.file_present)] = () {
|
||||||
|
context.read<MihFileViewerProvider>().setToolIndex(0);
|
||||||
|
};
|
||||||
|
return MihPackageTools(
|
||||||
|
tools: temp,
|
||||||
|
selcetedIndex: context.watch<MihFileViewerProvider>().toolIndex,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Widget> getToolBody() {
|
||||||
|
List<Widget> toolBodies = [
|
||||||
|
MihExpandedfileview(),
|
||||||
|
];
|
||||||
|
return toolBodies;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,274 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:ken_logger/ken_logger.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tool_body.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_file_viewer_provider.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:syncfusion_flutter_core/theme.dart';
|
||||||
|
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';
|
||||||
|
import "package:universal_html/html.dart" as html;
|
||||||
|
import 'package:fl_downloader/fl_downloader.dart';
|
||||||
|
|
||||||
|
class MihExpandedfileview extends StatefulWidget {
|
||||||
|
const MihExpandedfileview({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MihExpandedfileview> createState() => _MihExpandedfileviewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MihExpandedfileviewState extends State<MihExpandedfileview> {
|
||||||
|
late PdfViewerController pdfViewerController = PdfViewerController();
|
||||||
|
int currentPageCount = 0;
|
||||||
|
int currentPage = 0;
|
||||||
|
double startZoomLevel = 1.0;
|
||||||
|
double zoomOut = 0;
|
||||||
|
int progress = 0;
|
||||||
|
late StreamSubscription progressStream;
|
||||||
|
|
||||||
|
void nativeFileDownload(String fileLink) async {
|
||||||
|
var permission = await FlDownloader.requestPermission();
|
||||||
|
if (permission == StoragePermissionStatus.granted) {
|
||||||
|
try {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return const Mihloadingcircle();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
await FlDownloader.download(fileLink);
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
} on Exception catch (error) {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
print(error);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print("denied");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final Size size = MediaQuery.sizeOf(context);
|
||||||
|
double width = size.width;
|
||||||
|
double height = size.height;
|
||||||
|
return MihPackageToolBody(
|
||||||
|
borderOn: false,
|
||||||
|
bodyItem: getBody(width, height),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget getBody(double width, double height) {
|
||||||
|
return Consumer<MihFileViewerProvider>(
|
||||||
|
builder: (BuildContext context, MihFileViewerProvider fileViewerProvider,
|
||||||
|
Widget? child) {
|
||||||
|
KenLogger.success(
|
||||||
|
"file Path: ${fileViewerProvider.filePath.split(".").last.toLowerCase()}");
|
||||||
|
bool isPDF =
|
||||||
|
fileViewerProvider.filePath.split(".").last.toLowerCase() == "pdf";
|
||||||
|
return Stack(
|
||||||
|
children: [
|
||||||
|
fileViewerProvider.filePath.split(".").last.toLowerCase() == "pdf"
|
||||||
|
? SizedBox(
|
||||||
|
width: width - zoomOut,
|
||||||
|
height: height - 70,
|
||||||
|
child: SfPdfViewerTheme(
|
||||||
|
data: SfPdfViewerThemeData(
|
||||||
|
backgroundColor: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
),
|
||||||
|
child: SfPdfViewer.network(
|
||||||
|
fileViewerProvider.fileLink,
|
||||||
|
controller: pdfViewerController,
|
||||||
|
initialZoomLevel: startZoomLevel,
|
||||||
|
pageSpacing: 2,
|
||||||
|
maxZoomLevel: 5,
|
||||||
|
interactionMode: PdfInteractionMode.pan,
|
||||||
|
onDocumentLoaded: (details) {
|
||||||
|
setState(() {
|
||||||
|
currentPage = pdfViewerController.pageNumber;
|
||||||
|
currentPageCount = pdfViewerController.pageCount;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: SizedBox(
|
||||||
|
width: width,
|
||||||
|
height: height - 70,
|
||||||
|
child: InteractiveViewer(
|
||||||
|
maxScale: 5.0,
|
||||||
|
//minScale: 0.,
|
||||||
|
child: Image.network(fileViewerProvider.fileLink),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 20.0),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
child: Material(
|
||||||
|
elevation: 10,
|
||||||
|
shadowColor: Colors.black,
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
borderRadius: BorderRadius.circular(25.0),
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(25.0),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
if (isPDF)
|
||||||
|
IconButton(
|
||||||
|
iconSize: 30,
|
||||||
|
padding: const EdgeInsets.all(0),
|
||||||
|
onPressed: () {
|
||||||
|
pdfViewerController.previousPage();
|
||||||
|
//print(pdfViewerController.);
|
||||||
|
//if (pdfViewerController.pageNumber > 1) {
|
||||||
|
setState(() {
|
||||||
|
currentPage = pdfViewerController.pageNumber;
|
||||||
|
});
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
icon: Icon(
|
||||||
|
Icons.arrow_back,
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (isPDF)
|
||||||
|
Text(
|
||||||
|
"$currentPage / $currentPageCount",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (isPDF)
|
||||||
|
IconButton(
|
||||||
|
iconSize: 30,
|
||||||
|
padding: const EdgeInsets.all(0),
|
||||||
|
onPressed: () {
|
||||||
|
pdfViewerController.nextPage();
|
||||||
|
//print(pdfViewerController.pageNumber);
|
||||||
|
//if (pdfViewerController.pageNumber < currentPageCount) {
|
||||||
|
setState(() {
|
||||||
|
currentPage = pdfViewerController.pageNumber;
|
||||||
|
});
|
||||||
|
//}
|
||||||
|
},
|
||||||
|
icon: Icon(
|
||||||
|
Icons.arrow_forward,
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (isPDF)
|
||||||
|
IconButton(
|
||||||
|
iconSize: 30,
|
||||||
|
padding: const EdgeInsets.all(0),
|
||||||
|
onPressed: () {
|
||||||
|
if (zoomOut > 0) {
|
||||||
|
setState(() {
|
||||||
|
zoomOut = zoomOut - 100;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
pdfViewerController.zoomLevel =
|
||||||
|
startZoomLevel + 0.25;
|
||||||
|
startZoomLevel =
|
||||||
|
pdfViewerController.zoomLevel;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
icon: Icon(
|
||||||
|
Icons.zoom_in,
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (isPDF)
|
||||||
|
IconButton(
|
||||||
|
iconSize: 30,
|
||||||
|
padding: const EdgeInsets.all(0),
|
||||||
|
onPressed: () {
|
||||||
|
if (pdfViewerController.zoomLevel > 1) {
|
||||||
|
setState(() {
|
||||||
|
pdfViewerController.zoomLevel =
|
||||||
|
startZoomLevel - 0.25;
|
||||||
|
startZoomLevel =
|
||||||
|
pdfViewerController.zoomLevel;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if (zoomOut < (width - 100)) {
|
||||||
|
setState(() {
|
||||||
|
zoomOut = zoomOut + 100;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
icon: Icon(
|
||||||
|
Icons.zoom_out,
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// IconButton(
|
||||||
|
// iconSize: 30,
|
||||||
|
// padding: const EdgeInsets.all(0),
|
||||||
|
// onPressed: () {
|
||||||
|
// printDocument();
|
||||||
|
// },
|
||||||
|
// icon: Icon(
|
||||||
|
// Icons.print,
|
||||||
|
// color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
IconButton(
|
||||||
|
iconSize: 30,
|
||||||
|
padding: const EdgeInsets.all(0),
|
||||||
|
onPressed: () {
|
||||||
|
if (kIsWeb) {
|
||||||
|
html.window.open(
|
||||||
|
fileViewerProvider.fileLink, 'download');
|
||||||
|
} else {
|
||||||
|
nativeFileDownload(
|
||||||
|
fileViewerProvider.fileLink,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
icon: Icon(
|
||||||
|
Icons.download,
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,364 +0,0 @@
|
|||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_objects/arguments.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_pop_up_messages/mih_loading_circle.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
|
||||||
import '../../../../main.dart';
|
|
||||||
import 'package:syncfusion_flutter_core/theme.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:printing/printing.dart';
|
|
||||||
import 'package:fl_downloader/fl_downloader.dart';
|
|
||||||
|
|
||||||
import '../../../../mih_components/mih_layout/mih_action.dart';
|
|
||||||
import '../../../../mih_components/mih_layout/mih_body.dart';
|
|
||||||
import '../../../../mih_components/mih_layout/mih_header.dart';
|
|
||||||
import '../../../../mih_components/mih_layout/mih_layout_builder.dart';
|
|
||||||
|
|
||||||
class FullScreenFileViewer extends StatefulWidget {
|
|
||||||
final FileViewArguments arguments;
|
|
||||||
const FullScreenFileViewer({
|
|
||||||
super.key,
|
|
||||||
required this.arguments,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<FullScreenFileViewer> createState() => _FullScreenFileViewerState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _FullScreenFileViewerState extends State<FullScreenFileViewer> {
|
|
||||||
late PdfViewerController pdfViewerController = PdfViewerController();
|
|
||||||
int currentPageCount = 0;
|
|
||||||
int currentPage = 0;
|
|
||||||
double startZoomLevel = 1.0;
|
|
||||||
double zoomOut = 0;
|
|
||||||
|
|
||||||
int progress = 0;
|
|
||||||
late StreamSubscription progressStream;
|
|
||||||
|
|
||||||
String getExtType(String path) {
|
|
||||||
//print(pdfLink.split(".")[1]);
|
|
||||||
return path.split(".").last;
|
|
||||||
}
|
|
||||||
|
|
||||||
String getFileName(String path) {
|
|
||||||
//print(pdfLink.split(".")[1]);
|
|
||||||
return path.split("/").last;
|
|
||||||
}
|
|
||||||
|
|
||||||
void onPageSelect() {
|
|
||||||
setState(() {
|
|
||||||
currentPage = pdfViewerController.pageNumber;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void printDocument() async {
|
|
||||||
print("Printing ${widget.arguments.path.split("/").last}");
|
|
||||||
http.Response response = await http.get(Uri.parse(widget.arguments.link));
|
|
||||||
var pdfData = response.bodyBytes;
|
|
||||||
Navigator.of(context).pushNamed(
|
|
||||||
'/file-veiwer/print-preview',
|
|
||||||
arguments: pdfData,
|
|
||||||
);
|
|
||||||
// Navigator.of(context).push(
|
|
||||||
// MaterialPageRoute(
|
|
||||||
// builder: (context) => PdfPreview(
|
|
||||||
// initialPageFormat: PdfPageFormat.a4,
|
|
||||||
// build: (format) => pdfData,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// try {
|
|
||||||
// await Printing.layoutPdf(
|
|
||||||
// onLayout: (PdfPageFormat format) async => pdfData);
|
|
||||||
// } on Exception catch (_) {
|
|
||||||
// print("Print Error");
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
void shareDocument() async {
|
|
||||||
http.Response response = await http.get(Uri.parse(widget.arguments.link));
|
|
||||||
var pdfData = response.bodyBytes;
|
|
||||||
await Printing.sharePdf(
|
|
||||||
bytes: pdfData, filename: widget.arguments.path.split("/").last);
|
|
||||||
}
|
|
||||||
|
|
||||||
MIHAction getActionButton() {
|
|
||||||
return MIHAction(
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.fullscreen_exit,
|
|
||||||
),
|
|
||||||
iconSize: 35,
|
|
||||||
onTap: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
MIHHeader getHeader(double width) {
|
|
||||||
bool isPDF;
|
|
||||||
if (getExtType(widget.arguments.path).toLowerCase() == "pdf") {
|
|
||||||
isPDF = true;
|
|
||||||
} else {
|
|
||||||
isPDF = false;
|
|
||||||
}
|
|
||||||
return MIHHeader(
|
|
||||||
headerAlignment: MainAxisAlignment.end,
|
|
||||||
headerItems: [
|
|
||||||
Visibility(
|
|
||||||
visible: isPDF,
|
|
||||||
child: IconButton(
|
|
||||||
iconSize: 30,
|
|
||||||
padding: const EdgeInsets.all(0),
|
|
||||||
onPressed: () {
|
|
||||||
pdfViewerController.previousPage();
|
|
||||||
//print(pdfViewerController.);
|
|
||||||
//if (pdfViewerController.pageNumber > 1) {
|
|
||||||
setState(() {
|
|
||||||
currentPage = pdfViewerController.pageNumber;
|
|
||||||
});
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
icon: Icon(
|
|
||||||
Icons.arrow_back,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Visibility(
|
|
||||||
visible: isPDF,
|
|
||||||
child: Text(
|
|
||||||
"$currentPage / $currentPageCount",
|
|
||||||
style: const TextStyle(fontSize: 20),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Visibility(
|
|
||||||
visible: isPDF,
|
|
||||||
child: IconButton(
|
|
||||||
iconSize: 30,
|
|
||||||
padding: const EdgeInsets.all(0),
|
|
||||||
onPressed: () {
|
|
||||||
pdfViewerController.nextPage();
|
|
||||||
//print(pdfViewerController.pageNumber);
|
|
||||||
//if (pdfViewerController.pageNumber < currentPageCount) {
|
|
||||||
setState(() {
|
|
||||||
currentPage = pdfViewerController.pageNumber;
|
|
||||||
});
|
|
||||||
//}
|
|
||||||
},
|
|
||||||
icon: Icon(
|
|
||||||
Icons.arrow_forward,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Visibility(
|
|
||||||
visible: isPDF,
|
|
||||||
child: IconButton(
|
|
||||||
iconSize: 30,
|
|
||||||
padding: const EdgeInsets.all(0),
|
|
||||||
onPressed: () {
|
|
||||||
if (zoomOut > 0) {
|
|
||||||
setState(() {
|
|
||||||
zoomOut = zoomOut - 100;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
setState(() {
|
|
||||||
pdfViewerController.zoomLevel = startZoomLevel + 0.25;
|
|
||||||
startZoomLevel = pdfViewerController.zoomLevel;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
icon: Icon(
|
|
||||||
Icons.zoom_in,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Visibility(
|
|
||||||
visible: isPDF,
|
|
||||||
child: IconButton(
|
|
||||||
iconSize: 30,
|
|
||||||
padding: const EdgeInsets.all(0),
|
|
||||||
onPressed: () {
|
|
||||||
if (pdfViewerController.zoomLevel > 1) {
|
|
||||||
setState(() {
|
|
||||||
pdfViewerController.zoomLevel = startZoomLevel - 0.25;
|
|
||||||
startZoomLevel = pdfViewerController.zoomLevel;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if (zoomOut < (width - 100)) {
|
|
||||||
setState(() {
|
|
||||||
zoomOut = zoomOut + 100;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
icon: Icon(
|
|
||||||
Icons.zoom_out,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// IconButton(
|
|
||||||
// iconSize: 30,
|
|
||||||
// padding: const EdgeInsets.all(0),
|
|
||||||
// onPressed: () {
|
|
||||||
// printDocument();
|
|
||||||
// },
|
|
||||||
// icon: Icon(
|
|
||||||
// Icons.print,
|
|
||||||
// color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
IconButton(
|
|
||||||
iconSize: 30,
|
|
||||||
padding: const EdgeInsets.all(0),
|
|
||||||
onPressed: () {
|
|
||||||
if (MzansiInnovationHub.of(context)!.theme.getPlatform() == "Web") {
|
|
||||||
html.window.open(
|
|
||||||
widget.arguments.link,
|
|
||||||
// '${AppEnviroment.baseFileUrl}/mih/$filePath',
|
|
||||||
'download');
|
|
||||||
} else {
|
|
||||||
nativeFileDownload(
|
|
||||||
widget.arguments.link,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
icon: Icon(
|
|
||||||
Icons.download,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
MIHBody getBody(double width, double height) {
|
|
||||||
Widget fileViewer;
|
|
||||||
if (getExtType(widget.arguments.path).toLowerCase() == "pdf") {
|
|
||||||
fileViewer = SizedBox(
|
|
||||||
width: width - zoomOut,
|
|
||||||
height: height - 70,
|
|
||||||
child: SfPdfViewerTheme(
|
|
||||||
data: SfPdfViewerThemeData(
|
|
||||||
backgroundColor: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
child: SfPdfViewer.network(
|
|
||||||
widget.arguments.link,
|
|
||||||
controller: pdfViewerController,
|
|
||||||
initialZoomLevel: startZoomLevel,
|
|
||||||
pageSpacing: 2,
|
|
||||||
maxZoomLevel: 5,
|
|
||||||
interactionMode: PdfInteractionMode.pan,
|
|
||||||
onDocumentLoaded: (details) {
|
|
||||||
setState(() {
|
|
||||||
currentPage = pdfViewerController.pageNumber;
|
|
||||||
currentPageCount = pdfViewerController.pageCount;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
fileViewer = SizedBox(
|
|
||||||
width: width,
|
|
||||||
height: height - 70,
|
|
||||||
child: InteractiveViewer(
|
|
||||||
maxScale: 5.0,
|
|
||||||
//minScale: 0.,
|
|
||||||
child: Image.network(widget.arguments.link),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return MIHBody(
|
|
||||||
borderOn: false,
|
|
||||||
bodyItems: [
|
|
||||||
fileViewer,
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void mihLoadingPopUp() {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return const Mihloadingcircle();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
pdfViewerController.dispose();
|
|
||||||
progressStream.cancel();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
//pdfViewerController = widget.arguments.pdfViewerController!;
|
|
||||||
pdfViewerController.addListener(onPageSelect);
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final Size size = MediaQuery.sizeOf(context);
|
|
||||||
double width = size.width;
|
|
||||||
double height = size.height;
|
|
||||||
|
|
||||||
return MIHLayoutBuilder(
|
|
||||||
actionButton: getActionButton(),
|
|
||||||
header: getHeader(width),
|
|
||||||
secondaryActionButton: null,
|
|
||||||
body: getBody(width, height),
|
|
||||||
actionDrawer: null,
|
|
||||||
secondaryActionDrawer: null,
|
|
||||||
bottomNavBar: null,
|
|
||||||
pullDownToRefresh: false,
|
|
||||||
onPullDown: () async {},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,6 +5,7 @@ import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_file_viewer_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/patient_manager_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/patient_manager_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
@@ -216,10 +217,6 @@ class _BuildClaimStatementFileListState
|
|||||||
context.pop();
|
context.pop();
|
||||||
context.pushNamed(
|
context.pushNamed(
|
||||||
'fileViewer',
|
'fileViewer',
|
||||||
extra: FileViewArguments(
|
|
||||||
url,
|
|
||||||
filePath,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
// printDocument(url, filePath);
|
// printDocument(url, filePath);
|
||||||
},
|
},
|
||||||
@@ -357,13 +354,15 @@ class _BuildClaimStatementFileListState
|
|||||||
// color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
// color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
// ),
|
// ),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
|
MihFileViewerProvider fileViewerProvider =
|
||||||
|
context.read<MihFileViewerProvider>();
|
||||||
await getFileUrlApiCall(patientManagerProvider
|
await getFileUrlApiCall(patientManagerProvider
|
||||||
.patientClaimsDocuments![index].file_path)
|
.patientClaimsDocuments![index].file_path)
|
||||||
.then((urlHere) {
|
.then((urlHere) {
|
||||||
//print(url);
|
//print(url);
|
||||||
setState(() {
|
fileViewerProvider.setFilePath(patientManagerProvider
|
||||||
fileUrl = urlHere;
|
.patientClaimsDocuments![index].file_path);
|
||||||
});
|
fileViewerProvider.setFileLink(urlHere);
|
||||||
});
|
});
|
||||||
|
|
||||||
viewFilePopUp(
|
viewFilePopUp(
|
||||||
@@ -374,7 +373,7 @@ class _BuildClaimStatementFileListState
|
|||||||
.patientClaimsDocuments![index].file_path,
|
.patientClaimsDocuments![index].file_path,
|
||||||
patientManagerProvider.patientClaimsDocuments![index]
|
patientManagerProvider.patientClaimsDocuments![index]
|
||||||
.idclaim_statement_file,
|
.idclaim_statement_file,
|
||||||
fileUrl);
|
fileViewerProvider.fileLink);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:ken_logger/ken_logger.dart';
|
import 'package:ken_logger/ken_logger.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mih_file_viewer_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/mzansi_profile_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_components/mih_providers/patient_manager_provider.dart';
|
import 'package:mzansi_innovation_hub/mih_components/mih_providers/patient_manager_provider.dart';
|
||||||
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
import 'package:mzansi_innovation_hub/mih_config/mih_colors.dart';
|
||||||
@@ -264,10 +265,6 @@ class _BuildFilesListState extends State<BuildFilesList> {
|
|||||||
context.pop();
|
context.pop();
|
||||||
context.pushNamed(
|
context.pushNamed(
|
||||||
'fileViewer',
|
'fileViewer',
|
||||||
extra: FileViewArguments(
|
|
||||||
url,
|
|
||||||
filePath,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -434,13 +431,15 @@ class _BuildFilesListState extends State<BuildFilesList> {
|
|||||||
// color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
// color: MihColors.getSecondaryColor(MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
// ),
|
// ),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
|
MihFileViewerProvider fileViewerProvider =
|
||||||
|
context.read<MihFileViewerProvider>();
|
||||||
await getFileUrlApiCall(patientManagerProvider
|
await getFileUrlApiCall(patientManagerProvider
|
||||||
.patientDocuments![index].file_path)
|
.patientDocuments![index].file_path)
|
||||||
.then((urlHere) {
|
.then((urlHere) {
|
||||||
//print(url);
|
//print(url);
|
||||||
setState(() {
|
fileViewerProvider.setFilePath(patientManagerProvider
|
||||||
fileUrl = urlHere;
|
.patientDocuments![index].file_path);
|
||||||
});
|
fileViewerProvider.setFileLink(urlHere);
|
||||||
});
|
});
|
||||||
|
|
||||||
viewFilePopUp(
|
viewFilePopUp(
|
||||||
@@ -449,7 +448,7 @@ class _BuildFilesListState extends State<BuildFilesList> {
|
|||||||
patientManagerProvider.patientDocuments![index].file_path,
|
patientManagerProvider.patientDocuments![index].file_path,
|
||||||
patientManagerProvider
|
patientManagerProvider
|
||||||
.patientDocuments![index].idpatient_files,
|
.patientDocuments![index].idpatient_files,
|
||||||
fileUrl);
|
fileViewerProvider.fileLink);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user