File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -121,14 +121,14 @@ class Header extends StatelessWidget {
121121 return container;
122122 }
123123
124- return Outline (
124+ return DelayedWidget (build : (_) => Outline (
125125 name: text.hashCode.toString (),
126126 title: title! ,
127127 child: container,
128128 level: level,
129129 color: outlineColor,
130130 style: outlineStyle,
131- );
131+ )) ;
132132 }
133133}
134134
Original file line number Diff line number Diff line change 1717import 'dart:io' ;
1818import 'dart:math' ;
1919
20+ import 'package:pdf/pdf.dart' ;
2021import 'package:pdf/widgets.dart' ;
2122import 'package:test/test.dart' ;
2223
@@ -79,6 +80,35 @@ void main() {
7980 );
8081 });
8182
83+ test ('page number with footer' , () {
84+ pdf.addPage (
85+ Page (
86+ build: (final context) {
87+ return Column (
88+ children: [TableOfContent ()],
89+ );
90+ },
91+ ),
92+ );
93+ pdf.addPage (
94+ MultiPage (
95+ footer: (final Context context) {
96+ return Container (
97+ margin: const EdgeInsets .only (top: 1.0 * PdfPageFormat .cm),
98+ child: Text (
99+ 'Page ${context .pageNumber } of ${context .pagesCount }' ,
100+ ),
101+ );
102+ },
103+ build: (final context) => [
104+ Header (text: 'a' , level: 1 ),
105+ Text (LoremText ().paragraph (600 )),
106+ Header (text: 'b' , level: 1 ),
107+ ],
108+ ),
109+ );
110+ });
111+
82112 tearDownAll (() async {
83113 final file = File ('widgets-toc.pdf' );
84114 await file.writeAsBytes (await pdf.save ());
You can’t perform that action at this time.
0 commit comments