Skip to content

Commit 4641a1f

Browse files
gnpricechrisbobbe
authored andcommitted
text [nfc]: Define typedef TextStyleConverter
This makes the _convertTextTheme signature clearer to express, and also lets us specify the return type of mkAddLabel in a reasonable readable syntax.
1 parent dc0b32b commit 4641a1f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/widgets/text.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Typography zulipTypography(BuildContext context) {
7373
// Set [TextStyle.debugLabel] for all styles, like:
7474
// "zulipTypography black titleMedium"
7575

76-
mkAddLabel(String debugTextThemeLabel)
76+
TextStyleConverter mkAddLabel(String debugTextThemeLabel)
7777
=> (TextStyle? maybeInputStyle, String debugStyleLabel)
7878
=> maybeInputStyle?.copyWith(debugLabel: '$debugTextThemeLabel $debugStyleLabel');
7979

@@ -119,9 +119,11 @@ TextTheme _weightVariableTextTheme(BuildContext context, TextTheme input) {
119119
return _convertTextTheme(input, convert);
120120
}
121121

122+
typedef TextStyleConverter = TextStyle? Function(TextStyle?, String debugStyleLabel);
123+
122124
TextTheme _convertTextTheme(
123125
TextTheme input,
124-
TextStyle? Function(TextStyle?, String debugStyleLabel) converter,
126+
TextStyleConverter converter,
125127
) => TextTheme(
126128
displayLarge: converter(input.displayLarge, 'displayLarge'),
127129
displayMedium: converter(input.displayMedium, 'displayMedium'),

0 commit comments

Comments
 (0)