Showing
5 changed files
with
37 additions
and
14 deletions
@@ -699,7 +699,8 @@ class RichText extends Widget with SpanningWidget { | @@ -699,7 +699,8 @@ class RichText extends Widget with SpanningWidget { | ||
699 | (style.fontSize! * textScaleFactor)) * | 699 | (style.fontSize! * textScaleFactor)) * |
700 | (style.fontSize! * textScaleFactor); | 700 | (style.fontSize! * textScaleFactor); |
701 | 701 | ||
702 | - if (offsetX + metrics.width > constraintWidth + 0.00001) { | 702 | + if (_softWrap && |
703 | + offsetX + metrics.width > constraintWidth + 0.00001) { | ||
703 | if (spanCount > 0 && metrics.width <= constraintWidth) { | 704 | if (spanCount > 0 && metrics.width <= constraintWidth) { |
704 | overflow = true; | 705 | overflow = true; |
705 | lines.add(_Line( | 706 | lines.add(_Line( |
@@ -775,7 +776,7 @@ class RichText extends Widget with SpanningWidget { | @@ -775,7 +776,7 @@ class RichText extends Widget with SpanningWidget { | ||
775 | style.letterSpacing!; | 776 | style.letterSpacing!; |
776 | } | 777 | } |
777 | 778 | ||
778 | - if (_softWrap && line < spanLines.length - 1) { | 779 | + if (line < spanLines.length - 1) { |
779 | lines.add(_Line( | 780 | lines.add(_Line( |
780 | this, | 781 | this, |
781 | spanStart, | 782 | spanStart, |
@@ -4,7 +4,7 @@ description: A pdf producer for Dart. It can create pdf files for both web or fl | @@ -4,7 +4,7 @@ description: A pdf producer for Dart. It can create pdf files for both web or fl | ||
4 | homepage: https://github.com/DavBfr/dart_pdf/tree/master/pdf | 4 | homepage: https://github.com/DavBfr/dart_pdf/tree/master/pdf |
5 | repository: https://github.com/DavBfr/dart_pdf | 5 | repository: https://github.com/DavBfr/dart_pdf |
6 | issue_tracker: https://github.com/DavBfr/dart_pdf/issues | 6 | issue_tracker: https://github.com/DavBfr/dart_pdf/issues |
7 | -version: 3.3.0 | 7 | +version: 3.3.1 |
8 | 8 | ||
9 | environment: | 9 | environment: |
10 | sdk: ">=2.12.0-0 <3.0.0" | 10 | sdk: ">=2.12.0-0 <3.0.0" |
@@ -63,17 +63,36 @@ void main() { | @@ -63,17 +63,36 @@ void main() { | ||
63 | }); | 63 | }); |
64 | 64 | ||
65 | test('Text Widgets softWrap', () { | 65 | test('Text Widgets softWrap', () { |
66 | - pdf.addPage(MultiPage( | 66 | + final para = LoremText().paragraph(40); |
67 | + | ||
68 | + pdf.addPage( | ||
69 | + MultiPage( | ||
67 | build: (Context context) => <Widget>[ | 70 | build: (Context context) => <Widget>[ |
68 | - Text( | ||
69 | - 'Text with\nsoft wrap\nenabled', | ||
70 | - softWrap: true, | ||
71 | - ), | ||
72 | - Text( | ||
73 | - 'Text with\nsoft wrap\ndisabled', | ||
74 | - softWrap: false, | ||
75 | - ), | ||
76 | - ])); | 71 | + Text( |
72 | + 'Text with\nsoft wrap\nenabled', | ||
73 | + softWrap: true, | ||
74 | + ), | ||
75 | + Text( | ||
76 | + 'Text with\nsoft wrap\ndisabled', | ||
77 | + softWrap: false, | ||
78 | + ), | ||
79 | + SizedBox( | ||
80 | + width: 120, | ||
81 | + child: Text( | ||
82 | + para, | ||
83 | + softWrap: false, | ||
84 | + ), | ||
85 | + ), | ||
86 | + SizedBox( | ||
87 | + width: 120, | ||
88 | + child: Text( | ||
89 | + para, | ||
90 | + softWrap: true, | ||
91 | + ), | ||
92 | + ), | ||
93 | + ], | ||
94 | + ), | ||
95 | + ); | ||
77 | }); | 96 | }); |
78 | 97 | ||
79 | test('Text Widgets Alignement', () { | 98 | test('Text Widgets Alignement', () { |
@@ -85,7 +104,6 @@ void main() { | @@ -85,7 +104,6 @@ void main() { | ||
85 | Text( | 104 | Text( |
86 | '$align:\n' + para, | 105 | '$align:\n' + para, |
87 | textAlign: align, | 106 | textAlign: align, |
88 | - softWrap: true, | ||
89 | ), | 107 | ), |
90 | ); | 108 | ); |
91 | } | 109 | } |
No preview for this file type
-
Please register or login to post a comment