Skip to content

Commit

Permalink
content: Use 17 for base font size (and height 22), like in Figma
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbobbe authored and gnprice committed Mar 1, 2024
1 parent bac688a commit 3bcfe2c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
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

0 comments on commit 3bcfe2c

Please sign in to comment.