Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
dart_pdf
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
David PHAM-VAN
2020-01-25 14:04:13 -0500
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
10276de6d0c914b03feae1c61e5bdb685ba50f30
10276de6
1 parent
3d505309
Fix GridView when empty
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
86 additions
and
2 deletions
pdf/CHANGELOG.md
pdf/lib/widgets/grid_view.dart
pdf/test/all_tests.dart
pdf/test/widget_grid_view_test.dart
test/golden/widgets-gridview.pdf
pdf/CHANGELOG.md
View file @
10276de
...
...
@@ -3,11 +3,12 @@
## 1.5.0
-
Fix Align debug painting
-
Fix GridView when empty
## 1.4.1
-
Update dependency to barcode ^1.5.0
-
Update type1 font warning
url
-
Update type1 font warning
URL
-
Fix Image fit
## 1.4.0
...
...
pdf/lib/widgets/grid_view.dart
View file @
10276de
...
...
@@ -56,10 +56,15 @@ class GridView extends MultiChildWidget implements SpanningWidget {
@override
void
layout
(
Context
context
,
BoxConstraints
constraints
,
{
bool
parentUsesSize
=
false
})
{
if
(
children
.
isEmpty
)
{
box
=
PdfRect
.
zero
;
return
;
}
assert
(()
{
if
(
constraints
.
maxHeight
.
isInfinite
&&
childAspectRatio
.
isInfinite
)
{
print
(
'Unable to calculate the GridView dimensions. Please set
one
the height constraints or childAspectRatio.'
);
'Unable to calculate the GridView dimensions. Please set the height constraints or childAspectRatio.'
);
return
false
;
}
return
true
;
...
...
@@ -208,6 +213,10 @@ class GridView extends MultiChildWidget implements SpanningWidget {
void
debugPaint
(
Context
context
)
{
super
.
debugPaint
(
context
);
if
(
children
.
isEmpty
)
{
return
;
}
context
.
canvas
..
setFillColor
(
PdfColors
.
lime
)
..
moveTo
(
box
.
left
,
box
.
bottom
)
...
...
pdf/test/all_tests.dart
View file @
10276de
...
...
@@ -33,6 +33,7 @@ import 'widget_basic_test.dart' as widget_basic;
import
'widget_clip_test.dart'
as
widget_clip
;
import
'widget_container_test.dart'
as
widget_container
;
import
'widget_flex_test.dart'
as
widget_flex
;
import
'widget_grid_view_test.dart'
as
widget_grid_view
;
import
'widget_multipage_test.dart'
as
widget_multipage
;
import
'widget_table_test.dart'
as
widget_table
;
import
'widget_test.dart'
as
widget
;
...
...
@@ -59,6 +60,7 @@ void main() {
widget_clip
.
main
();
widget_container
.
main
();
widget_flex
.
main
();
widget_grid_view
.
main
();
widget_multipage
.
main
();
widget_table
.
main
();
widget_text
.
main
();
...
...
pdf/test/widget_grid_view_test.dart
0 → 100644
View file @
10276de
/*
* Copyright (C) 2017, David PHAM-VAN <dev.nfet.net@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// ignore_for_file: omit_local_variable_types
import
'dart:io'
;
import
'package:pdf/widgets.dart'
;
import
'package:test/test.dart'
;
Document
pdf
;
void
main
(
)
{
setUpAll
(()
{
Document
.
debug
=
true
;
pdf
=
Document
();
});
test
(
'Pdf Widgets GridView empty'
,
()
{
pdf
.
addPage
(
MultiPage
(
build:
(
Context
context
)
=>
<
Widget
>[
GridView
(
crossAxisCount:
1
,
childAspectRatio:
1
,
),
]));
});
test
(
'Pdf Widgets GridView Vertical'
,
()
{
pdf
.
addPage
(
MultiPage
(
build:
(
Context
context
)
=>
<
Widget
>[
GridView
(
crossAxisCount:
3
,
childAspectRatio:
1
,
direction:
Axis
.
vertical
,
children:
List
<
Widget
>.
generate
(
20
,
(
int
index
)
=>
Center
(
child:
Text
(
'
$index
'
)))),
]));
});
test
(
'Pdf Widgets GridView Horizontal'
,
()
{
pdf
.
addPage
(
Page
(
build:
(
Context
context
)
=>
GridView
(
crossAxisCount:
5
,
direction:
Axis
.
horizontal
,
childAspectRatio:
1
,
children:
List
<
Widget
>.
generate
(
20
,
(
int
index
)
=>
Center
(
child:
Text
(
'
$index
'
)))),
));
});
tearDownAll
(()
{
final
File
file
=
File
(
'widgets-gridview.pdf'
);
file
.
writeAsBytesSync
(
pdf
.
save
());
});
}
...
...
test/golden/widgets-gridview.pdf
0 → 100644
View file @
10276de
No preview for this file type
Please
register
or
login
to post a comment