My previous patch caused an issue (which I could only reproduce
on Android): switching to Text inside WidgetSpan changed the way
the text appeared.
Two fixes are needed:
- Properly align the WidgetSpan Text with the InlineSpan
- Tell the WidgetSpan to render without scaling, otherwise the
text is scaled twice (once at Text time, and again in the
Text.rich when rendering the Widget). (I don't know why.)
Now the text is properly rendered and spaced.
---
I don't know why my IDE imported Cupertino. Thanks.
lib/page/buffer.dart | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/page/buffer.dart b/lib/page/buffer.dart
index 323b960..8c63870 100644
--- a/lib/page/buffer.dart+++ b/lib/page/buffer.dart
@@ -647,11 +647,13 @@ class _CompactMessageItem extends StatelessWidget {
child: Text(sender, style: senderStyle),
));
content.add(WidgetSpan(
+ alignment: PlaceholderAlignment.top, child: SelectionContainer.disabled(
child: Text(
sender,
style: senderStyle.apply(color: Color(0x00000000)),
semanticsLabel: '', // Make screen reader quiet
+ textScaler: TextScaler.noScaling, ),
),
));
@@ -671,11 +673,13 @@ class _CompactMessageItem extends StatelessWidget {
child: Text(timeText, style: timeStyle),
));
content.add(WidgetSpan(
+ alignment: PlaceholderAlignment.top, child: SelectionContainer.disabled(
child: Text(
timeText,
style: timeStyle.apply(color: Color(0x00000000)),
semanticsLabel: '', // Make screen reader quiet
+ textScaler: TextScaler.noScaling, ),
),
));
base-commit: 6dc63b850b80e21b7d9bd184cd3765e4b2b24954
--
2.44.0