From a2836a3603c63c36115bc6cf1191a4a79702fc83 Mon Sep 17 00:00:00 2001 From: Yegor Vialov Date: Fri, 25 Jan 2019 23:08:12 +0200 Subject: [PATCH] Resolves #257 --- .../controls/climate_controls.dart | 50 +++++-------------- 1 file changed, 12 insertions(+), 38 deletions(-) diff --git a/lib/entity_widgets/controls/climate_controls.dart b/lib/entity_widgets/controls/climate_controls.dart index 9d4e65a..98b524c 100644 --- a/lib/entity_widgets/controls/climate_controls.dart +++ b/lib/entity_widgets/controls/climate_controls.dart @@ -296,10 +296,8 @@ class _ClimateControlWidgetState extends State { TemperatureControlWidget( value: _tmpTemperature, fontColor: _showPending ? Colors.red : Colors.black, - onLargeDec: () => _temperatureDown(entity, 0.5), - onLargeInc: () => _temperatureUp(entity, 0.5), - onSmallDec: () => _temperatureDown(entity, 0.1), - onSmallInc: () => _temperatureUp(entity, 0.1), + onDec: () => _temperatureDown(entity, 0.5), + onInc: () => _temperatureUp(entity, 0.5), ) ], ); @@ -315,10 +313,8 @@ class _ClimateControlWidgetState extends State { TemperatureControlWidget( value: _tmpTargetLow, fontColor: _showPending ? Colors.red : Colors.black, - onLargeDec: () => _targetLowDown(entity, 0.5), - onLargeInc: () => _targetLowUp(entity, 0.5), - onSmallDec: () => _targetLowDown(entity, 0.1), - onSmallInc: () => _targetLowUp(entity, 0.1), + onDec: () => _targetLowDown(entity, 0.5), + onInc: () => _targetLowUp(entity, 0.5), ), Expanded( child: Container(height: 10.0), @@ -330,10 +326,8 @@ class _ClimateControlWidgetState extends State { TemperatureControlWidget( value: _tmpTargetHigh, fontColor: _showPending ? Colors.red : Colors.black, - onLargeDec: () => _targetHighDown(entity, 0.5), - onLargeInc: () => _targetHighUp(entity, 0.5), - onSmallDec: () => _targetHighDown(entity, 0.1), - onSmallInc: () => _targetHighUp(entity, 0.1), + onDec: () => _targetHighDown(entity, 0.5), + onInc: () => _targetHighUp(entity, 0.5), ) ); } @@ -419,18 +413,14 @@ class TemperatureControlWidget extends StatelessWidget { final double value; final double fontSize; final Color fontColor; - final onSmallInc; - final onLargeInc; - final onSmallDec; - final onLargeDec; + final onInc; + final onDec; TemperatureControlWidget( {Key key, @required this.value, - @required this.onSmallInc, - @required this.onSmallDec, - @required this.onLargeInc, - @required this.onLargeDec, + @required this.onInc, + @required this.onDec, this.fontSize, this.fontColor}) : super(key: key); @@ -453,29 +443,13 @@ class TemperatureControlWidget extends StatelessWidget { icon: Icon(MaterialDesignIcons.createIconDataFromIconName( 'mdi:chevron-up')), iconSize: 30.0, - onPressed: () => onSmallInc(), + onPressed: () => onInc(), ), IconButton( icon: Icon(MaterialDesignIcons.createIconDataFromIconName( 'mdi:chevron-down')), iconSize: 30.0, - onPressed: () => onSmallDec(), - ) - ], - ), - Column( - children: [ - IconButton( - icon: Icon(MaterialDesignIcons.createIconDataFromIconName( - 'mdi:chevron-double-up')), - iconSize: 30.0, - onPressed: () => onLargeInc(), - ), - IconButton( - icon: Icon(MaterialDesignIcons.createIconDataFromIconName( - 'mdi:chevron-double-down')), - iconSize: 30.0, - onPressed: () => onLargeDec(), + onPressed: () => onDec(), ) ], )