In `QuillEditor` we display paragraphs using `RichText`. The height of a `RichText` is calculated using a `TextPainter`, basically like this: ```dart const textSpan = TextSpan( children: [ TextSpan(text: 'Foo '), TextSpan(text: 'Bar', style: TextStyle(fontSize: 20, height: 1)), ], style: TextStyle(color: Colors.black, fontSize: 16), ); final textPainter = TextPainter(text: textSpan, textDirection: TextDirection.ltr)..layout(); print('Height of textspan: ${textPainter.height}'); // Height of textspan: 20 ``` Our code looks basically like this for an empty line: ```dart const textSpan = TextSpan( children: [TextSpan(text: '', style: TextStyle(color: Colors.black, fontSize: 20))], style: null, ); final textPainter = TextPainter(text: textSpan, textDirection: TextDirection.ltr)..layout(); print('Height of textspan: ${textPainter.height}'); // Height of textspan: 16 ``` Now the line wrongly has the height 16 instead of 20, which cuts off the bottom (see issue #133) from the text. To fix this, I moved the inner `TextSpan` one layer higher. Now the problem occurred that a line with several heights has the size of the strut, because we enforce this size. I couldn't figure out why the strut size is enforced, so I removed the behavior and a line with multiple sizes is now displayed correctly. Closes #133.pull/141/head
parent
ac2ca07bb0
commit
5ac3a0b425
1 changed files with 3 additions and 4 deletions
Loading…
Reference in new issue