restructure light slider widget

This commit is contained in:
Nick Fisher
2024-02-19 20:54:37 +08:00
parent 974f9ea9d9
commit 58c7679857

View File

@@ -68,8 +68,7 @@ class _IblRotationSliderWidgetState extends State<LightSliderWidget> {
lightDir.x, lightDir.x,
lightDir.y, lightDir.y,
lightDir.z, lightDir.z,
castShadows, castShadows);
async: false);
setState(() {}); setState(() {});
} }
@@ -83,100 +82,114 @@ class _IblRotationSliderWidgetState extends State<LightSliderWidget> {
data: ThemeData(platform: TargetPlatform.android), data: ThemeData(platform: TargetPlatform.android),
child: Container( child: Container(
decoration: BoxDecoration(color: Colors.white.withOpacity(0.5)), decoration: BoxDecoration(color: Colors.white.withOpacity(0.5)),
child: Column(children: [ child: SliderTheme(
Slider( data: SliderThemeData(
label: "POSX", showValueIndicator: ShowValueIndicator.always,
value: lightPos.x, valueIndicatorTextStyle: TextStyle(color: Colors.black)),
min: -10.0, child: Column(mainAxisSize: MainAxisSize.min, children: [
max: 10.0, Row(children: [
onChanged: (value) { Expanded(
lightPos.x = value; child: Slider(
_set(); label: "POSX",
}), value: lightPos.x,
Slider( min: -10.0,
label: "POSY", max: 10.0,
value: lightPos.y, onChanged: (value) {
min: -10.0, lightPos.x = value;
max: 10.0, _set();
onChanged: (value) { })),
lightPos.y = value; Expanded(
_set(); child: Slider(
}), label: "POSY",
Slider( value: lightPos.y,
label: "POSZ", min: -10.0,
value: lightPos.z, max: 10.0,
min: -10.0, onChanged: (value) {
max: 10.0, lightPos.y = value;
onChanged: (value) { _set();
lightPos.z = value; })),
_set(); Expanded(
}), child: Slider(
Slider( label: "POSZ",
label: "DIRX", value: lightPos.z,
value: lightDir.x, min: -10.0,
min: -10.0, max: 10.0,
max: 10.0, onChanged: (value) {
onChanged: (value) { lightPos.z = value;
lightDir.x = value; _set();
_set(); }))
}), ]),
Slider( Row(children: [
label: "DIRY", Expanded(
value: lightDir.y, child: Slider(
min: -10.0, label: "DIRX",
max: 10.0, value: lightDir.x,
onChanged: (value) { min: -10.0,
lightDir.y = value; max: 10.0,
_set(); onChanged: (value) {
}), lightDir.x = value;
Slider( _set();
label: "DIRZ", })),
value: lightDir.z, Expanded(
min: -10.0, child: Slider(
max: 10.0, label: "DIRY",
onChanged: (value) { value: lightDir.y,
lightDir.z = value; min: -10.0,
_set(); max: 10.0,
}), onChanged: (value) {
Slider( lightDir.y = value;
label: "Color", _set();
value: color, })),
min: 0, Expanded(
max: 16000, child: Slider(
onChanged: (value) { label: "DIRZ",
color = value; value: lightDir.z,
_set(); min: -10.0,
}), max: 10.0,
Slider( onChanged: (value) {
label: "Intensity", lightDir.z = value;
value: intensity, _set();
min: 0, }))
max: 1000000, ]),
onChanged: (value) { Slider(
intensity = value; label: "Color",
_set(); value: color,
}), min: 0,
DropdownButton( max: 16000,
onChanged: (v) { onChanged: (value) {
this.type = v; color = value;
_set(); _set();
}, }),
value: type, Slider(
items: List<DropdownMenuItem>.generate( label: "Intensity",
5, value: intensity,
(idx) => DropdownMenuItem( min: 0,
value: idx, max: 1000000,
child: Text("$idx"), onChanged: (value) {
))), intensity = value;
Row(children: [ _set();
Text("Shadows: $castShadows"), }),
Checkbox( DropdownButton(
value: castShadows, onChanged: (v) {
onChanged: (v) { this.type = v;
this.castShadows = v!; _set();
_set(); },
}) value: type,
]) items: List<DropdownMenuItem>.generate(
]))); 5,
(idx) => DropdownMenuItem(
value: idx,
child: Text("$idx"),
))),
Row(children: [
Text("Shadows: $castShadows"),
Checkbox(
value: castShadows,
onChanged: (v) {
this.castShadows = v!;
_set();
})
])
]))));
} }
} }