From 3bcfe2c68bc7a7ec691fd613abcf268ae9204bed Mon Sep 17 00:00:00 2001 From: Chris Bobbe Date: Thu, 29 Feb 2024 15:55:38 -0800 Subject: [PATCH] content: Use 17 for base font size (and height 22), like in Figma Discussion: https://chat.zulip.org/#narrow/stream/48-mobile/topic/density.20in.20message.20list/near/1735140 Fixes: #512 --- lib/widgets/content.dart | 4 ++-- test/widgets/content_test.dart | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/widgets/content.dart b/lib/widgets/content.dart index 1c5d23de87..c5e2682ad2 100644 --- a/lib/widgets/content.dart +++ b/lib/widgets/content.dart @@ -19,7 +19,7 @@ import 'store.dart'; import 'text.dart'; /// The font size for message content in a plain unstyled paragraph. -const double kBaseFontSize = 14; +const double kBaseFontSize = 17; /// The entire content of a message, aka its body. /// @@ -112,7 +112,7 @@ class Paragraph extends StatelessWidget { static const textStyle = TextStyle( fontSize: kBaseFontSize, - height: (17 / kBaseFontSize), + height: (22 / kBaseFontSize), ); @override diff --git a/test/widgets/content_test.dart b/test/widgets/content_test.dart index 0df06c8929..c485f585a7 100644 --- a/test/widgets/content_test.dart +++ b/test/widgets/content_test.dart @@ -297,7 +297,7 @@ void main() { group('LinkNode interactions', () { // The Flutter test font uses square glyphs, so width equals height: // https://github.com/flutter/flutter/wiki/Flutter-Test-Fonts - const fontSize = 14.0; + // We use this to simulate taps on specific glyphs. Future prepareContent(WidgetTester tester, String html) async { await testBinding.globalStore.add(eg.selfAccount, eg.initialSnapshot()); @@ -323,6 +323,8 @@ void main() { }, variant: const TargetPlatformVariant({TargetPlatform.android, TargetPlatform.iOS})); testWidgets('multiple links in paragraph', (tester) async { + final fontSize = Paragraph.textStyle.fontSize!; + await prepareContent(tester, '

foo bar baz

'); final base = tester.getTopLeft(find.text('foo bar baz')) @@ -349,6 +351,8 @@ void main() { }); testWidgets('link containing other spans', (tester) async { + final fontSize = Paragraph.textStyle.fontSize!; + await prepareContent(tester, '

two words

'); final base = tester.getTopLeft(find.text('two words'))