Ein leistungsstarkes Dateiview-Widget, das eine Vielzahl von Dateitypen unterstützt, wie z. B. Doc, Eexcl, PPT, TXT, PDF usw. Unter Android wird es durch Tencent X5 und unter iOS durch WKWebView umgesetzt.
Aus öffentlichen Paketdaten erstellte Orientierung.
PowerFileView ist ein Flutter-Widget, das die nahtlose Anzeige mehrerer Dateitypen wie DOC, XLS, PPT, TXT und PDF ermöglicht. Auf Android nutzt es Tencent X5 für die Darstellung, während auf iOS WKWebView verwendet wird. Das Paket vereinfacht die Integration von Dateivorschauen in Flutter-Anwendungen und bietet zuverlässigen plattformübergreifenden Support mit minimalem Setup. Es ist ideal für Anwendungen, die Dokumentenansicht ohne Abhängigkeit von externen Apps benötigen.
Anwendungsfälle
Dokumentvorschau in mobilen Apps
Interner Dateibetrachter für Bildungsplattformen
Geschäfts-App-Dokumentenfreigabe
Anzeige von PDF- und Bürodateien
Offline-Dokumenten-Zugriff
Hauptmerkmale
Unterstützt mehrere Dateiformate
Verwendet native Web-Engines (X5 und WKWebView)
Plattformübergreifende Kompatibilität
Einfache Integration mit Flutter
Leichte und schnelle Darstellung
Geeignet für
Bildungs-Apps
Unternehmens-Dokumentenmanagement
Content-Delivery-Plattformen
Mobile Produktivitätstools
Apps mit Dateifreigabefunktionen
Hinweise
Benötigt Internet für bestimmte Online-Inhalte
Eingeschränkte Anpassung der Webansicht
Für den Dateizugriff könnten zusätzliche Berechtigungen erforderlich sein
Abhängig von der Leistung eines externen Web-Engine
Nicht geeignet für komplexe interaktive Dokumente
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
ios uses WKWebView, all supported by WKWebView can be previewed
Supported formats
Format
android
ios
.doc
✅
✅
.docx
✅
✅
.ppt
✅
✅
.pptx
✅
✅
.xls
✅
✅
.xlsx
✅
✅
.pdf
✅
✅
Integration
1. Dependency
Add under the pubspec.yaml file:
power_file_view: ^1.0.0
2. Quick integration
1. Android
Since using android to use TBS service, network permission and storage permission are required.
Add the following permissions to the AndroidManifest file of Android.
In order to prevent the release version from failing to load the TBS kernel library.
Add the following code to the obfuscation file proguard-rules.pro.
Since android uses the TBS service, it needs to be initialized before use, which takes about 3-30 seconds.
Asynchronous initialization (recommended)
Asynchronous initialization can be performed under the main function of the app's main.dart file, so that the user does not need to wait for TBS initialization when opening the file.
If the asynchronous initialization configuration is not performed, the initialization operation will be performed automatically before the file is opened, and the user does not need to configure
4. Quick use
file preview
Network files: Just pass in the downloadUrl of the file to be previewed and the downloadPath of the storage path of the file to download.
define downloadPath
import 'package:path_provider/path_provider.dart';
...
final _directory = await getTemporaryDirectory();
final downloadPath = "${_directory.path}/fileview/"fileName.pdf";//Set a name you like
Local file: Just pass in the downloadPath of the path where the local file is located.