forked from yaso_meth/mih-project
Add PDF Builder to view pdf document. enable donload of pdf document
This commit is contained in:
@@ -43,7 +43,8 @@ RUN flutter config --enable-web
|
||||
RUN mkdir /app/
|
||||
COPY . /app/
|
||||
WORKDIR /app/
|
||||
RUN flutter pub add web:^0.5.0
|
||||
# RUN flutter pub add web:^0.5.0
|
||||
# RUN flutter pub run pdfx:install_web
|
||||
RUN flutter upgrade
|
||||
RUN flutter build web
|
||||
|
||||
|
||||
26
Frontend/patient_manager/lib/components/BuildPdfView.dart
Normal file
26
Frontend/patient_manager/lib/components/BuildPdfView.dart
Normal file
@@ -0,0 +1,26 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';
|
||||
|
||||
class BuildPDFView extends StatefulWidget {
|
||||
final String pdfLink;
|
||||
const BuildPDFView({super.key, required this.pdfLink});
|
||||
|
||||
@override
|
||||
State<BuildPDFView> createState() => _BuildPDFViewState();
|
||||
}
|
||||
|
||||
class _BuildPDFViewState extends State<BuildPDFView> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: 700,
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SfPdfViewer.network(widget.pdfLink),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:patient_manager/components/BuildPdfView.dart';
|
||||
import 'package:patient_manager/objects/files.dart';
|
||||
import 'dart:js' as js;
|
||||
|
||||
class BuildFilesList extends StatefulWidget {
|
||||
final List<PFile> files;
|
||||
@@ -33,7 +35,35 @@ class _BuildFilesListState extends State<BuildFilesList> {
|
||||
subtitle: Text(widget.files[index].insert_date),
|
||||
trailing: const Icon(Icons.arrow_forward),
|
||||
onTap: () {
|
||||
//Insert Display function here
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(widget.files[index].file_name),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
js.context.callMethod('open', [
|
||||
'http://localhost:9000/mih/${widget.files[index].file_name}.pdf'
|
||||
]);
|
||||
},
|
||||
icon: Icon(Icons.download),
|
||||
)
|
||||
],
|
||||
),
|
||||
content: BuildPDFView(
|
||||
pdfLink:
|
||||
"http://localhost:9000/mih/${widget.files[index].file_name}.pdf"),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text("Close"))
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
@@ -4,10 +4,8 @@ import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:patient_manager/components/buildFilesList.dart';
|
||||
import 'package:patient_manager/components/medCertInput.dart';
|
||||
import 'package:patient_manager/components/myDateInput.dart';
|
||||
import 'package:patient_manager/main.dart';
|
||||
import 'package:patient_manager/objects/AppUser.dart';
|
||||
import 'package:patient_manager/objects/Patient2.dart';
|
||||
import 'package:patient_manager/objects/files.dart';
|
||||
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
@@ -6,17 +6,17 @@ import FlutterMacOS
|
||||
import Foundation
|
||||
|
||||
import app_links
|
||||
import google_sign_in_ios
|
||||
import device_info_plus
|
||||
import path_provider_foundation
|
||||
import shared_preferences_foundation
|
||||
import sign_in_with_apple
|
||||
import syncfusion_pdfviewer_macos
|
||||
import url_launcher_macos
|
||||
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin"))
|
||||
FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))
|
||||
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||
SignInWithApplePlugin.register(with: registry.registrar(forPlugin: "SignInWithApplePlugin"))
|
||||
SyncfusionFlutterPdfViewerPlugin.register(with: registry.registrar(forPlugin: "SyncfusionFlutterPdfViewerPlugin"))
|
||||
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
|
||||
}
|
||||
|
||||
@@ -225,6 +225,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.6"
|
||||
device_info_plus:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: device_info_plus
|
||||
sha256: "77f757b789ff68e4eaf9c56d1752309bd9f7ad557cb105b938a7f8eb89e59110"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "9.1.2"
|
||||
device_info_plus_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: device_info_plus_platform_interface
|
||||
sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.0.0"
|
||||
email_validator:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -320,54 +336,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
google_identity_services_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: google_identity_services_web
|
||||
sha256: "9482364c9f8b7bd36902572ebc3a7c2b5c8ee57a9c93e6eb5099c1a9ec5265d8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.3.1+1"
|
||||
google_sign_in:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: google_sign_in
|
||||
sha256: "0b8787cb9c1a68ad398e8010e8c8766bfa33556d2ab97c439fb4137756d7308f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.2.1"
|
||||
google_sign_in_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: google_sign_in_android
|
||||
sha256: "60e4f7947fa413cd9f2e23c955e8406afe640a8b2fbd00b46fb2901058047b8f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.25"
|
||||
google_sign_in_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: google_sign_in_ios
|
||||
sha256: a058c9880be456f21e2e8571c1126eaacd570bdc5b6c6d9d15aea4bdf22ca9fe
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.7.6"
|
||||
google_sign_in_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: google_sign_in_platform_interface
|
||||
sha256: "1f6e5787d7a120cc0359ddf315c92309069171306242e181c09472d1b00a2971"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.5"
|
||||
google_sign_in_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: google_sign_in_web
|
||||
sha256: d606264c7a1a526a3aa79d938b85a601d8589731a478bd4a3dcbdeb14a572228
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.12.4+1"
|
||||
gotrue:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -416,6 +384,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.2"
|
||||
intl:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: intl
|
||||
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.19.0"
|
||||
io:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -428,10 +404,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: js
|
||||
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
|
||||
sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.6.7"
|
||||
version: "0.7.1"
|
||||
json_annotation:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -592,6 +568,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
petitparser:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: petitparser
|
||||
sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.0.2"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -752,30 +736,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
sign_in_with_apple:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: sign_in_with_apple
|
||||
sha256: "0975c23b9f8b30a80e27d5659a75993a093d4cb5f4eb7d23a9ccc586fea634e0"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.0.0"
|
||||
sign_in_with_apple_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: sign_in_with_apple_platform_interface
|
||||
sha256: c2ef2ce6273fce0c61acd7e9ff5be7181e33d7aa2b66508b39418b786cca2119
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
sign_in_with_apple_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: sign_in_with_apple_web
|
||||
sha256: "44b66528f576e77847c14999d5e881e17e7223b7b0625a185417829e5306f47a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
@@ -797,6 +757,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.10.0"
|
||||
sprintf:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: sprintf
|
||||
sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.0.0"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -849,10 +817,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: supabase_auth_ui
|
||||
sha256: d8bdfbe957b3028780c3074574b790588c48a4a75d895e95d63404ebf7686653
|
||||
sha256: "9c12964ee213a0b6d5f26d4e7d5818a57df6a7060a7cf8a16bb54c4e5f46c666"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.4.4"
|
||||
version: "0.4.1"
|
||||
supabase_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -861,6 +829,70 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.5.6"
|
||||
syncfusion_flutter_core:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: syncfusion_flutter_core
|
||||
sha256: "963e414e06abe520c9d0e039738bc6cbcf8eabf8c5964eb2181a76da1274a942"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "26.1.39"
|
||||
syncfusion_flutter_pdf:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: syncfusion_flutter_pdf
|
||||
sha256: f1bf84c6b9b8cd4949082adcedd64aa1f4e976fc918e3c3bb43d7d63138efb1a
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "26.1.39"
|
||||
syncfusion_flutter_pdfviewer:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: syncfusion_flutter_pdfviewer
|
||||
sha256: "12a9099478a1fe902b14b8614d1b7a03798650b1b993c1c794de32b15d3b2796"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "26.1.39"
|
||||
syncfusion_flutter_signaturepad:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: syncfusion_flutter_signaturepad
|
||||
sha256: "06b8581da57d14f9f621a8c2fb8f57b240d0f6caed663f3d496491388b45cb97"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "26.1.39"
|
||||
syncfusion_pdfviewer_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: syncfusion_pdfviewer_macos
|
||||
sha256: f7c014052e72048cfbed0d0dc6596763dae01db31db5cd30c575fc7067a2f40f
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "26.1.39"
|
||||
syncfusion_pdfviewer_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: syncfusion_pdfviewer_platform_interface
|
||||
sha256: "7e8ab84722003c76fd1fef0e7066f96aef67c17951c6aeee35cf6ea38f5383f1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "26.1.39"
|
||||
syncfusion_pdfviewer_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: syncfusion_pdfviewer_web
|
||||
sha256: "9ca4c40c3b5cf960a2d582421d7179c661c59444d9fa09191b16cddd3d458178"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "26.1.39"
|
||||
syncfusion_pdfviewer_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: syncfusion_pdfviewer_windows
|
||||
sha256: "0cda6004bdc888bbfc671fc60d7127d349e0f10a509c3177a8acc2b2a32f0b9b"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "26.1.39"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -965,6 +997,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.1"
|
||||
uuid:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: uuid
|
||||
sha256: "814e9e88f21a176ae1359149021870e87f7cddaf633ab678a5d2b0bff7fd1ba8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.4.0"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1013,6 +1053,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.5.1"
|
||||
win32_registry:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: win32_registry
|
||||
sha256: "10589e0d7f4e053f2c61023a31c9ce01146656a70b7b7f0828c0b46d7da2a9bb"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.3"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1021,6 +1069,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
xml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: xml
|
||||
sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.5.0"
|
||||
yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -35,9 +35,12 @@ dependencies:
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.2
|
||||
syncfusion_flutter_pdfviewer: ^26.1.39
|
||||
#pdfx: ^2.6.0
|
||||
supabase_auth_ui: ^0.4.1
|
||||
supabase_flutter: ^2.4.0
|
||||
http: ^1.2.0
|
||||
http: ^1.2.1
|
||||
#internet_file: ^1.2.0
|
||||
mysql_client: ^0.0.27
|
||||
args: 2.5.0
|
||||
|
||||
|
||||
@@ -33,6 +33,14 @@
|
||||
<link rel="manifest" href="manifest.json">
|
||||
</head>
|
||||
<body>
|
||||
<script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@2.12.313/build/pdf.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
pdfjsLib.GlobalWorkerOptions.workerSrc = "https://cdn.jsdelivr.net/npm/pdfjs-dist@2.12.313/build/pdf.worker.min.js";
|
||||
pdfRenderOptions = {
|
||||
cMapUrl: 'https://cdn.jsdelivr.net/npm/pdfjs-dist@2.12.313/cmaps/',
|
||||
cMapPacked: true,
|
||||
}
|
||||
</script>
|
||||
<script src="flutter_bootstrap.js" async></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -7,11 +7,14 @@
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <app_links/app_links_plugin_c_api.h>
|
||||
#include <syncfusion_pdfviewer_windows/syncfusion_pdfviewer_windows_plugin.h>
|
||||
#include <url_launcher_windows/url_launcher_windows.h>
|
||||
|
||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
AppLinksPluginCApiRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("AppLinksPluginCApi"));
|
||||
SyncfusionPdfviewerWindowsPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("SyncfusionPdfviewerWindowsPlugin"));
|
||||
UrlLauncherWindowsRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
app_links
|
||||
syncfusion_pdfviewer_windows
|
||||
url_launcher_windows
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user