forked from fluttercandies/flutter_filereader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.md
67 lines (51 loc) · 1.45 KB
/
README.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Flutter FileReader
[![pub package](https://img.shields.io/pub/v/flutter_filereader.svg)](https://pub.dartlang.org/packages/flutter_filereader)
##### A local file view widget,Support a variety of file types, such as Doc Eexcl PPT TXT and so on,Android is implemented by Tencent X5,iOS is implemented by WKWebView
## Depend on it
Add this to your package's pubspec.yaml file:
1.9.1
```
dependencies:
flutter_filereader: ^1.0.0
```
1.12.x
```
dependencies:
flutter_filereader: ^2.1.0
```
## Support File Type
* IOS `docx,doc,xlsx,xls,pptx,ppt,pdf,txt,jpg,jpeg,png`
* Android `docx,doc,xlsx,xls,pptx,ppt,pdf,txt`
## Usage
### iOS
Make sure you add the following key to Info.plist for iOS
```
<key>io.flutter.embedded_views_preview</key><true/>
```
### Example
```
import 'package:flutter/material.dart';
import 'package:flutter_filereader/flutter_filereader.dart';
class FileReaderPage extends StatefulWidget {
final String filePath;
FileReaderPage({Key: Key, this.filePath});
@override
_FileReaderPageState createState() => _FileReaderPageState();
}
class _FileReaderPageState extends State<FileReaderPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("doc"),
),
body: FileReaderView(
filePath: widget.filePath,
),
);
}
}
```
## 注意事项
1. 之前版本不支持arm64,目前已经支持
2. txt文档如果显示乱码,请将txt文档编码改成gbk