TextTheme.withColorScheme constructor
TextTheme.withColorScheme(
- ColorScheme colorScheme
Implementation
factory TextTheme.withColorScheme(ColorScheme colorScheme) {
TextTheme result;
switch (colorScheme.brightness) {
case Brightness.dark:
final textLow = colorScheme.shade[50];
final textMedium = colorScheme.shade[70];
final textHigh = colorScheme.shade[90];
result = TextTheme._raw(
header: _TextThemes.header.apply(color: textHigh),
subheader: _TextThemes.subheader.apply(color: textHigh),
subtitle: _TextThemes.subtitle.apply(color: textHigh),
title: _TextThemes.title.apply(color: textHigh),
monospace: _TextThemes.monospace.apply(color: textHigh),
body1: _TextThemes.body1.apply(color: textHigh),
body2: _TextThemes.body2.apply(color: textHigh),
caption: _TextThemes.caption.apply(color: textHigh),
textError: colorScheme.error,
textPrimaryHigh: colorScheme.primary[60],
textPrimaryLow: colorScheme.primary[40],
textLow: textLow,
textMedium: textMedium,
textHigh: textHigh,
textDisabled: colorScheme.disabled,
colorScheme: colorScheme,
);
break;
case Brightness.light:
final textLow = colorScheme.shade[40];
final textMedium = colorScheme.shade[70];
final textHigh = colorScheme.shade[100];
result = TextTheme._raw(
header: _TextThemes.header.apply(color: textHigh),
subheader: _TextThemes.subheader.apply(color: textHigh),
subtitle: _TextThemes.subtitle.apply(color: textHigh),
title: _TextThemes.title.apply(color: textHigh),
monospace: _TextThemes.monospace.apply(color: textHigh),
body1: _TextThemes.body1.apply(color: textHigh),
body2: _TextThemes.body2.apply(color: textHigh),
caption: _TextThemes.caption.apply(color: textHigh),
textError: colorScheme.error,
textPrimaryHigh: colorScheme.primary[60],
textPrimaryLow: colorScheme.primary[40],
textLow: textLow,
textMedium: textMedium,
textHigh: textHigh,
textDisabled: colorScheme.disabled,
colorScheme: colorScheme,
);
break;
}
return result;
}