Slider labels for light controls
This commit is contained in:
parent
d19dbd389b
commit
302451e118
@ -134,8 +134,10 @@ class _LightControlsWidgetState extends State<LightControlsWidget> {
|
|||||||
_tmpBrightness = value.round();
|
_tmpBrightness = value.round();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
min: 1.0,
|
min: 1,
|
||||||
max: 255.0,
|
max: 255,
|
||||||
|
divisions: 254,
|
||||||
|
label: '${val?.toInt() ?? ''}',
|
||||||
onChangeEnd: (value) => _setBrightness(entity, value),
|
onChangeEnd: (value) => _setBrightness(entity, value),
|
||||||
value: val,
|
value: val,
|
||||||
leading: Icon(Icons.brightness_5),
|
leading: Icon(Icons.brightness_5),
|
||||||
@ -155,10 +157,12 @@ class _LightControlsWidgetState extends State<LightControlsWidget> {
|
|||||||
_tmpWhiteValue = value.round();
|
_tmpWhiteValue = value.round();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
min: 0.0,
|
min: 0,
|
||||||
max: 255.0,
|
max: 255,
|
||||||
|
divisions: 255,
|
||||||
|
label: '$_tmpWhiteValue',
|
||||||
onChangeEnd: (value) => _setWhiteValue(entity, value),
|
onChangeEnd: (value) => _setWhiteValue(entity, value),
|
||||||
value: _tmpWhiteValue == null ? 0.0 : _tmpWhiteValue.toDouble(),
|
value: _tmpWhiteValue?.toDouble() ?? 0.0,
|
||||||
leading: Icon(MaterialDesignIcons.getIconDataFromIconName("mdi:file-word-box")),
|
leading: Icon(MaterialDesignIcons.getIconDataFromIconName("mdi:file-word-box")),
|
||||||
title: "White",
|
title: "White",
|
||||||
);
|
);
|
||||||
@ -188,6 +192,8 @@ class _LightControlsWidgetState extends State<LightControlsWidget> {
|
|||||||
onChangeEnd: (value) => _setColorTemp(entity, value),
|
onChangeEnd: (value) => _setColorTemp(entity, value),
|
||||||
max: entity.maxMireds,
|
max: entity.maxMireds,
|
||||||
min: entity.minMireds,
|
min: entity.minMireds,
|
||||||
|
divisions: (entity.maxMireds - entity.minMireds).toInt(),
|
||||||
|
label: '$_tmpColorTemp',
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_changedHere = true;
|
_changedHere = true;
|
||||||
|
@ -13,9 +13,10 @@ class UniversalSlider extends StatefulWidget {
|
|||||||
final double max;
|
final double max;
|
||||||
final double value;
|
final double value;
|
||||||
final int divisions;
|
final int divisions;
|
||||||
|
final String label;
|
||||||
final EdgeInsets padding;
|
final EdgeInsets padding;
|
||||||
|
|
||||||
const UniversalSlider({Key key, this.onChanged, this.onChangeStart, this.activeColor, this.divisions, this.onChangeEnd, this.leading, this.closing, this.title, this.min, this.max, this.value, this.padding: const EdgeInsets.fromLTRB(Sizes.leftWidgetPadding, Sizes.rowPadding, Sizes.rightWidgetPadding, 0.0)}) : super(key: key);
|
const UniversalSlider({Key key, this.onChanged, this.label, this.onChangeStart, this.activeColor, this.divisions, this.onChangeEnd, this.leading, this.closing, this.title, this.min, this.max, this.value, this.padding: const EdgeInsets.fromLTRB(Sizes.leftWidgetPadding, Sizes.rowPadding, Sizes.rightWidgetPadding, 0.0)}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() {
|
State<StatefulWidget> createState() {
|
||||||
@ -54,6 +55,7 @@ class UniversalSliderState extends State<UniversalSlider> {
|
|||||||
min: widget.min ?? 0,
|
min: widget.min ?? 0,
|
||||||
max: widget.max ?? 100,
|
max: widget.max ?? 100,
|
||||||
activeColor: widget.activeColor,
|
activeColor: widget.activeColor,
|
||||||
|
label: widget.label,
|
||||||
onChangeStart: (value) {
|
onChangeStart: (value) {
|
||||||
_changeStarted = true;
|
_changeStarted = true;
|
||||||
widget.onChangeStart?.call(value);
|
widget.onChangeStart?.call(value);
|
||||||
|
Reference in New Issue
Block a user