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-03-08 16:57:09 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e59b0d0556d4857d3c9aa2a4127bda6847a7712d
e59b0d05
1 parent
0aad19fe
Fix RichText annotations
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
14 deletions
pdf/lib/src/widgets/text.dart
printing/CHANGELOG.md
printing/pubspec.yaml
pdf/lib/src/widgets/text.dart
View file @
e59b0d0
...
...
@@ -360,7 +360,10 @@ class _WidgetSpan extends _Span {
}
typedef
_VisitorCallback
=
bool
Function
(
InlineSpan
span
,
TextStyle
?
parentStyle
);
InlineSpan
span
,
TextStyle
?
parentStyle
,
AnnotationBuilder
?
annotation
,
);
@immutable
abstract
class
InlineSpan
{
...
...
@@ -374,16 +377,24 @@ abstract class InlineSpan {
String
toPlainText
()
{
final
buffer
=
StringBuffer
();
visitChildren
((
InlineSpan
span
,
TextStyle
?
style
)
{
visitChildren
((
InlineSpan
span
,
TextStyle
?
style
,
AnnotationBuilder
?
annotation
,
)
{
if
(
span
is
TextSpan
)
{
buffer
.
write
(
span
.
text
);
}
return
true
;
},
null
);
},
null
,
null
);
return
buffer
.
toString
();
}
bool
visitChildren
(
_VisitorCallback
visitor
,
TextStyle
?
parentStyle
);
bool
visitChildren
(
_VisitorCallback
visitor
,
TextStyle
?
parentStyle
,
AnnotationBuilder
?
annotation
,
);
}
class
WidgetSpan
extends
InlineSpan
{
...
...
@@ -400,10 +411,15 @@ class WidgetSpan extends InlineSpan {
/// Calls `visitor` on this [WidgetSpan]. There are no children spans to walk.
@override
bool
visitChildren
(
_VisitorCallback
visitor
,
TextStyle
?
parentStyle
)
{
bool
visitChildren
(
_VisitorCallback
visitor
,
TextStyle
?
parentStyle
,
AnnotationBuilder
?
annotation
,
)
{
final
_style
=
parentStyle
?.
merge
(
style
);
final
_a
=
this
.
annotation
??
annotation
;
return
visitor
(
this
,
_style
);
return
visitor
(
this
,
_style
,
_a
);
}
}
...
...
@@ -421,17 +437,22 @@ class TextSpan extends InlineSpan {
final
List
<
InlineSpan
>?
children
;
@override
bool
visitChildren
(
_VisitorCallback
visitor
,
TextStyle
?
parentStyle
)
{
bool
visitChildren
(
_VisitorCallback
visitor
,
TextStyle
?
parentStyle
,
AnnotationBuilder
?
annotation
,
)
{
final
_style
=
parentStyle
?.
merge
(
style
);
final
_a
=
this
.
annotation
??
annotation
;
if
(
text
!=
null
)
{
if
(!
visitor
(
this
,
_style
))
{
if
(!
visitor
(
this
,
_style
,
_a
))
{
return
false
;
}
}
if
(
children
!=
null
)
{
for
(
var
child
in
children
!)
{
if
(!
child
.
visitChildren
(
visitor
,
_style
))
{
if
(!
child
.
visitChildren
(
visitor
,
_style
,
_a
))
{
return
false
;
}
}
...
...
@@ -571,7 +592,11 @@ class RichText extends Widget {
var
spanStart
=
0
;
var
decorationStart
=
0
;
text
.
visitChildren
((
InlineSpan
span
,
TextStyle
?
style
)
{
text
.
visitChildren
((
InlineSpan
span
,
TextStyle
?
style
,
AnnotationBuilder
?
annotation
,
)
{
if
(
span
is
TextSpan
)
{
if
(
span
.
text
==
null
)
{
return
true
;
...
...
@@ -653,7 +678,7 @@ class RichText extends Widget {
spanCount
>
1
,
_TextDecoration
(
style
,
span
.
annotation
,
annotation
,
_spans
.
length
-
1
,
_spans
.
length
-
1
,
),
...
...
@@ -764,7 +789,7 @@ class RichText extends Widget {
spanCount
>
1
,
_TextDecoration
(
style
,
span
.
annotation
,
annotation
,
_spans
.
length
-
1
,
_spans
.
length
-
1
,
),
...
...
@@ -774,7 +799,7 @@ class RichText extends Widget {
}
return
true
;
},
defaultstyle
);
},
defaultstyle
,
null
);
width
=
math
.
max
(
width
,
...
...
printing/CHANGELOG.md
View file @
e59b0d0
# Changelog
## 5.0.3
-
Fix RichText annotations
## 5.0.2
-
Fix iOS/macOS release build not working
...
...
printing/pubspec.yaml
View file @
e59b0d0
...
...
@@ -7,7 +7,7 @@ description: >
homepage
:
https://github.com/DavBfr/dart_pdf/tree/master/printing
repository
:
https://github.com/DavBfr/dart_pdf
issue_tracker
:
https://github.com/DavBfr/dart_pdf/issues
version
:
5.0.
2
version
:
5.0.
3
environment
:
sdk
:
"
>=2.12.0-0
<3.0.0"
...
...
Please
register
or
login
to post a comment