WIP #102 Colors from theme

This commit is contained in:
Yegor Vialov 2020-04-06 20:03:41 +00:00
parent 405de64249
commit 524d195800
2 changed files with 8 additions and 8 deletions

View File

@ -40,7 +40,6 @@ class HAClientTheme {
EntityState.open, EntityState.open,
EntityState.cleaning, EntityState.cleaning,
EntityState.returning, EntityState.returning,
"heat",
"cool", "cool",
EntityState.alarm_arming, EntityState.alarm_arming,
EntityState.alarm_disarming, EntityState.alarm_disarming,
@ -58,6 +57,7 @@ class HAClientTheme {
EntityState.alarm_armed_home, EntityState.alarm_armed_home,
EntityState.alarm_armed_night, EntityState.alarm_armed_night,
EntityState.alarm_triggered, EntityState.alarm_triggered,
"heat",
]; ];
static const defaultStateColor = Color.fromRGBO(68, 115, 158, 1.0); static const defaultStateColor = Color.fromRGBO(68, 115, 158, 1.0);
@ -82,7 +82,7 @@ class HAClientTheme {
primaryVariant: Color.fromRGBO(68, 115, 158, 1), primaryVariant: Color.fromRGBO(68, 115, 158, 1),
secondary: Color.fromRGBO(253, 216, 53, 1), secondary: Color.fromRGBO(253, 216, 53, 1),
secondaryVariant: Color.fromRGBO(222, 181, 2, 1), secondaryVariant: Color.fromRGBO(222, 181, 2, 1),
background: Colors.white, background: Color.fromRGBO(250, 250, 250, 1),
surface: Colors.white, surface: Colors.white,
error: Colors.red, error: Colors.red,
onPrimary: Colors.white, onPrimary: Colors.white,

View File

@ -504,13 +504,13 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
bool _showBottomBar = false; bool _showBottomBar = false;
String _bottomBarText; String _bottomBarText;
bool _bottomBarProgress; bool _bottomBarProgress;
Color _bottomBarColor; bool _bottomBarErrorColor;
Timer _bottomBarTimer; Timer _bottomBarTimer;
void _showInfoBottomBar({String message, bool progress: false, Duration duration}) { void _showInfoBottomBar({String message, bool progress: false, Duration duration}) {
_bottomBarTimer?.cancel(); _bottomBarTimer?.cancel();
_bottomBarAction = Container(height: 0.0, width: 0.0,); _bottomBarAction = Container(height: 0.0, width: 0.0,);
_bottomBarColor = Colors.grey.shade50; _bottomBarErrorColor = false;
setState(() { setState(() {
_bottomBarText = message; _bottomBarText = message;
_bottomBarProgress = progress; _bottomBarProgress = progress;
@ -524,10 +524,10 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
} }
void _showErrorBottomBar(HAError error) { void _showErrorBottomBar(HAError error) {
TextStyle textStyle = Theme.of(context).textTheme.subhead.copyWith( TextStyle textStyle = Theme.of(context).textTheme.button.copyWith(
color: Colors.blue decoration: TextDecoration.underline
); );
_bottomBarColor = Colors.red.shade100; _bottomBarErrorColor = true;
List<Widget> actions = []; List<Widget> actions = [];
error.actions.forEach((HAErrorAction action) { error.actions.forEach((HAErrorAction action) {
switch (action.type) { switch (action.type) {
@ -831,7 +831,7 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
} }
if (bottomBarChildren.isNotEmpty) { if (bottomBarChildren.isNotEmpty) {
bottomBar = Container( bottomBar = Container(
color: _bottomBarColor, color: _bottomBarErrorColor ? Theme.of(context).errorColor : Theme.of(context).primaryColorLight,
child: Row( child: Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: <Widget>[ children: <Widget>[