当前位置:   article > 正文

Flutter 实现pdf、word、excel、png、ppt等文件预览功能_flutter预览各种文件

flutter预览各种文件

在开发过程中,我们很少会遇到预览pdf、word、excel、png、ppt等文件的功能,但是很巧的本人就遇到了,由于第一次使用这个功能,着实是让人挠头啊,最后终于得到解决。

其实实现预览功能很简单,Flutter的插件库就为我们提供了很好的插件

flutter_full_pdf_viewer: ^1.0.1

官网给的文件

  1. import 'dart:async';
  2. import 'dart:io';
  3. import 'package:flutter/foundation.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:flutter_full_pdf_viewer/full_pdf_viewer_scaffold.dart';
  6. import 'package:path_provider/path_provider.dart';
  7. void main() {
  8. runApp(MaterialApp(
  9. title: 'Plugin example app',
  10. home: MyApp(),
  11. ));
  12. }
  13. class MyApp extends StatefulWidget {
  14. @override
  15. _MyAppState createState() => new _MyAppState();
  16. }
  17. class _MyAppState extends State<MyApp> {
  18. String pathPDF = "";
  19. @override
  20. void initState() {
  21. super.initState();
  22. createFileOfPdfUrl().then((f)
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/268670
推荐阅读
相关标签
  

闽ICP备14008679号