-
Notifications
You must be signed in to change notification settings - Fork 59
/
thumbnails_view.dart
55 lines (52 loc) · 1.73 KB
/
thumbnails_view.dart
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
//
// Super simple thumbnails view
//
import 'package:flutter/material.dart';
import 'package:pdfrx/pdfrx.dart';
class ThumbnailsView extends StatelessWidget {
const ThumbnailsView(
{super.key, required this.documentRef, required this.controller});
final PdfDocumentRef? documentRef;
final PdfViewerController? controller;
@override
Widget build(BuildContext context) {
return Container(
color: Colors.grey,
child: documentRef == null
? null
: PdfDocumentViewBuilder(
documentRef: documentRef!,
builder: (context, document) => ListView.builder(
itemCount: document?.pages.length ?? 0,
itemBuilder: (context, index) {
return Container(
margin: const EdgeInsets.all(8),
height: 240,
child: Column(
children: [
SizedBox(
height: 220,
child: InkWell(
onTap: () => controller!.goToPage(
pageNumber: index + 1,
anchor: PdfPageAnchor.top,
),
child: PdfPageView(
document: document,
pageNumber: index + 1,
alignment: Alignment.center,
),
),
),
Text(
'${index + 1}',
),
],
),
);
},
),
),
);
}
}