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
2021-04-16 07:40:15 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0a503bfef17d4feaac8e02b7a8d549f36afcabf2
0a503bfe
1 parent
fac1fb22
ImageProvider.resolve returns non-null object
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
5 deletions
pdf/CHANGELOG.md
pdf/lib/src/widgets/decoration.dart
pdf/lib/src/widgets/image.dart
pdf/lib/src/widgets/image_provider.dart
pdf/CHANGELOG.md
View file @
0a503bf
...
...
@@ -7,6 +7,7 @@
-
Add individual cell decoration
-
Improve Bullet Widget
-
Use covariant on SpanningWidget
-
ImageProvider.resolve returns non-null object
## 3.2.0
...
...
pdf/lib/src/widgets/decoration.dart
View file @
0a503bf
...
...
@@ -53,7 +53,7 @@ class DecorationImage extends DecorationGraphic {
@override
void
paint
(
Context
context
,
PdfRect
box
)
{
final
_image
=
image
.
resolve
(
context
,
box
.
size
,
dpi:
dpi
)
!
;
final
_image
=
image
.
resolve
(
context
,
box
.
size
,
dpi:
dpi
);
final
imageSize
=
PdfPoint
(
_image
.
width
.
toDouble
(),
_image
.
height
.
toDouble
());
...
...
pdf/lib/src/widgets/image.dart
View file @
0a503bf
...
...
@@ -121,7 +121,7 @@ class Image extends Widget {
_paintImage
(
canvas:
context
.
canvas
,
image:
image
.
resolve
(
context
,
rect
.
size
,
dpi:
dpi
)
!
,
image:
image
.
resolve
(
context
,
rect
.
size
,
dpi:
dpi
),
rect:
box
!,
alignment:
alignment
,
fit:
fit
,
...
...
pdf/lib/src/widgets/image_provider.dart
View file @
0a503bf
...
...
@@ -51,7 +51,7 @@ abstract class ImageProvider {
/// Resolves this image provider using the given context, returning a PdfImage
/// The image is automatically added to the document
PdfImage
?
resolve
(
Context
context
,
PdfPoint
size
,
{
double
?
dpi
})
{
PdfImage
resolve
(
Context
context
,
PdfPoint
size
,
{
double
?
dpi
})
{
final
effectiveDpi
=
dpi
??
this
.
dpi
;
if
(
effectiveDpi
==
null
||
_cache
[
0
]
!=
null
)
{
...
...
@@ -59,7 +59,7 @@ abstract class ImageProvider {
assert
(
_cache
[
0
]!.
pdfDocument
==
context
.
document
,
'Do not reuse an ImageProvider object across multiple documents'
);
return
_cache
[
0
];
return
_cache
[
0
]
!
;
}
final
width
=
(
size
.
x
/
PdfPageFormat
.
inch
*
effectiveDpi
).
toInt
();
...
...
@@ -71,7 +71,7 @@ abstract class ImageProvider {
assert
(
_cache
[
width
]!.
pdfDocument
==
context
.
document
,
'Do not reuse an ImageProvider object across multiple documents'
);
return
_cache
[
width
];
return
_cache
[
width
]
!
;
}
}
...
...
Please
register
or
login
to post a comment