Skip to content

content: Use 17 for base font size (and height 22), like in Figma #541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/widgets/content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down Expand Up @@ -112,7 +112,7 @@ class Paragraph extends StatelessWidget {

static const textStyle = TextStyle(
fontSize: kBaseFontSize,
height: (17 / kBaseFontSize),
height: (22 / kBaseFontSize),
);

@override
Expand Down
6 changes: 5 additions & 1 deletion test/widgets/content_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> prepareContent(WidgetTester tester, String html) async {
await testBinding.globalStore.add(eg.selfAccount, eg.initialSnapshot());
Expand All @@ -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,
'<p><a href="https://a/">foo</a> bar <a href="https://b/">baz</a></p>');
final base = tester.getTopLeft(find.text('foo bar baz'))
Expand All @@ -349,6 +351,8 @@ void main() {
});

testWidgets('link containing other spans', (tester) async {
final fontSize = Paragraph.textStyle.fontSize!;

await prepareContent(tester,
'<p><a href="https://a/">two <strong><em><code>words</code></em></strong></a></p>');
final base = tester.getTopLeft(find.text('two words'))
Expand Down