David PHAM-VAN

Null-safety fixes

@@ -2,27 +2,28 @@ name: Dart CI @@ -2,27 +2,28 @@ name: Dart CI
2 2
3 on: 3 on:
4 push: 4 push:
5 - branches: [ master ] 5 + branches: [master]
6 pull_request: 6 pull_request:
7 - branches: [ master ] 7 + branches: [master]
8 8
9 jobs: 9 jobs:
10 build: 10 build:
11 -  
12 runs-on: ubuntu-latest 11 runs-on: ubuntu-latest
13 12
14 steps: 13 steps:
15 - - uses: actions/checkout@v2  
16 - - uses: subosito/flutter-action@v1  
17 - - name: Install utils  
18 - run: sudo apt install poppler-utils imagemagick  
19 - - name: Run analysis  
20 - run: make analyze  
21 - - name: Run tests  
22 - run: make test  
23 - - name: Run readme tests  
24 - run: make test-readme  
25 - - name: Verify that nothing changed  
26 - run: test -z "$(git status --porcelain)"  
27 - - name: Push to codecov  
28 - run: bash <(curl -s https://codecov.io/bash) 14 + - uses: actions/checkout@v2
  15 + - uses: subosito/flutter-action@v1
  16 + with:
  17 + channel: dev
  18 + - name: Install utils
  19 + run: sudo apt install poppler-utils imagemagick
  20 + - name: Run analysis
  21 + run: make analyze
  22 + - name: Run tests
  23 + run: make test
  24 + - name: Run readme tests
  25 + run: make test-readme
  26 + - name: Verify that nothing changed
  27 + run: test -z "$(git status --porcelain)"
  28 + - name: Push to codecov
  29 + run: bash <(curl -s https://codecov.io/bash)
@@ -121,7 +121,7 @@ test-demo: $(FONTS) demo/pubspec.lock .coverage @@ -121,7 +121,7 @@ test-demo: $(FONTS) demo/pubspec.lock .coverage
121 121
122 test-readme: $(FONTS) test/pubspec.lock 122 test-readme: $(FONTS) test/pubspec.lock
123 cd test; $(DART_BIN) extract_readme.dart 123 cd test; $(DART_BIN) extract_readme.dart
124 - cd test; dartanalyzer readme-*.dart 124 + cd test; $(DART_BIN) analyze
125 125
126 test: test-pdf test-printing test-demo node_modules 126 test: test-pdf test-printing test-demo node_modules
127 cat pdf/lcov.info printing/lcov.info demo/lcov.info | node_modules/.bin/lcov-summary 127 cat pdf/lcov.info printing/lcov.info demo/lcov.info | node_modules/.bin/lcov-summary
@@ -38,7 +38,8 @@ Future<Uint8List> generateDocument(PdfPageFormat format) async { @@ -38,7 +38,8 @@ Future<Uint8List> generateDocument(PdfPageFormat format) async {
38 border: pw.Border( 38 border: pw.Border(
39 bottom: pw.BorderSide(width: 0.5, color: PdfColors.grey))), 39 bottom: pw.BorderSide(width: 0.5, color: PdfColors.grey))),
40 child: pw.Text('Portable Document Format', 40 child: pw.Text('Portable Document Format',
41 - style: pw.Theme.of(context).defaultTextStyle 41 + style: pw.Theme.of(context)
  42 + .defaultTextStyle
42 .copyWith(color: PdfColors.grey))); 43 .copyWith(color: PdfColors.grey)));
43 }, 44 },
44 footer: (pw.Context context) { 45 footer: (pw.Context context) {
@@ -47,7 +48,8 @@ Future<Uint8List> generateDocument(PdfPageFormat format) async { @@ -47,7 +48,8 @@ Future<Uint8List> generateDocument(PdfPageFormat format) async {
47 margin: const pw.EdgeInsets.only(top: 1.0 * PdfPageFormat.cm), 48 margin: const pw.EdgeInsets.only(top: 1.0 * PdfPageFormat.cm),
48 child: pw.Text( 49 child: pw.Text(
49 'Page ${context.pageNumber} of ${context.pagesCount}', 50 'Page ${context.pageNumber} of ${context.pagesCount}',
50 - style: pw.Theme.of(context).defaultTextStyle 51 + style: pw.Theme.of(context)
  52 + .defaultTextStyle
51 .copyWith(color: PdfColors.grey))); 53 .copyWith(color: PdfColors.grey)));
52 }, 54 },
53 build: (pw.Context context) => <pw.Widget>[ 55 build: (pw.Context context) => <pw.Widget>[
@@ -4,8 +4,8 @@ description: Pdf Printing Demo @@ -4,8 +4,8 @@ description: Pdf Printing Demo
4 version: 1.0.0+1 4 version: 1.0.0+1
5 5
6 environment: 6 environment:
7 - sdk: '>=2.12.0-224.0.dev <3.0.0'  
8 - flutter: ">=1.26.0-17.1.pre <2.0.0" 7 + sdk: ">=2.12.0-0 <3.0.0"
  8 + flutter: ">=1.16.0"
9 9
10 dependencies: 10 dependencies:
11 flutter: 11 flutter:
@@ -7,7 +7,7 @@ Future<void> main() async { @@ -7,7 +7,7 @@ Future<void> main() async {
7 7
8 pdf.addPage( 8 pdf.addPage(
9 pw.Page( 9 pw.Page(
10 - build: (pw.Context? context) => pw.Center( 10 + build: (pw.Context context) => pw.Center(
11 child: pw.Text('Hello World!'), 11 child: pw.Text('Hello World!'),
12 ), 12 ),
13 ), 13 ),
@@ -94,7 +94,7 @@ class BarDataSet extends Dataset { @@ -94,7 +94,7 @@ class BarDataSet extends Dataset {
94 return; 94 return;
95 } 95 }
96 96
97 - final grid = Chart.of(context)!.grid; 97 + final grid = Chart.of(context).grid;
98 98
99 if (drawSurface) { 99 if (drawSurface) {
100 for (final value in data) { 100 for (final value in data) {
@@ -60,7 +60,7 @@ class Chart extends Widget implements Inherited { @@ -60,7 +60,7 @@ class Chart extends Widget implements Inherited {
60 late Widget _child; 60 late Widget _child;
61 61
62 // ignore: avoid_as 62 // ignore: avoid_as
63 - static Chart? of(Context context) => context.dependsOn<Chart>(); 63 + static Chart of(Context context) => context.dependsOn<Chart>()!;
64 64
65 PdfPoint _computeSize(BoxConstraints constraints) { 65 PdfPoint _computeSize(BoxConstraints constraints) {
66 if (constraints.isTight) { 66 if (constraints.isTight) {
@@ -244,9 +244,6 @@ class FixedAxis<T extends num> extends GridAxis { @@ -244,9 +244,6 @@ class FixedAxis<T extends num> extends GridAxis {
244 @override 244 @override
245 void layout(Context context, BoxConstraints constraints, 245 void layout(Context context, BoxConstraints constraints,
246 {bool parentUsesSize = false}) { 246 {bool parentUsesSize = false}) {
247 - assert(Chart.of(context) != null,  
248 - '$runtimeType cannot be used without a Chart widget');  
249 -  
250 final size = constraints.biggest; 247 final size = constraints.biggest;
251 248
252 var maxWidth = 0.0; 249 var maxWidth = 0.0;
@@ -379,7 +376,7 @@ class FixedAxis<T extends num> extends GridAxis { @@ -379,7 +376,7 @@ class FixedAxis<T extends num> extends GridAxis {
379 } 376 }
380 377
381 // ignore: avoid_as 378 // ignore: avoid_as
382 - final grid = Chart.of(context)!.grid as CartesianGrid; 379 + final grid = Chart.of(context).grid as CartesianGrid;
383 380
384 switch (direction) { 381 switch (direction) {
385 case Axis.horizontal: 382 case Axis.horizontal:
@@ -39,11 +39,9 @@ class CartesianGrid extends ChartGrid { @@ -39,11 +39,9 @@ class CartesianGrid extends ChartGrid {
39 @override 39 @override
40 void layout(Context context, BoxConstraints constraints, 40 void layout(Context context, BoxConstraints constraints,
41 {bool parentUsesSize = false}) { 41 {bool parentUsesSize = false}) {
42 - assert(Chart.of(context) != null,  
43 - '$runtimeType cannot be used without a Chart widget');  
44 super.layout(context, constraints, parentUsesSize: parentUsesSize); 42 super.layout(context, constraints, parentUsesSize: parentUsesSize);
45 43
46 - final datasets = Chart.of(context)!.datasets; 44 + final datasets = Chart.of(context).datasets;
47 final size = constraints.biggest; 45 final size = constraints.biggest;
48 46
49 // In simple conditions, this loop will run only 2 times. 47 // In simple conditions, this loop will run only 2 times.
@@ -104,7 +102,7 @@ class CartesianGrid extends ChartGrid { @@ -104,7 +102,7 @@ class CartesianGrid extends ChartGrid {
104 void paint(Context context) { 102 void paint(Context context) {
105 super.paint(context); 103 super.paint(context);
106 104
107 - final datasets = Chart.of(context)!.datasets; 105 + final datasets = Chart.of(context).datasets;
108 106
109 clip(context, box!.size); 107 clip(context, box!.size);
110 for (var dataSet in datasets) { 108 for (var dataSet in datasets) {
@@ -69,10 +69,7 @@ class ChartLegend extends StatelessWidget { @@ -69,10 +69,7 @@ class ChartLegend extends StatelessWidget {
69 69
70 @override 70 @override
71 Widget build(Context context) { 71 Widget build(Context context) {
72 - assert(Chart.of(context) != null,  
73 - '$runtimeType cannot be used without a Chart widget');  
74 -  
75 - final datasets = Chart.of(context)!.datasets; 72 + final datasets = Chart.of(context).datasets;
76 73
77 final Widget wrap = Wrap( 74 final Widget wrap = Wrap(
78 direction: direction, 75 direction: direction,
@@ -136,7 +136,7 @@ class LineDataSet extends Dataset { @@ -136,7 +136,7 @@ class LineDataSet extends Dataset {
136 return; 136 return;
137 } 137 }
138 138
139 - final grid = Chart.of(context)!.grid; 139 + final grid = Chart.of(context).grid;
140 140
141 if (drawSurface) { 141 if (drawSurface) {
142 _drawSurface(context, grid); 142 _drawSurface(context, grid);
@@ -167,7 +167,7 @@ class LineDataSet extends Dataset { @@ -167,7 +167,7 @@ class LineDataSet extends Dataset {
167 return; 167 return;
168 } 168 }
169 169
170 - final grid = Chart.of(context)!.grid; 170 + final grid = Chart.of(context).grid;
171 171
172 if (drawLine) { 172 if (drawLine) {
173 _drawLine(context, grid, true); 173 _drawLine(context, grid, true);
@@ -20,6 +20,7 @@ import 'package:meta/meta.dart'; @@ -20,6 +20,7 @@ import 'package:meta/meta.dart';
20 import 'package:pdf/pdf.dart'; 20 import 'package:pdf/pdf.dart';
21 import 'package:vector_math/vector_math_64.dart'; 21 import 'package:vector_math/vector_math_64.dart';
22 22
  23 +import 'basic.dart';
23 import 'document.dart'; 24 import 'document.dart';
24 import 'flex.dart'; 25 import 'flex.dart';
25 import 'geometry.dart'; 26 import 'geometry.dart';
@@ -91,7 +92,7 @@ class MultiPage extends Page { @@ -91,7 +92,7 @@ class MultiPage extends Page {
91 MultiPage({ 92 MultiPage({
92 PageTheme? pageTheme, 93 PageTheme? pageTheme,
93 PdfPageFormat? pageFormat, 94 PdfPageFormat? pageFormat,
94 - BuildListCallback? build, 95 + required BuildListCallback build,
95 this.mainAxisAlignment = MainAxisAlignment.start, 96 this.mainAxisAlignment = MainAxisAlignment.start,
96 this.crossAxisAlignment = CrossAxisAlignment.start, 97 this.crossAxisAlignment = CrossAxisAlignment.start,
97 this.header, 98 this.header,
@@ -106,13 +107,14 @@ class MultiPage extends Page { @@ -106,13 +107,14 @@ class MultiPage extends Page {
106 super( 107 super(
107 pageTheme: pageTheme, 108 pageTheme: pageTheme,
108 pageFormat: pageFormat, 109 pageFormat: pageFormat,
  110 + build: (_) => SizedBox(),
109 margin: margin, 111 margin: margin,
110 theme: theme, 112 theme: theme,
111 orientation: orientation, 113 orientation: orientation,
112 textDirection: textDirection, 114 textDirection: textDirection,
113 ); 115 );
114 116
115 - final BuildListCallback? _buildList; 117 + final BuildListCallback _buildList;
116 118
117 final CrossAxisAlignment crossAxisAlignment; 119 final CrossAxisAlignment crossAxisAlignment;
118 120
@@ -149,10 +151,6 @@ class MultiPage extends Page { @@ -149,10 +151,6 @@ class MultiPage extends Page {
149 151
150 @override 152 @override
151 void generate(Document document, {bool insert = true, int? index}) { 153 void generate(Document document, {bool insert = true, int? index}) {
152 - if (_buildList == null) {  
153 - return;  
154 - }  
155 -  
156 assert(pageFormat.width > 0 && pageFormat.width < double.infinity); 154 assert(pageFormat.width > 0 && pageFormat.width < double.infinity);
157 assert(pageFormat.height > 0 && pageFormat.height < double.infinity); 155 assert(pageFormat.height > 0 && pageFormat.height < double.infinity);
158 156
@@ -184,7 +182,7 @@ class MultiPage extends Page { @@ -184,7 +182,7 @@ class MultiPage extends Page {
184 if (pageTheme.textDirection != null) 182 if (pageTheme.textDirection != null)
185 InheritedDirectionality(pageTheme.textDirection), 183 InheritedDirectionality(pageTheme.textDirection),
186 ]); 184 ]);
187 - final children = _buildList!(baseContext); 185 + final children = _buildList(baseContext);
188 WidgetContext? widgetContext; 186 WidgetContext? widgetContext;
189 187
190 while (_index < children.length) { 188 while (_index < children.length) {
@@ -37,7 +37,7 @@ class Page { @@ -37,7 +37,7 @@ class Page {
37 Page({ 37 Page({
38 PageTheme? pageTheme, 38 PageTheme? pageTheme,
39 PdfPageFormat? pageFormat, 39 PdfPageFormat? pageFormat,
40 - BuildCallback? build, 40 + required BuildCallback build,
41 ThemeData? theme, 41 ThemeData? theme,
42 PageOrientation? orientation, 42 PageOrientation? orientation,
43 EdgeInsets? margin, 43 EdgeInsets? margin,
@@ -69,7 +69,7 @@ class Page { @@ -69,7 +69,7 @@ class Page {
69 69
70 PageOrientation get orientation => pageTheme.orientation; 70 PageOrientation get orientation => pageTheme.orientation;
71 71
72 - final BuildCallback? _build; 72 + final BuildCallback _build;
73 73
74 ThemeData? get theme => pageTheme.theme; 74 ThemeData? get theme => pageTheme.theme;
75 75
@@ -136,22 +136,20 @@ class Page { @@ -136,22 +136,20 @@ class Page {
136 Widget? content; 136 Widget? content;
137 Widget? foreground; 137 Widget? foreground;
138 138
139 - if (_build != null) {  
140 - content = _build!(context);  
141 -  
142 - final size = layout(content, context, constraints);  
143 -  
144 - if (_pdfPage!.pageFormat.height == double.infinity) {  
145 - _pdfPage!.pageFormat =  
146 - _pdfPage!.pageFormat.copyWith(width: size.x, height: size.y);  
147 - constraints = mustRotate  
148 - ? BoxConstraints(  
149 - maxWidth: _pdfPage!.pageFormat.height - _margin.vertical,  
150 - maxHeight: _pdfPage!.pageFormat.width - _margin.horizontal)  
151 - : BoxConstraints(  
152 - maxWidth: _pdfPage!.pageFormat.width - _margin.horizontal,  
153 - maxHeight: _pdfPage!.pageFormat.height - _margin.vertical);  
154 - } 139 + content = _build(context);
  140 +
  141 + final size = layout(content, context, constraints);
  142 +
  143 + if (_pdfPage!.pageFormat.height == double.infinity) {
  144 + _pdfPage!.pageFormat =
  145 + _pdfPage!.pageFormat.copyWith(width: size.x, height: size.y);
  146 + constraints = mustRotate
  147 + ? BoxConstraints(
  148 + maxWidth: _pdfPage!.pageFormat.height - _margin.vertical,
  149 + maxHeight: _pdfPage!.pageFormat.width - _margin.horizontal)
  150 + : BoxConstraints(
  151 + maxWidth: _pdfPage!.pageFormat.width - _margin.horizontal,
  152 + maxHeight: _pdfPage!.pageFormat.height - _margin.vertical);
155 } 153 }
156 154
157 if (pageTheme.buildBackground != null) { 155 if (pageTheme.buildBackground != null) {
@@ -175,9 +173,7 @@ class Page { @@ -175,9 +173,7 @@ class Page {
175 paint(background, context); 173 paint(background, context);
176 } 174 }
177 175
178 - if (content != null) {  
179 - paint(content, context);  
180 - } 176 + paint(content, context);
181 177
182 if (foreground != null) { 178 if (foreground != null) {
183 paint(foreground, context); 179 paint(foreground, context);
@@ -7,7 +7,7 @@ issue_tracker: https://github.com/DavBfr/dart_pdf/issues @@ -7,7 +7,7 @@ issue_tracker: https://github.com/DavBfr/dart_pdf/issues
7 version: 3.0.0-nullsafety.0 7 version: 3.0.0-nullsafety.0
8 8
9 environment: 9 environment:
10 - sdk: '>=2.12.0-224.0.dev <3.0.0' 10 + sdk: ">=2.12.0-0 <3.0.0"
11 11
12 dependencies: 12 dependencies:
13 archive: ^3.0.0-nullsafety 13 archive: ^3.0.0-nullsafety
@@ -464,7 +464,7 @@ void main() { @@ -464,7 +464,7 @@ void main() {
464 464
465 test('Text Widgets Arabic', () { 465 test('Text Widgets Arabic', () {
466 pdf.addPage(Page( 466 pdf.addPage(Page(
467 - build: (Context? context) => RichText( 467 + build: (Context context) => RichText(
468 textDirection: TextDirection.rtl, 468 textDirection: TextDirection.rtl,
469 text: TextSpan( 469 text: TextSpan(
470 text: 'قهوة\n', 470 text: 'قهوة\n',
@@ -28,8 +28,8 @@ class Color extends StatelessWidget { @@ -28,8 +28,8 @@ class Color extends StatelessWidget {
28 final String? varient; 28 final String? varient;
29 29
30 @override 30 @override
31 - Widget build(Context? context) {  
32 - final style = Theme.of(context!).defaultTextStyle.copyWith( 31 + Widget build(Context context) {
  32 + final style = Theme.of(context).defaultTextStyle.copyWith(
33 color: color.luminance < 0.2 ? PdfColors.white : PdfColors.black, 33 color: color.luminance < 0.2 ? PdfColors.white : PdfColors.black,
34 fontSize: 14); 34 fontSize: 14);
35 final hexStyle = style.copyWith(font: Font.courier(), fontSize: 10); 35 final hexStyle = style.copyWith(font: Font.courier(), fontSize: 10);
@@ -73,7 +73,7 @@ class ColorWheel extends Widget { @@ -73,7 +73,7 @@ class ColorWheel extends Widget {
73 final ColorSpace colorSpace; 73 final ColorSpace colorSpace;
74 74
75 @override 75 @override
76 - void layout(Context? context, BoxConstraints? constraints, 76 + void layout(Context context, BoxConstraints? constraints,
77 {bool parentUsesSize = false}) { 77 {bool parentUsesSize = false}) {
78 box = PdfRect.fromPoints(PdfPoint.zero, constraints!.biggest); 78 box = PdfRect.fromPoints(PdfPoint.zero, constraints!.biggest);
79 } 79 }
@@ -672,11 +672,11 @@ void main() { @@ -672,11 +672,11 @@ void main() {
672 672
673 wheels.forEach((ColorSpace colorSpace, String name) { 673 wheels.forEach((ColorSpace colorSpace, String name) {
674 pdf.addPage(Page( 674 pdf.addPage(Page(
675 - build: (Context? context) => Column( 675 + build: (Context context) => Column(
676 children: <Widget>[ 676 children: <Widget>[
677 Header(text: name, outlineStyle: PdfOutlineStyle.italic), 677 Header(text: name, outlineStyle: PdfOutlineStyle.italic),
678 SizedBox( 678 SizedBox(
679 - height: context!.page.pageFormat.availableWidth, 679 + height: context.page.pageFormat.availableWidth,
680 child: ColorWheel( 680 child: ColorWheel(
681 colorSpace: colorSpace, 681 colorSpace: colorSpace,
682 ), 682 ),
@@ -38,7 +38,7 @@ void compute(Message message) { @@ -38,7 +38,7 @@ void compute(Message message) {
38 message.image, 38 message.image,
39 ); 39 );
40 40
41 - pdf.addPage(Page(build: (Context? context) => Center(child: Image(image)))); 41 + pdf.addPage(Page(build: (Context context) => Center(child: Image(image))));
42 42
43 message.sendPort.send(pdf.save()); 43 message.sendPort.send(pdf.save());
44 } 44 }
@@ -38,14 +38,14 @@ void main() { @@ -38,14 +38,14 @@ void main() {
38 38
39 test('Pdf Jpeg Download', () async { 39 test('Pdf Jpeg Download', () async {
40 pdf.addPage(Page( 40 pdf.addPage(Page(
41 - build: (Context? context) => Center(child: Image(image)), 41 + build: (Context context) => Center(child: Image(image)),
42 )); 42 ));
43 }); 43 });
44 44
45 test('Pdf Jpeg Orientations', () { 45 test('Pdf Jpeg Orientations', () {
46 pdf.addPage( 46 pdf.addPage(
47 Page( 47 Page(
48 - build: (Context? context) => GridView( 48 + build: (Context context) => GridView(
49 crossAxisCount: 4, 49 crossAxisCount: 4,
50 crossAxisSpacing: 10, 50 crossAxisSpacing: 10,
51 children: List<Widget>.generate( 51 children: List<Widget>.generate(
@@ -95,7 +95,7 @@ void main() { @@ -95,7 +95,7 @@ void main() {
95 95
96 pdf.addPage( 96 pdf.addPage(
97 Page( 97 Page(
98 - build: (Context? context) => Center( 98 + build: (Context context) => Center(
99 child: Wrap( 99 child: Wrap(
100 spacing: 20, 100 spacing: 20,
101 runSpacing: 20, 101 runSpacing: 20,
@@ -113,7 +113,7 @@ void main() { @@ -113,7 +113,7 @@ void main() {
113 .codeUnits) { 113 .codeUnits) {
114 pdf.addPage(Page( 114 pdf.addPage(Page(
115 pageFormat: const PdfPageFormat(500, 500, marginAll: 20), 115 pageFormat: const PdfPageFormat(500, 500, marginAll: 20),
116 - build: (Context? context) { 116 + build: (Context context) {
117 return ConstrainedBox( 117 return ConstrainedBox(
118 constraints: const BoxConstraints.expand(), 118 constraints: const BoxConstraints.expand(),
119 child: FittedBox( 119 child: FittedBox(
@@ -22,7 +22,7 @@ import 'package:pdf/widgets.dart'; @@ -22,7 +22,7 @@ import 'package:pdf/widgets.dart';
22 22
23 late Document pdf; 23 late Document pdf;
24 24
25 -Widget content(Context? context) { 25 +Widget content(Context context) {
26 return ListView(children: contentMultiPage(context)); 26 return ListView(children: contentMultiPage(context));
27 } 27 }
28 28
@@ -38,7 +38,7 @@ Widget header(Context context) { @@ -38,7 +38,7 @@ Widget header(Context context) {
38 ); 38 );
39 } 39 }
40 40
41 -List<Widget> contentMultiPage(Context? context) { 41 +List<Widget> contentMultiPage(Context context) {
42 return List<Widget>.generate( 42 return List<Widget>.generate(
43 150, 43 150,
44 (int n) => Container( 44 (int n) => Container(
@@ -31,7 +31,7 @@ void main() { @@ -31,7 +31,7 @@ void main() {
31 test('Pdf Roll Paper', () async { 31 test('Pdf Roll Paper', () async {
32 pdf.addPage(Page( 32 pdf.addPage(Page(
33 pageFormat: PdfPageFormat.roll80, 33 pageFormat: PdfPageFormat.roll80,
34 - build: (Context? context) => Padding( 34 + build: (Context context) => Padding(
35 padding: const EdgeInsets.all(30), 35 padding: const EdgeInsets.all(30),
36 child: Center( 36 child: Center(
37 child: Text('Hello World!'), 37 child: Text('Hello World!'),
@@ -43,7 +43,7 @@ void main() { @@ -43,7 +43,7 @@ void main() {
43 test('Pdf Automatic Paper', () async { 43 test('Pdf Automatic Paper', () async {
44 pdf.addPage(Page( 44 pdf.addPage(Page(
45 pageFormat: PdfPageFormat.undefined, 45 pageFormat: PdfPageFormat.undefined,
46 - build: (Context? context) => Text('Hello World!'))); 46 + build: (Context context) => Text('Hello World!')));
47 }); 47 });
48 48
49 tearDownAll(() async { 49 tearDownAll(() async {
@@ -30,7 +30,7 @@ void main() { @@ -30,7 +30,7 @@ void main() {
30 30
31 test('Basic Widgets Align 1', () { 31 test('Basic Widgets Align 1', () {
32 pdf.addPage(Page( 32 pdf.addPage(Page(
33 - build: (Context? context) => Align( 33 + build: (Context context) => Align(
34 alignment: Alignment.bottomRight, 34 alignment: Alignment.bottomRight,
35 child: SizedBox(width: 100, height: 100, child: PdfLogo()), 35 child: SizedBox(width: 100, height: 100, child: PdfLogo()),
36 ))); 36 )));
@@ -38,7 +38,7 @@ void main() { @@ -38,7 +38,7 @@ void main() {
38 38
39 test('Basic Widgets Align 2', () { 39 test('Basic Widgets Align 2', () {
40 pdf.addPage(Page( 40 pdf.addPage(Page(
41 - build: (Context? context) => Align( 41 + build: (Context context) => Align(
42 alignment: const Alignment(0.8, 0.2), 42 alignment: const Alignment(0.8, 0.2),
43 child: SizedBox(width: 100, height: 100, child: PdfLogo()), 43 child: SizedBox(width: 100, height: 100, child: PdfLogo()),
44 ))); 44 )));
@@ -46,7 +46,7 @@ void main() { @@ -46,7 +46,7 @@ void main() {
46 46
47 test('Basic Widgets AspectRatio', () { 47 test('Basic Widgets AspectRatio', () {
48 pdf.addPage(Page( 48 pdf.addPage(Page(
49 - build: (Context? context) => AspectRatio( 49 + build: (Context context) => AspectRatio(
50 aspectRatio: 1.618, 50 aspectRatio: 1.618,
51 child: Placeholder(), 51 child: Placeholder(),
52 ))); 52 )));
@@ -54,14 +54,14 @@ void main() { @@ -54,14 +54,14 @@ void main() {
54 54
55 test('Basic Widgets Center', () { 55 test('Basic Widgets Center', () {
56 pdf.addPage(Page( 56 pdf.addPage(Page(
57 - build: (Context? context) => Center( 57 + build: (Context context) => Center(
58 child: SizedBox(width: 100, height: 100, child: PdfLogo()), 58 child: SizedBox(width: 100, height: 100, child: PdfLogo()),
59 ))); 59 )));
60 }); 60 });
61 61
62 test('Basic Widgets ConstrainedBox', () { 62 test('Basic Widgets ConstrainedBox', () {
63 pdf.addPage(Page( 63 pdf.addPage(Page(
64 - build: (Context? context) => ConstrainedBox( 64 + build: (Context context) => ConstrainedBox(
65 constraints: const BoxConstraints.tightFor(height: 300), 65 constraints: const BoxConstraints.tightFor(height: 300),
66 child: Placeholder()), 66 child: Placeholder()),
67 )); 67 ));
@@ -69,7 +69,7 @@ void main() { @@ -69,7 +69,7 @@ void main() {
69 69
70 test('Basic Widgets CustomPaint', () { 70 test('Basic Widgets CustomPaint', () {
71 pdf.addPage(Page( 71 pdf.addPage(Page(
72 - build: (Context? context) => CustomPaint( 72 + build: (Context context) => CustomPaint(
73 size: const PdfPoint(200, 200), 73 size: const PdfPoint(200, 200),
74 painter: (PdfGraphics canvas, PdfPoint size) { 74 painter: (PdfGraphics canvas, PdfPoint size) {
75 canvas 75 canvas
@@ -79,7 +79,7 @@ void main() { @@ -79,7 +79,7 @@ void main() {
79 }, 79 },
80 ))); 80 )));
81 pdf.addPage(Page( 81 pdf.addPage(Page(
82 - build: (Context? context) => CustomPaint( 82 + build: (Context context) => CustomPaint(
83 size: const PdfPoint(200, 200), 83 size: const PdfPoint(200, 200),
84 painter: (PdfGraphics canvas, PdfPoint size) { 84 painter: (PdfGraphics canvas, PdfPoint size) {
85 canvas 85 canvas
@@ -93,7 +93,7 @@ void main() { @@ -93,7 +93,7 @@ void main() {
93 93
94 test('Basic Widgets FittedBox', () { 94 test('Basic Widgets FittedBox', () {
95 pdf.addPage(Page( 95 pdf.addPage(Page(
96 - build: (Context? context) => Column( 96 + build: (Context context) => Column(
97 mainAxisAlignment: MainAxisAlignment.spaceBetween, 97 mainAxisAlignment: MainAxisAlignment.spaceBetween,
98 mainAxisSize: MainAxisSize.max, 98 mainAxisSize: MainAxisSize.max,
99 children: <Widget>[ 99 children: <Widget>[
@@ -151,7 +151,7 @@ void main() { @@ -151,7 +151,7 @@ void main() {
151 151
152 test('Basic Widgets LimitedBox', () { 152 test('Basic Widgets LimitedBox', () {
153 pdf.addPage(Page( 153 pdf.addPage(Page(
154 - build: (Context? context) => ListView( 154 + build: (Context context) => ListView(
155 children: <Widget>[ 155 children: <Widget>[
156 LimitedBox( 156 LimitedBox(
157 maxHeight: 40, 157 maxHeight: 40,
@@ -163,7 +163,7 @@ void main() { @@ -163,7 +163,7 @@ void main() {
163 163
164 test('Basic Widgets Padding', () { 164 test('Basic Widgets Padding', () {
165 pdf.addPage(Page( 165 pdf.addPage(Page(
166 - build: (Context? context) => Center( 166 + build: (Context context) => Center(
167 child: Padding( 167 child: Padding(
168 padding: const EdgeInsets.all(20), 168 padding: const EdgeInsets.all(20),
169 child: PdfLogo(), 169 child: PdfLogo(),
@@ -173,7 +173,7 @@ void main() { @@ -173,7 +173,7 @@ void main() {
173 173
174 test('Basic Widgets SizedBox', () { 174 test('Basic Widgets SizedBox', () {
175 pdf.addPage(Page( 175 pdf.addPage(Page(
176 - build: (Context? context) => SizedBox( 176 + build: (Context context) => SizedBox(
177 width: 200, 177 width: 200,
178 height: 100, 178 height: 100,
179 child: Placeholder(), 179 child: Placeholder(),
@@ -182,7 +182,7 @@ void main() { @@ -182,7 +182,7 @@ void main() {
182 182
183 test('Basic Widgets Transform', () { 183 test('Basic Widgets Transform', () {
184 pdf.addPage(Page( 184 pdf.addPage(Page(
185 - build: (Context? context) => Transform.scale( 185 + build: (Context context) => Transform.scale(
186 scale: 0.5, 186 scale: 0.5,
187 child: Transform.rotate( 187 child: Transform.rotate(
188 angle: 0.1, 188 angle: 0.1,
@@ -193,7 +193,7 @@ void main() { @@ -193,7 +193,7 @@ void main() {
193 193
194 test('Basic Widgets Transform rotateBox', () { 194 test('Basic Widgets Transform rotateBox', () {
195 pdf.addPage(Page( 195 pdf.addPage(Page(
196 - build: (Context? context) => Center( 196 + build: (Context context) => Center(
197 child: Transform.rotateBox( 197 child: Transform.rotateBox(
198 angle: 3.1416 / 2, 198 angle: 3.1416 / 2,
199 child: Text('Hello'), 199 child: Text('Hello'),
@@ -32,7 +32,7 @@ void main() { @@ -32,7 +32,7 @@ void main() {
32 test('Default LineChart', () { 32 test('Default LineChart', () {
33 pdf.addPage(Page( 33 pdf.addPage(Page(
34 pageFormat: PdfPageFormat.standard.landscape, 34 pageFormat: PdfPageFormat.standard.landscape,
35 - build: (Context? context) => Chart( 35 + build: (Context context) => Chart(
36 grid: CartesianGrid( 36 grid: CartesianGrid(
37 xAxis: FixedAxis<int>(<int>[0, 1, 2, 3, 4, 5, 6]), 37 xAxis: FixedAxis<int>(<int>[0, 1, 2, 3, 4, 5, 6]),
38 yAxis: FixedAxis<int>(<int>[0, 3, 6, 9], divisions: true), 38 yAxis: FixedAxis<int>(<int>[0, 3, 6, 9], divisions: true),
@@ -53,7 +53,7 @@ void main() { @@ -53,7 +53,7 @@ void main() {
53 test('Default LineChart without lines connecting points', () { 53 test('Default LineChart without lines connecting points', () {
54 pdf.addPage(Page( 54 pdf.addPage(Page(
55 pageFormat: PdfPageFormat.standard.landscape, 55 pageFormat: PdfPageFormat.standard.landscape,
56 - build: (Context? context) => Chart( 56 + build: (Context context) => Chart(
57 grid: CartesianGrid( 57 grid: CartesianGrid(
58 xAxis: FixedAxis<int>(<int>[0, 1, 2, 3, 4, 5, 6]), 58 xAxis: FixedAxis<int>(<int>[0, 1, 2, 3, 4, 5, 6]),
59 yAxis: FixedAxis<int>(<int>[0, 3, 6, 9], divisions: true), 59 yAxis: FixedAxis<int>(<int>[0, 3, 6, 9], divisions: true),
@@ -74,7 +74,7 @@ void main() { @@ -74,7 +74,7 @@ void main() {
74 74
75 test('Default ScatterChart without dots', () { 75 test('Default ScatterChart without dots', () {
76 pdf.addPage(Page( 76 pdf.addPage(Page(
77 - build: (Context? context) => Chart( 77 + build: (Context context) => Chart(
78 grid: CartesianGrid( 78 grid: CartesianGrid(
79 xAxis: FixedAxis<int>(<int>[0, 1, 2, 3, 4, 5, 6]), 79 xAxis: FixedAxis<int>(<int>[0, 1, 2, 3, 4, 5, 6]),
80 yAxis: FixedAxis<int>(<int>[0, 3, 6, 9], divisions: true), 80 yAxis: FixedAxis<int>(<int>[0, 3, 6, 9], divisions: true),
@@ -96,7 +96,7 @@ void main() { @@ -96,7 +96,7 @@ void main() {
96 test('ScatterChart with custom points and lines', () { 96 test('ScatterChart with custom points and lines', () {
97 pdf.addPage(Page( 97 pdf.addPage(Page(
98 pageFormat: PdfPageFormat.standard.landscape, 98 pageFormat: PdfPageFormat.standard.landscape,
99 - build: (Context? context) => Chart( 99 + build: (Context context) => Chart(
100 grid: CartesianGrid( 100 grid: CartesianGrid(
101 xAxis: FixedAxis<int>(<int>[0, 1, 2, 3, 4, 5, 6]), 101 xAxis: FixedAxis<int>(<int>[0, 1, 2, 3, 4, 5, 6]),
102 yAxis: FixedAxis<int>(<int>[0, 3, 6, 9], divisions: true), 102 yAxis: FixedAxis<int>(<int>[0, 3, 6, 9], divisions: true),
@@ -122,7 +122,7 @@ void main() { @@ -122,7 +122,7 @@ void main() {
122 test('ScatterChart with custom size', () { 122 test('ScatterChart with custom size', () {
123 pdf.addPage(Page( 123 pdf.addPage(Page(
124 pageFormat: PdfPageFormat.standard.landscape, 124 pageFormat: PdfPageFormat.standard.landscape,
125 - build: (Context? context) => SizedBox( 125 + build: (Context context) => SizedBox(
126 width: 200, 126 width: 200,
127 height: 100, 127 height: 100,
128 child: Chart( 128 child: Chart(
@@ -147,7 +147,7 @@ void main() { @@ -147,7 +147,7 @@ void main() {
147 test('LineChart with curved lines', () { 147 test('LineChart with curved lines', () {
148 pdf.addPage(Page( 148 pdf.addPage(Page(
149 pageFormat: PdfPageFormat.standard.landscape, 149 pageFormat: PdfPageFormat.standard.landscape,
150 - build: (Context? context) => Chart( 150 + build: (Context context) => Chart(
151 grid: CartesianGrid( 151 grid: CartesianGrid(
152 xAxis: FixedAxis<int>(<int>[0, 1, 2, 3, 4, 5, 6]), 152 xAxis: FixedAxis<int>(<int>[0, 1, 2, 3, 4, 5, 6]),
153 yAxis: FixedAxis<int>(<int>[0, 3, 6, 9], divisions: true), 153 yAxis: FixedAxis<int>(<int>[0, 3, 6, 9], divisions: true),
@@ -172,7 +172,7 @@ void main() { @@ -172,7 +172,7 @@ void main() {
172 test('Default BarChart', () { 172 test('Default BarChart', () {
173 pdf.addPage(Page( 173 pdf.addPage(Page(
174 pageFormat: PdfPageFormat.standard.landscape, 174 pageFormat: PdfPageFormat.standard.landscape,
175 - build: (Context? context) => Chart( 175 + build: (Context context) => Chart(
176 grid: CartesianGrid( 176 grid: CartesianGrid(
177 xAxis: FixedAxis<int>(<int>[0, 1, 2, 3, 4, 5, 6]), 177 xAxis: FixedAxis<int>(<int>[0, 1, 2, 3, 4, 5, 6]),
178 yAxis: FixedAxis<int>(<int>[0, 3, 6, 9], divisions: true), 178 yAxis: FixedAxis<int>(<int>[0, 3, 6, 9], divisions: true),
@@ -193,7 +193,7 @@ void main() { @@ -193,7 +193,7 @@ void main() {
193 test('Vertical BarChart', () { 193 test('Vertical BarChart', () {
194 pdf.addPage(Page( 194 pdf.addPage(Page(
195 pageFormat: PdfPageFormat.standard.landscape, 195 pageFormat: PdfPageFormat.standard.landscape,
196 - build: (Context? context) => Chart( 196 + build: (Context context) => Chart(
197 grid: CartesianGrid( 197 grid: CartesianGrid(
198 xAxis: FixedAxis<int>(<int>[0, 1, 2, 3, 4, 5, 6]), 198 xAxis: FixedAxis<int>(<int>[0, 1, 2, 3, 4, 5, 6]),
199 yAxis: FixedAxis<int>(<int>[0, 3, 6, 9], divisions: true), 199 yAxis: FixedAxis<int>(<int>[0, 3, 6, 9], divisions: true),
@@ -30,7 +30,7 @@ void main() { @@ -30,7 +30,7 @@ void main() {
30 30
31 test('Clip Widgets ClipRect', () { 31 test('Clip Widgets ClipRect', () {
32 pdf.addPage(Page( 32 pdf.addPage(Page(
33 - build: (Context? context) => ClipRect( 33 + build: (Context context) => ClipRect(
34 child: Transform.rotate( 34 child: Transform.rotate(
35 angle: 0.1, 35 angle: 0.1,
36 child: Container( 36 child: Container(
@@ -45,7 +45,7 @@ void main() { @@ -45,7 +45,7 @@ void main() {
45 45
46 test('Clip Widgets ClipRRect', () { 46 test('Clip Widgets ClipRRect', () {
47 pdf.addPage(Page( 47 pdf.addPage(Page(
48 - build: (Context? context) => ClipRRect( 48 + build: (Context context) => ClipRRect(
49 horizontalRadius: 30, 49 horizontalRadius: 30,
50 verticalRadius: 30, 50 verticalRadius: 30,
51 child: Container( 51 child: Container(
@@ -59,7 +59,7 @@ void main() { @@ -59,7 +59,7 @@ void main() {
59 59
60 test('Clip Widgets ClipOval', () { 60 test('Clip Widgets ClipOval', () {
61 pdf.addPage(Page( 61 pdf.addPage(Page(
62 - build: (Context? context) => ClipOval( 62 + build: (Context context) => ClipOval(
63 child: Container( 63 child: Container(
64 decoration: const BoxDecoration( 64 decoration: const BoxDecoration(
65 color: PdfColors.blue, 65 color: PdfColors.blue,
@@ -32,7 +32,7 @@ void main() { @@ -32,7 +32,7 @@ void main() {
32 32
33 test('Container Widgets Flat', () { 33 test('Container Widgets Flat', () {
34 pdf.addPage(Page( 34 pdf.addPage(Page(
35 - build: (Context? context) => Container( 35 + build: (Context context) => Container(
36 alignment: Alignment.center, 36 alignment: Alignment.center,
37 margin: const EdgeInsets.all(30), 37 margin: const EdgeInsets.all(30),
38 padding: const EdgeInsets.all(20), 38 padding: const EdgeInsets.all(20),
@@ -92,7 +92,7 @@ void main() { @@ -92,7 +92,7 @@ void main() {
92 92
93 test('Container Widgets BoxShape Border', () { 93 test('Container Widgets BoxShape Border', () {
94 pdf.addPage(Page( 94 pdf.addPage(Page(
95 - build: (Context? context) => Center( 95 + build: (Context context) => Center(
96 child: Column( 96 child: Column(
97 mainAxisAlignment: MainAxisAlignment.spaceEvenly, 97 mainAxisAlignment: MainAxisAlignment.spaceEvenly,
98 children: <Widget>[ 98 children: <Widget>[
@@ -121,7 +121,7 @@ void main() { @@ -121,7 +121,7 @@ void main() {
121 121
122 test('Container Widgets LinearGradient', () { 122 test('Container Widgets LinearGradient', () {
123 pdf.addPage(Page( 123 pdf.addPage(Page(
124 - build: (Context? context) => Container( 124 + build: (Context context) => Container(
125 alignment: Alignment.center, 125 alignment: Alignment.center,
126 margin: const EdgeInsets.all(30), 126 margin: const EdgeInsets.all(30),
127 padding: const EdgeInsets.all(20), 127 padding: const EdgeInsets.all(20),
@@ -150,7 +150,7 @@ void main() { @@ -150,7 +150,7 @@ void main() {
150 150
151 test('Container Widgets RadialGradient', () { 151 test('Container Widgets RadialGradient', () {
152 pdf.addPage(Page( 152 pdf.addPage(Page(
153 - build: (Context? context) => Container( 153 + build: (Context context) => Container(
154 alignment: Alignment.center, 154 alignment: Alignment.center,
155 margin: const EdgeInsets.all(30), 155 margin: const EdgeInsets.all(30),
156 padding: const EdgeInsets.all(20), 156 padding: const EdgeInsets.all(20),
@@ -180,7 +180,7 @@ void main() { @@ -180,7 +180,7 @@ void main() {
180 180
181 test('Container Widgets BoxShadow', () { 181 test('Container Widgets BoxShadow', () {
182 pdf.addPage(Page( 182 pdf.addPage(Page(
183 - build: (Context? context) => Container( 183 + build: (Context context) => Container(
184 margin: const EdgeInsets.all(30), 184 margin: const EdgeInsets.all(30),
185 padding: const EdgeInsets.all(20), 185 padding: const EdgeInsets.all(20),
186 decoration: const BoxDecoration( 186 decoration: const BoxDecoration(
@@ -31,7 +31,7 @@ void main() { @@ -31,7 +31,7 @@ void main() {
31 test('Flex Widgets ListView', () { 31 test('Flex Widgets ListView', () {
32 pdf.addPage( 32 pdf.addPage(
33 Page( 33 Page(
34 - build: (Context? context) => ListView( 34 + build: (Context context) => ListView(
35 spacing: 20, 35 spacing: 20,
36 padding: const EdgeInsets.all(10), 36 padding: const EdgeInsets.all(10),
37 children: <Widget>[ 37 children: <Widget>[
@@ -47,7 +47,7 @@ void main() { @@ -47,7 +47,7 @@ void main() {
47 test('Flex Widgets ListView.builder', () { 47 test('Flex Widgets ListView.builder', () {
48 pdf.addPage( 48 pdf.addPage(
49 Page( 49 Page(
50 - build: (Context? context) => ListView.builder( 50 + build: (Context context) => ListView.builder(
51 itemBuilder: (Context context, int index) => Text('Line $index'), 51 itemBuilder: (Context context, int index) => Text('Line $index'),
52 itemCount: 30, 52 itemCount: 30,
53 spacing: 2, 53 spacing: 2,
@@ -60,7 +60,7 @@ void main() { @@ -60,7 +60,7 @@ void main() {
60 test('Flex Widgets ListView.separated', () { 60 test('Flex Widgets ListView.separated', () {
61 pdf.addPage( 61 pdf.addPage(
62 Page( 62 Page(
63 - build: (Context? context) => ListView.separated( 63 + build: (Context context) => ListView.separated(
64 separatorBuilder: (Context context, int index) => Container( 64 separatorBuilder: (Context context, int index) => Container(
65 color: PdfColors.grey, 65 color: PdfColors.grey,
66 height: 0.5, 66 height: 0.5,
@@ -76,7 +76,7 @@ void main() { @@ -76,7 +76,7 @@ void main() {
76 test('Flex Widgets Spacer', () { 76 test('Flex Widgets Spacer', () {
77 pdf.addPage( 77 pdf.addPage(
78 Page( 78 Page(
79 - build: (Context? context) => Column( 79 + build: (Context context) => Column(
80 children: <Widget>[ 80 children: <Widget>[
81 Text('Begin'), 81 Text('Begin'),
82 Spacer(), // Defaults to a flex of one. 82 Spacer(), // Defaults to a flex of one.
@@ -74,7 +74,7 @@ void main() { @@ -74,7 +74,7 @@ void main() {
74 () { 74 () {
75 pdf.addPage( 75 pdf.addPage(
76 Page( 76 Page(
77 - build: (Context? context) => Wrap( 77 + build: (Context context) => Wrap(
78 crossAxisAlignment: WrapCrossAlignment.center, 78 crossAxisAlignment: WrapCrossAlignment.center,
79 children: <Widget>[ 79 children: <Widget>[
80 Label(label: 'Given Name:', width: 100), 80 Label(label: 'Given Name:', width: 100),
@@ -51,7 +51,7 @@ void main() { @@ -51,7 +51,7 @@ void main() {
51 51
52 test('Pdf Widgets GridView Horizontal', () { 52 test('Pdf Widgets GridView Horizontal', () {
53 pdf.addPage(Page( 53 pdf.addPage(Page(
54 - build: (Context? context) => GridView( 54 + build: (Context context) => GridView(
55 crossAxisCount: 5, 55 crossAxisCount: 5,
56 direction: Axis.horizontal, 56 direction: Axis.horizontal,
57 childAspectRatio: 1, 57 childAspectRatio: 1,
@@ -47,7 +47,7 @@ void main() { @@ -47,7 +47,7 @@ void main() {
47 47
48 final pdf = Document(); 48 final pdf = Document();
49 49
50 - pdf.addPage(Page(build: (Context? context) => Column(children: lines))); 50 + pdf.addPage(Page(build: (Context context) => Column(children: lines)));
51 51
52 final file = File('widgets-monopage.pdf'); 52 final file = File('widgets-monopage.pdf');
53 await file.writeAsBytes(await pdf.save()); 53 await file.writeAsBytes(await pdf.save());
@@ -30,7 +30,7 @@ void main() { @@ -30,7 +30,7 @@ void main() {
30 test('Opacity Widgets', () { 30 test('Opacity Widgets', () {
31 pdf.addPage( 31 pdf.addPage(
32 Page( 32 Page(
33 - build: (Context? context) => Stack( 33 + build: (Context context) => Stack(
34 alignment: Alignment.center, 34 alignment: Alignment.center,
35 children: <Widget>[ 35 children: <Widget>[
36 Text('Background', textScaleFactor: 5), 36 Text('Background', textScaleFactor: 5),
@@ -71,13 +71,13 @@ void main() { @@ -71,13 +71,13 @@ void main() {
71 71
72 test('Table Widget empty', () { 72 test('Table Widget empty', () {
73 pdf.addPage(Page( 73 pdf.addPage(Page(
74 - build: (Context? context) => Table(), 74 + build: (Context context) => Table(),
75 )); 75 ));
76 }); 76 });
77 77
78 test('Table Widget filled', () { 78 test('Table Widget filled', () {
79 pdf.addPage(Page( 79 pdf.addPage(Page(
80 - build: (Context? context) => Table( 80 + build: (Context context) => Table(
81 children: buildTable(context: context, count: 20), 81 children: buildTable(context: context, count: 20),
82 border: TableBorder.all(), 82 border: TableBorder.all(),
83 tableWidth: TableWidth.max, 83 tableWidth: TableWidth.max,
@@ -135,7 +135,7 @@ void main() { @@ -135,7 +135,7 @@ void main() {
135 135
136 test('Table Widget Widths', () { 136 test('Table Widget Widths', () {
137 pdf.addPage(Page( 137 pdf.addPage(Page(
138 - build: (Context? context) => Table( 138 + build: (Context context) => Table(
139 children: buildTable(context: context, count: 20), 139 children: buildTable(context: context, count: 20),
140 border: TableBorder.all(), 140 border: TableBorder.all(),
141 columnWidths: <int, TableColumnWidth>{ 141 columnWidths: <int, TableColumnWidth>{
@@ -189,7 +189,7 @@ void main() { @@ -189,7 +189,7 @@ void main() {
189 189
190 test('Table fromTextArray', () { 190 test('Table fromTextArray', () {
191 pdf.addPage(Page( 191 pdf.addPage(Page(
192 - build: (Context? context) => Table.fromTextArray( 192 + build: (Context context) => Table.fromTextArray(
193 context: context, 193 context: context,
194 tableWidth: TableWidth.min, 194 tableWidth: TableWidth.min,
195 data: <List<dynamic>>[ 195 data: <List<dynamic>>[
@@ -203,7 +203,7 @@ void main() { @@ -203,7 +203,7 @@ void main() {
203 203
204 test('Table fromTextArray with formatting', () { 204 test('Table fromTextArray with formatting', () {
205 pdf.addPage(Page( 205 pdf.addPage(Page(
206 - build: (Context? context) => Table.fromTextArray( 206 + build: (Context context) => Table.fromTextArray(
207 border: null, 207 border: null,
208 cellAlignment: Alignment.center, 208 cellAlignment: Alignment.center,
209 headerDecoration: const BoxDecoration( 209 headerDecoration: const BoxDecoration(
@@ -239,7 +239,7 @@ void main() { @@ -239,7 +239,7 @@ void main() {
239 theme: ThemeData.withFont( 239 theme: ThemeData.withFont(
240 base: loadFont('hacen-tunisia.ttf'), 240 base: loadFont('hacen-tunisia.ttf'),
241 ), 241 ),
242 - build: (Context? context) => Directionality( 242 + build: (Context context) => Directionality(
243 textDirection: TextDirection.rtl, 243 textDirection: TextDirection.rtl,
244 child: Table.fromTextArray( 244 child: Table.fromTextArray(
245 headers: <dynamic>['ثلاثة', 'اثنان', 'واحد'], 245 headers: <dynamic>['ثلاثة', 'اثنان', 'واحد'],
@@ -256,7 +256,7 @@ void main() { @@ -256,7 +256,7 @@ void main() {
256 test('Table fromTextArray with alignment', () { 256 test('Table fromTextArray with alignment', () {
257 pdf.addPage( 257 pdf.addPage(
258 Page( 258 Page(
259 - build: (Context? context) => Table.fromTextArray( 259 + build: (Context context) => Table.fromTextArray(
260 cellAlignment: Alignment.center, 260 cellAlignment: Alignment.center,
261 data: <List<String>>[ 261 data: <List<String>>[
262 <String>['line 1', 'Text\n\n\ntext'], 262 <String>['line 1', 'Text\n\n\ntext'],
@@ -51,7 +51,7 @@ void main() { @@ -51,7 +51,7 @@ void main() {
51 pdf.addPage(Page( 51 pdf.addPage(Page(
52 pageFormat: const PdfPageFormat(400, 400), 52 pageFormat: const PdfPageFormat(400, 400),
53 margin: const EdgeInsets.all(10), 53 margin: const EdgeInsets.all(10),
54 - build: (Context? context) => Column(children: <Widget>[ 54 + build: (Context context) => Column(children: <Widget>[
55 Container( 55 Container(
56 padding: const EdgeInsets.all(5), 56 padding: const EdgeInsets.all(5),
57 margin: const EdgeInsets.only(bottom: 10), 57 margin: const EdgeInsets.only(bottom: 10),
@@ -114,7 +114,7 @@ void main() { @@ -114,7 +114,7 @@ void main() {
114 "That's all Folks!", 114 "That's all Folks!",
115 tightBounds: true, 115 tightBounds: true,
116 textAlign: TextAlign.center, 116 textAlign: TextAlign.center,
117 - style: Theme.of(context!).defaultTextStyle.copyWith( 117 + style: Theme.of(context).defaultTextStyle.copyWith(
118 font: Font.timesBoldItalic(), 118 font: Font.timesBoldItalic(),
119 ), 119 ),
120 textScaleFactor: 3, 120 textScaleFactor: 3,
@@ -128,7 +128,7 @@ void main() { @@ -128,7 +128,7 @@ void main() {
128 Page( 128 Page(
129 pageFormat: const PdfPageFormat(400, 400), 129 pageFormat: const PdfPageFormat(400, 400),
130 margin: const EdgeInsets.all(10), 130 margin: const EdgeInsets.all(10),
131 - build: (Context? context) => Center( 131 + build: (Context context) => Center(
132 child: GridView( 132 child: GridView(
133 crossAxisCount: 3, 133 crossAxisCount: 3,
134 direction: Axis.vertical, 134 direction: Axis.vertical,
@@ -205,7 +205,7 @@ void main() { @@ -205,7 +205,7 @@ void main() {
205 Page( 205 Page(
206 pageFormat: const PdfPageFormat(400, 200), 206 pageFormat: const PdfPageFormat(400, 200),
207 margin: const EdgeInsets.all(10), 207 margin: const EdgeInsets.all(10),
208 - build: (Context? context) => Stack( 208 + build: (Context context) => Stack(
209 overflow: Overflow.visible, 209 overflow: Overflow.visible,
210 // fit: StackFit.expand, 210 // fit: StackFit.expand,
211 // alignment: Alignment.bottomRight, 211 // alignment: Alignment.bottomRight,
@@ -227,7 +227,7 @@ void main() { @@ -227,7 +227,7 @@ void main() {
227 child: RichText( 227 child: RichText(
228 text: TextSpan( 228 text: TextSpan(
229 text: 'Hello ', 229 text: 'Hello ',
230 - style: Theme.of(context!).defaultTextStyle, 230 + style: Theme.of(context).defaultTextStyle,
231 children: <TextSpan>[ 231 children: <TextSpan>[
232 TextSpan( 232 TextSpan(
233 text: 'bold', 233 text: 'bold',
@@ -53,12 +53,12 @@ void main() { @@ -53,12 +53,12 @@ void main() {
53 53
54 test('Text Widgets Quotes', () { 54 test('Text Widgets Quotes', () {
55 pdf.addPage(Page( 55 pdf.addPage(Page(
56 - build: (Context? context) => Text('Text containing \' or " works!'))); 56 + build: (Context context) => Text('Text containing \' or " works!')));
57 }); 57 });
58 58
59 test('Text Widgets Unicode Quotes', () { 59 test('Text Widgets Unicode Quotes', () {
60 pdf.addPage(Page( 60 pdf.addPage(Page(
61 - build: (Context? context) => Text('Text containing ’ and ” works!', 61 + build: (Context context) => Text('Text containing ’ and ” works!',
62 style: TextStyle(font: ttf)))); 62 style: TextStyle(font: ttf))));
63 }); 63 });
64 64
@@ -249,7 +249,7 @@ void main() { @@ -249,7 +249,7 @@ void main() {
249 249
250 test('Text Widgets RichText Multiple lang', () { 250 test('Text Widgets RichText Multiple lang', () {
251 pdf.addPage(Page( 251 pdf.addPage(Page(
252 - build: (Context? context) => RichText( 252 + build: (Context context) => RichText(
253 text: TextSpan( 253 text: TextSpan(
254 text: 'Hello ', 254 text: 'Hello ',
255 style: TextStyle( 255 style: TextStyle(
@@ -276,7 +276,7 @@ void main() { @@ -276,7 +276,7 @@ void main() {
276 276
277 pdf.addPage( 277 pdf.addPage(
278 Page( 278 Page(
279 - build: (Context? context) => RichText( 279 + build: (Context context) => RichText(
280 maxLines: 3, 280 maxLines: 3,
281 text: TextSpan( 281 text: TextSpan(
282 text: para, 282 text: para,
@@ -55,7 +55,7 @@ void main() { @@ -55,7 +55,7 @@ void main() {
55 color: PdfColors.blue); 55 color: PdfColors.blue);
56 56
57 pdf.addPage(Page( 57 pdf.addPage(Page(
58 - build: (Context? context) => ListView( 58 + build: (Context context) => ListView(
59 children: <Widget>[ 59 children: <Widget>[
60 Text( 60 Text(
61 style.font!.fontName!, 61 style.font!.fontName!,
@@ -71,7 +71,7 @@ void main() { @@ -71,7 +71,7 @@ void main() {
71 71
72 pdf.addPage(Page( 72 pdf.addPage(Page(
73 theme: theme, 73 theme: theme,
74 - build: (Context? context) => Center( 74 + build: (Context context) => Center(
75 child: Text('Hello'), 75 child: Text('Hello'),
76 ), 76 ),
77 )); 77 ));
@@ -85,7 +85,7 @@ void main() { @@ -85,7 +85,7 @@ void main() {
85 85
86 pdf.addPage(Page( 86 pdf.addPage(Page(
87 theme: theme, 87 theme: theme,
88 - build: (Context? context) => Center( 88 + build: (Context context) => Center(
89 child: Table.fromTextArray(context: context, data: <List<String>>[ 89 child: Table.fromTextArray(context: context, data: <List<String>>[
90 <String>['Header', '123'], 90 <String>['Header', '123'],
91 <String>['Cell', '456'] 91 <String>['Cell', '456']
@@ -96,7 +96,7 @@ void main() { @@ -96,7 +96,7 @@ void main() {
96 96
97 test('Theme Page 3', () { 97 test('Theme Page 3', () {
98 pdf.addPage(Page( 98 pdf.addPage(Page(
99 - build: (Context? context) => Center( 99 + build: (Context context) => Center(
100 child: Column( 100 child: Column(
101 mainAxisAlignment: MainAxisAlignment.spaceEvenly, 101 mainAxisAlignment: MainAxisAlignment.spaceEvenly,
102 children: <Widget>[ 102 children: <Widget>[
@@ -121,7 +121,7 @@ void main() { @@ -121,7 +121,7 @@ void main() {
121 theme: ThemeData( 121 theme: ThemeData(
122 defaultTextStyle: TextStyle(font: Font.courier(), fontSize: 10.0), 122 defaultTextStyle: TextStyle(font: Font.courier(), fontSize: 10.0),
123 ), 123 ),
124 - build: (Context? context) { 124 + build: (Context context) {
125 return Center(child: Text('Text')); 125 return Center(child: Text('Text'));
126 })); 126 }));
127 }); 127 });
@@ -48,7 +48,7 @@ void main() { @@ -48,7 +48,7 @@ void main() {
48 pdf.addPage( 48 pdf.addPage(
49 Page( 49 Page(
50 pageTheme: pageTheme, 50 pageTheme: pageTheme,
51 - build: (Context? context) => Center( 51 + build: (Context context) => Center(
52 child: Text( 52 child: Text(
53 'Hello World', 53 'Hello World',
54 ), 54 ),
@@ -53,7 +53,7 @@ void main() { @@ -53,7 +53,7 @@ void main() {
53 Page( 53 Page(
54 pageFormat: const PdfPageFormat(400, 800), 54 pageFormat: const PdfPageFormat(400, 800),
55 margin: const EdgeInsets.all(10), 55 margin: const EdgeInsets.all(10),
56 - build: (Context? context) => Column( 56 + build: (Context context) => Column(
57 mainAxisAlignment: MainAxisAlignment.spaceEvenly, 57 mainAxisAlignment: MainAxisAlignment.spaceEvenly,
58 children: wraps, 58 children: wraps,
59 ), 59 ),
@@ -85,7 +85,7 @@ void main() { @@ -85,7 +85,7 @@ void main() {
85 Page( 85 Page(
86 pageFormat: const PdfPageFormat(800, 400), 86 pageFormat: const PdfPageFormat(800, 400),
87 margin: const EdgeInsets.all(10), 87 margin: const EdgeInsets.all(10),
88 - build: (Context? context) => Row( 88 + build: (Context context) => Row(
89 mainAxisAlignment: MainAxisAlignment.spaceEvenly, 89 mainAxisAlignment: MainAxisAlignment.spaceEvenly,
90 children: wraps, 90 children: wraps,
91 ), 91 ),
@@ -119,7 +119,7 @@ void main() { @@ -119,7 +119,7 @@ void main() {
119 Page( 119 Page(
120 pageFormat: const PdfPageFormat(400, 800), 120 pageFormat: const PdfPageFormat(400, 800),
121 margin: const EdgeInsets.all(10), 121 margin: const EdgeInsets.all(10),
122 - build: (Context? context) => Column( 122 + build: (Context context) => Column(
123 mainAxisAlignment: MainAxisAlignment.spaceEvenly, 123 mainAxisAlignment: MainAxisAlignment.spaceEvenly,
124 children: wraps, 124 children: wraps,
125 ), 125 ),
@@ -153,7 +153,7 @@ void main() { @@ -153,7 +153,7 @@ void main() {
153 Page( 153 Page(
154 pageFormat: const PdfPageFormat(800, 400), 154 pageFormat: const PdfPageFormat(800, 400),
155 margin: const EdgeInsets.all(10), 155 margin: const EdgeInsets.all(10),
156 - build: (Context? context) => Row( 156 + build: (Context context) => Row(
157 mainAxisAlignment: MainAxisAlignment.spaceEvenly, 157 mainAxisAlignment: MainAxisAlignment.spaceEvenly,
158 children: wraps, 158 children: wraps,
159 ), 159 ),
@@ -189,7 +189,7 @@ void main() { @@ -189,7 +189,7 @@ void main() {
189 Page( 189 Page(
190 pageFormat: const PdfPageFormat(400, 800), 190 pageFormat: const PdfPageFormat(400, 800),
191 margin: const EdgeInsets.all(10), 191 margin: const EdgeInsets.all(10),
192 - build: (Context? context) => Column( 192 + build: (Context context) => Column(
193 mainAxisAlignment: MainAxisAlignment.spaceEvenly, 193 mainAxisAlignment: MainAxisAlignment.spaceEvenly,
194 children: wraps, 194 children: wraps,
195 ), 195 ),
@@ -225,7 +225,7 @@ void main() { @@ -225,7 +225,7 @@ void main() {
225 Page( 225 Page(
226 pageFormat: const PdfPageFormat(800, 400), 226 pageFormat: const PdfPageFormat(800, 400),
227 margin: const EdgeInsets.all(10), 227 margin: const EdgeInsets.all(10),
228 - build: (Context? context) => Row( 228 + build: (Context context) => Row(
229 mainAxisAlignment: MainAxisAlignment.spaceEvenly, 229 mainAxisAlignment: MainAxisAlignment.spaceEvenly,
230 children: wraps, 230 children: wraps,
231 ), 231 ),
@@ -239,7 +239,7 @@ void main() { @@ -239,7 +239,7 @@ void main() {
239 Page( 239 Page(
240 pageFormat: const PdfPageFormat(200, 200), 240 pageFormat: const PdfPageFormat(200, 200),
241 margin: const EdgeInsets.all(10), 241 margin: const EdgeInsets.all(10),
242 - build: (Context? context) => Wrap( 242 + build: (Context context) => Wrap(
243 spacing: 10, 243 spacing: 10,
244 runSpacing: 10, 244 runSpacing: 10,
245 children: List<Widget>.generate( 245 children: List<Widget>.generate(
@@ -285,7 +285,7 @@ void main() { @@ -285,7 +285,7 @@ void main() {
285 }); 285 });
286 286
287 test('Wrap Widget Empty', () { 287 test('Wrap Widget Empty', () {
288 - pdf.addPage(Page(build: (Context? context) => Wrap())); 288 + pdf.addPage(Page(build: (Context context) => Wrap()));
289 }); 289 });
290 290
291 test('Wrap Widget Columns', () { 291 test('Wrap Widget Columns', () {
@@ -4,7 +4,7 @@ description: Pdf Printing Example @@ -4,7 +4,7 @@ description: Pdf Printing Example
4 version: 1.0.0+1 4 version: 1.0.0+1
5 5
6 environment: 6 environment:
7 - sdk: '>=2.12.0-224.0.dev <3.0.0' 7 + sdk: ">=2.12.0-0 <3.0.0"
8 8
9 dependencies: 9 dependencies:
10 flutter: 10 flutter:
@@ -7,8 +7,8 @@ issue_tracker: https://github.com/DavBfr/dart_pdf/issues @@ -7,8 +7,8 @@ issue_tracker: https://github.com/DavBfr/dart_pdf/issues
7 version: 5.0.0-nullsafety.0 7 version: 5.0.0-nullsafety.0
8 8
9 environment: 9 environment:
10 - sdk: '>=2.12.0-224.0.dev <3.0.0'  
11 - flutter: ">=1.12.13+hotfix.5 <2.0.0" 10 + sdk: ">=2.12.0-0 <3.0.0"
  11 + flutter: ">=1.16.0"
12 12
13 dependencies: 13 dependencies:
14 flutter: 14 flutter:
@@ -7,8 +7,8 @@ issue_tracker: https://github.com/DavBfr/dart_pdf/issues @@ -7,8 +7,8 @@ issue_tracker: https://github.com/DavBfr/dart_pdf/issues
7 version: 1.0.0 7 version: 1.0.0
8 8
9 environment: 9 environment:
10 - sdk: '>=2.12.0-224.0.dev <3.0.0'  
11 - flutter: ">=1.12.13+hotfix.5 <2.0.0" 10 + sdk: ">=2.12.0-0 <3.0.0"
  11 + flutter: ">=1.16.0"
12 12
13 dependencies: 13 dependencies:
14 flutter: 14 flutter: