mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: #811 The height of selection areas in same line is not same.
This commit is contained in:
parent
9b00a25004
commit
fe2790fb68
@ -174,6 +174,8 @@ class _FlowyRichTextState extends State<FlowyRichText> with Selectable {
|
|||||||
final textSpan = _textSpan;
|
final textSpan = _textSpan;
|
||||||
return RichText(
|
return RichText(
|
||||||
key: _textKey,
|
key: _textKey,
|
||||||
|
textHeightBehavior: const TextHeightBehavior(
|
||||||
|
applyHeightToFirstAscent: false, applyHeightToLastDescent: false),
|
||||||
text: widget.textSpanDecorator != null
|
text: widget.textSpanDecorator != null
|
||||||
? widget.textSpanDecorator!(textSpan)
|
? widget.textSpanDecorator!(textSpan)
|
||||||
: textSpan,
|
: textSpan,
|
||||||
|
@ -192,17 +192,7 @@ class RichTextStyle {
|
|||||||
TextSpan toTextSpan() => _toTextSpan(height);
|
TextSpan toTextSpan() => _toTextSpan(height);
|
||||||
|
|
||||||
double get topPadding {
|
double get topPadding {
|
||||||
if (height == 1.0) {
|
return 0;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
// TODO: Need to be optimized.
|
|
||||||
final painter =
|
|
||||||
TextPainter(text: _toTextSpan(height), textDirection: TextDirection.ltr)
|
|
||||||
..layout();
|
|
||||||
final basePainter =
|
|
||||||
TextPainter(text: _toTextSpan(null), textDirection: TextDirection.ltr)
|
|
||||||
..layout();
|
|
||||||
return painter.height - basePainter.height;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TextSpan _toTextSpan(double? height) {
|
TextSpan _toTextSpan(double? height) {
|
||||||
|
Loading…
Reference in New Issue
Block a user