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
example/lib/main.dart
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)),
],),
),
);
}
}