Skip to content

Commit

Permalink
fix: Theme generated from colorScheme and textTheme
Browse files Browse the repository at this point in the history
  • Loading branch information
kkweon committed Jun 20, 2021
1 parent 7e162a3 commit 2a6a271
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
30 changes: 8 additions & 22 deletions client/lib/custom_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,17 @@ const _kHeadline1 = TextStyle(fontFamily: 'PermanentMarker', fontSize: 25);
/// ```
class CustomTheme extends ChangeNotifier {
static ThemeData get lightTheme {
final themeData = ThemeData();
final colorScheme = themeData.colorScheme
.copyWith(onPrimary: Colors.white, onBackground: Colors.black87);
return _themeData(themeData, colorScheme);
final colorScheme = ColorScheme.fromSwatch(backgroundColor: Colors.white);
final textTheme =
Typography.blackMountainView.copyWith(headline1: _kHeadline1);
return ThemeData.from(colorScheme: colorScheme, textTheme: textTheme);
}

static ThemeData get darkTheme {
final themeData = ThemeData.dark();
final colorScheme = themeData.colorScheme
.copyWith(onPrimary: Colors.white, onBackground: Colors.white);
return _themeData(themeData, colorScheme);
}

static ThemeData _themeData(ThemeData baseTheme, ColorScheme colorScheme) {
final textTheme = baseTheme.textTheme
.copyWith(
headline1: _kHeadline1,
// main_screen에서 키워드에 사용됨
subtitle2: TextStyle(
fontSize: 14,
color: colorScheme.onSurface.withAlpha(150),
fontStyle: FontStyle.italic))
.apply(displayColor: colorScheme.onBackground);

return baseTheme.copyWith(colorScheme: colorScheme, textTheme: textTheme);
const colorScheme = ColorScheme.dark();
final textTheme =
Typography.whiteMountainView.copyWith(headline1: _kHeadline1);
return ThemeData.from(colorScheme: colorScheme, textTheme: textTheme);
}

bool _isDarkMode = false;
Expand Down
5 changes: 4 additions & 1 deletion client/lib/widgets/main/pr12video.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ class PR12Video extends StatelessWidget {
const SizedBox(height: 10),
Text(
getKeywords(video.keywords),
style: Theme.of(context).textTheme.subtitle2,
style: Theme.of(context)
.textTheme
.caption
?.apply(fontStyle: FontStyle.italic),
overflow: TextOverflow.ellipsis,
),
],
Expand Down

0 comments on commit 2a6a271

Please sign in to comment.