dd_viewer 0.0.1 dd_viewer: ^0.0.1 copied to clipboard
A universal preview device for PDF, Word, Excel, text, png, and jpg
dd_viewer #
A universal preview device for PDF, Word, Excel, text, png, and jpg
Getting Started #
This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.
For help getting started with Flutter development, view the online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.
ios #
请在Podfile文件中,设置最低版本为12
platform :ios, '12.0'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
举个例子:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
end
end
end
Android #
在android/build.gradle
添加
maven { url "https://jitpack.io" }
使用 #
支持打开网络文件,本地文件,网络文件使用dio下载到本地缓存目录
file: FileX.netWork();
file: FileX.file();
file: FileX.path();
完整例子
import 'package:dd_viewer/dd_viewer.dart';
import 'package:dd_viewer/model/filex.dart';
import 'package:flutter/material.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final pdfUrl = "http://221.234.36.40:8888/wd/pdf.pdf";
final excUrl = "http://221.234.36.40:8888/wd/excel.xls";
final docUrl = "http://221.234.36.40:8888/wd/文档.docx";
final jpg = 'http://221.234.36.40:8888/wd/3.jpg';
final png = 'http://221.234.36.40:8888/wd/2.png';
final jpeg = 'http://221.234.36.40:8888/wd/1.jpeg';
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('超级视图'),
),
body: GridView.count(crossAxisCount: 2,children: [
SuperView(file: FileX.netWork(url: docUrl)),
SuperView(file: FileX.netWork(url: excUrl)),
SuperView(file: FileX.netWork(url: pdfUrl)),
SuperView(file: FileX.netWork(url: jpg)),
SuperView(file: FileX.netWork(url: png)),
SuperView(file: FileX.netWork(url: jpeg)),
],),
),
);
}
}