-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add simple display of target temperature
- Loading branch information
Showing
4 changed files
with
113 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'package:bootstrap_icons/bootstrap_icons.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:yonomi_device_widgets/providers/thermostat_provider.dart'; | ||
import 'package:yonomi_device_widgets/traits/slim/base_slim_widget.dart'; | ||
import 'package:yonomi_device_widgets/ui/widget_style_constants.dart'; | ||
|
||
class ThermostatSlimWidget extends BaseSlimWidget { | ||
ThermostatSlimWidget(ThermostatProvider thermostatProvider, | ||
{Color? backgroundColor, Key? key}) | ||
: super( | ||
provider: thermostatProvider, | ||
leftIcon: Icon(BootstrapIcons.thermometer, | ||
size: 20.0, | ||
color: WidgetStyleConstants.deviceDetailIconColorActive), | ||
headerText: Text( | ||
'Target Temperature: ${thermostatProvider.targetTemperature.toInt()}\u{00B0}', | ||
style: TextStyle( | ||
fontSize: 20, color: WidgetStyleConstants.darkTextColor)), | ||
backgroundColor: backgroundColor, | ||
key: key); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import 'package:bootstrap_icons/bootstrap_icons.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:yonomi_device_widgets/providers/thermostat_provider.dart'; | ||
import 'package:yonomi_device_widgets/ui/widget_style_constants.dart'; | ||
|
||
class ThermostatWidget extends StatelessWidget { | ||
final ThermostatProvider _thermostatProvider; | ||
|
||
late final Color _textColor; | ||
|
||
ThermostatWidget(this._thermostatProvider, | ||
{Color textColor = WidgetStyleConstants.darkTextColor, Key? key}) | ||
: super(key: key) { | ||
this._textColor = textColor; | ||
} | ||
|
||
Widget _centerText(TextStyle? style) { | ||
return Row(children: [ | ||
Icon( | ||
BootstrapIcons.thermometer, | ||
size: style?.height, | ||
color: style?.color, | ||
), | ||
Text( | ||
'${_thermostatProvider.targetTemperature.toInt()}\u{00B0}', | ||
style: style, | ||
) | ||
]); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Column( | ||
mainAxisAlignment: MainAxisAlignment.start, | ||
children: [ | ||
Row( | ||
children: <Widget>[ | ||
Text( | ||
_thermostatProvider.displayName, | ||
style: Theme.of(context) | ||
.textTheme | ||
.headline6 | ||
?.copyWith(color: _textColor), | ||
textAlign: TextAlign.center, | ||
), | ||
], | ||
), | ||
SizedBox( | ||
height: 30, | ||
), | ||
Row( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
Center( | ||
child: _centerText(Theme.of(context) | ||
.textTheme | ||
.headline2 | ||
?.copyWith(color: _textColor)), | ||
) | ||
], | ||
), | ||
SizedBox( | ||
height: 30, | ||
), | ||
], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters