David PHAM-VAN

Fix RichText Widget word spacing

@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 * Add Theme::copyFrom() method 3 * Add Theme::copyFrom() method
4 * Allow Annotations in TextSpan 4 * Allow Annotations in TextSpan
5 * Add SizedBox Widget 5 * Add SizedBox Widget
  6 +* Fix RichText Widget word spacing
6 7
7 # 1.3.7 8 # 1.3.7
8 * Add Pdf Creation date 9 * Add Pdf Creation date
@@ -183,7 +183,7 @@ class RichText extends Widget { @@ -183,7 +183,7 @@ class RichText extends Widget {
183 183
184 for (String word in span.text.split(' ')) { 184 for (String word in span.text.split(' ')) {
185 if (word.isEmpty) { 185 if (word.isEmpty) {
186 - offsetX += space.width; 186 + offsetX += space.advanceWidth * style.wordSpacing;
187 continue; 187 continue;
188 } 188 }
189 189
@@ -193,8 +193,12 @@ class RichText extends Widget { @@ -193,8 +193,12 @@ class RichText extends Widget {
193 if (offsetX + metrics.width > constraintWidth && wCount > 0) { 193 if (offsetX + metrics.width > constraintWidth && wCount > 0) {
194 width = math.max( 194 width = math.max(
195 width, 195 width,
196 - _realignLine(_words.sublist(lineStart), constraintWidth,  
197 - offsetX - space.width, false, bottom)); 196 + _realignLine(
  197 + _words.sublist(lineStart),
  198 + constraintWidth,
  199 + offsetX - space.advanceWidth * style.wordSpacing,
  200 + false,
  201 + bottom));
198 lineStart += wCount; 202 lineStart += wCount;
199 if (maxLines != null && ++lines > maxLines) { 203 if (maxLines != null && ++lines > maxLines) {
200 break; 204 break;
@@ -219,10 +223,11 @@ class RichText extends Widget { @@ -219,10 +223,11 @@ class RichText extends Widget {
219 223
220 _words.add(wd); 224 _words.add(wd);
221 wCount++; 225 wCount++;
222 - offsetX += metrics.width + space.advanceWidth; 226 + offsetX +=
  227 + metrics.advanceWidth + space.advanceWidth * style.wordSpacing;
223 } 228 }
224 229
225 - offsetX -= space.width; 230 + offsetX -= space.advanceWidth * style.wordSpacing;
226 return true; 231 return true;
227 }); 232 });
228 233