@@ -9,7 +9,6 @@ class UnicodeEmojiWidget extends StatelessWidget {
99 super .key,
1010 required this .emojiDisplay,
1111 required this .size,
12- required this .notoColorEmojiTextSize,
1312 this .textScaler = TextScaler .noScaling,
1413 });
1514
@@ -20,12 +19,6 @@ class UnicodeEmojiWidget extends StatelessWidget {
2019 /// This will be scaled by [textScaler] .
2120 final double size;
2221
23- /// A font size that, with Noto Color Emoji and our line-height config,
24- /// causes a Unicode emoji to occupy a square of size [size] in the layout.
25- ///
26- /// This has to be determined experimentally, as far as we know.
27- final double notoColorEmojiTextSize;
28-
2922 /// The text scaler to apply to [size] .
3023 ///
3124 /// Defaults to [TextScaler.noScaling] .
@@ -38,14 +31,26 @@ class UnicodeEmojiWidget extends StatelessWidget {
3831 case TargetPlatform .fuchsia:
3932 case TargetPlatform .linux:
4033 case TargetPlatform .windows:
34+ // A font size that, with Noto Color Emoji and our line-height
35+ // config (the use of `forceStrutHeight: true`), causes a Unicode emoji
36+ // to occupy a square of size [size] in the layout.
37+ //
38+ // Determined experimentally:
39+ // <https://github.com/zulip/zulip-flutter/pull/410#discussion_r1402808701>
40+ // <https://github.com/zulip/zulip-flutter/pull/1629#discussion_r2188037245>
41+ final double notoColorEmojiTextSize = size * (14.5 / 17 );
42+
4143 return Text (
4244 textScaler: textScaler,
4345 style: TextStyle (
4446 fontFamily: 'Noto Color Emoji' ,
4547 fontSize: notoColorEmojiTextSize,
4648 ),
4749 strutStyle: StrutStyle (
48- fontSize: notoColorEmojiTextSize, forceStrutHeight: true ),
50+ fontSize: notoColorEmojiTextSize,
51+ // Responsible for keeping the line height constant, even
52+ // with ambient DefaultTextStyle.
53+ forceStrutHeight: true ),
4954 emojiDisplay.emojiUnicode);
5055
5156 case TargetPlatform .iOS:
@@ -74,7 +79,11 @@ class UnicodeEmojiWidget extends StatelessWidget {
7479 style: TextStyle (
7580 fontFamily: 'Apple Color Emoji' ,
7681 fontSize: size),
77- strutStyle: StrutStyle (fontSize: size, forceStrutHeight: true ),
82+ strutStyle: StrutStyle (
83+ fontSize: size,
84+ // Responsible for keeping the line height constant, even
85+ // with ambient DefaultTextStyle.
86+ forceStrutHeight: true ),
7887 emojiDisplay.emojiUnicode)),
7988 ]);
8089 }
0 commit comments