From d94235ef6d0e7d191641cd0a62c3465015bec145 Mon Sep 17 00:00:00 2001 From: Yegor Vialov Date: Sat, 4 Apr 2020 16:13:12 +0000 Subject: [PATCH] WIP Themes: Dark theme fonts --- .../alarm_control_panel_controls.widget.dart | 2 +- lib/managers/theme_manager.dart | 61 +++++++++++++------ 2 files changed, 44 insertions(+), 19 deletions(-) diff --git a/lib/entities/alarm_control_panel/widgets/alarm_control_panel_controls.widget.dart b/lib/entities/alarm_control_panel/widgets/alarm_control_panel_controls.widget.dart index 51eb666..996c384 100644 --- a/lib/entities/alarm_control_panel/widgets/alarm_control_panel_controls.widget.dart +++ b/lib/entities/alarm_control_panel/widgets/alarm_control_panel_controls.widget.dart @@ -249,7 +249,7 @@ class _AlarmControlPanelControlsWidgetWidgetState extends State _askToTrigger(entity), diff --git a/lib/managers/theme_manager.dart b/lib/managers/theme_manager.dart index 0263595..00d7d48 100644 --- a/lib/managers/theme_manager.dart +++ b/lib/managers/theme_manager.dart @@ -2,7 +2,23 @@ import 'package:flutter/material.dart'; class HAClientTheme { - static const Color defaultFontColor = Colors.black87; + static const TextTheme textTheme = TextTheme( + display1: TextStyle(fontSize: 34, fontWeight: FontWeight.normal), + display2: TextStyle(fontSize: 34, fontWeight: FontWeight.normal), + headline: TextStyle(fontSize: 24, fontWeight: FontWeight.normal), + title: TextStyle(fontSize: 20, fontWeight: FontWeight.w700), + subhead: TextStyle(fontSize: 16, fontWeight: FontWeight.normal), + body1: TextStyle(fontSize: 15, fontWeight: FontWeight.normal), + body2: TextStyle(fontSize: 15, fontWeight: FontWeight.w500), + subtitle: TextStyle(fontSize: 15, fontWeight: FontWeight.w500), + caption: TextStyle(fontSize: 12, fontWeight: FontWeight.normal), + overline: TextStyle( + fontSize: 10, + fontWeight: FontWeight.normal, + letterSpacing: 1, + ), + button: TextStyle(fontSize: 14, fontWeight: FontWeight.w500), + ); static final HAClientTheme _instance = HAClientTheme ._internal(); @@ -16,25 +32,34 @@ class HAClientTheme { final ThemeData lightTheme = ThemeData.light().copyWith( //primaryColor: Colors.blue, textTheme: ThemeData.light().textTheme.copyWith( - display1: TextStyle(fontSize: 34, fontWeight: FontWeight.normal, color: Colors.black54), - display2: TextStyle(fontSize: 34, fontWeight: FontWeight.normal, color: Colors.redAccent), - headline: TextStyle(fontSize: 24, fontWeight: FontWeight.normal, color: defaultFontColor), - title: TextStyle(fontSize: 20, fontWeight: FontWeight.w700, color: defaultFontColor), - subhead: TextStyle(fontSize: 16, fontWeight: FontWeight.normal, color: Colors.black54), - body1: TextStyle(fontSize: 15, fontWeight: FontWeight.normal, color: defaultFontColor), - body2: TextStyle(fontSize: 15, fontWeight: FontWeight.w500, color: defaultFontColor), - subtitle: TextStyle(fontSize: 15, fontWeight: FontWeight.w500, color: Colors.black45), - caption: TextStyle(fontSize: 12, fontWeight: FontWeight.normal, color: Colors.black45), - overline: TextStyle( - fontSize: 10, - fontWeight: FontWeight.normal, - color: Colors.black26, - letterSpacing: 1, - ), - button: TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: Colors.white), + display1: textTheme.display1.copyWith(color: Colors.black54), + display2: textTheme.display2.copyWith(color: Colors.redAccent), + headline: textTheme.headline.copyWith(color: Colors.black87), + title: textTheme.title.copyWith(color: Colors.black87), + subhead: textTheme.subhead.copyWith(color: Colors.black54), + body1: textTheme.body1.copyWith(color: Colors.black87), + body2: textTheme.body2.copyWith(color: Colors.black87), + subtitle: textTheme.subtitle.copyWith(color: Colors.black45), + caption: textTheme.caption.copyWith(color: Colors.black45), + overline: textTheme.overline.copyWith(color: Colors.black26), + button: textTheme.button.copyWith(color: Colors.white), ) ); - final ThemeData darkTheme = ThemeData.dark(); + final ThemeData darkTheme = ThemeData.dark().copyWith( + textTheme: ThemeData.light().textTheme.copyWith( + display1: textTheme.display1.copyWith(color: Colors.white70), + display2: textTheme.display2.copyWith(color: Colors.redAccent), + headline: textTheme.headline.copyWith(color: Colors.white), + title: textTheme.title.copyWith(color: Colors.white), + subhead: textTheme.subhead.copyWith(color: Colors.white70), + body1: textTheme.body1.copyWith(color: Colors.white), + body2: textTheme.body2.copyWith(color: Colors.white), + subtitle: textTheme.subtitle.copyWith(color: Colors.white70), + caption: textTheme.caption.copyWith(color: Colors.white70), + overline: textTheme.overline.copyWith(color: Colors.white54), + button: textTheme.button.copyWith(color: Colors.white), + ) + ); } \ No newline at end of file