widget updates
This commit is contained in:
@@ -35,7 +35,7 @@ class _ThermionGestureDetectorDesktopState
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Listener(
|
return Listener(
|
||||||
onPointerHover: (event) =>
|
onPointerHover: (event) =>
|
||||||
widget.gestureHandler.onPointerHover(event.localPosition),
|
widget.gestureHandler.onPointerHover(event.localPosition, event.delta),
|
||||||
onPointerSignal: (PointerSignalEvent pointerSignal) {
|
onPointerSignal: (PointerSignalEvent pointerSignal) {
|
||||||
if (pointerSignal is PointerScrollEvent) {
|
if (pointerSignal is PointerScrollEvent) {
|
||||||
widget.gestureHandler.onPointerScroll(
|
widget.gestureHandler.onPointerScroll(
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ enum GestureType {
|
|||||||
SCALE1,
|
SCALE1,
|
||||||
SCALE2,
|
SCALE2,
|
||||||
SCROLLWHEEL,
|
SCROLLWHEEL,
|
||||||
POINTER_MOVE
|
POINTER_MOVE,
|
||||||
|
KEYDOWN
|
||||||
}
|
}
|
||||||
|
|
||||||
enum GestureAction {
|
enum GestureAction {
|
||||||
|
|||||||
@@ -1,194 +1,194 @@
|
|||||||
|
|
||||||
import 'package:thermion_dart/thermion_dart/thermion_viewer.dart';
|
// import 'package:thermion_dart/thermion_dart/thermion_viewer.dart';
|
||||||
import 'package:thermion_dart/thermion_dart/utils/light_options.dart';
|
// import 'package:thermion_dart/thermion_dart/utils/light_options.dart';
|
||||||
import 'package:flutter/material.dart';
|
// import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
// import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
import 'package:vector_math/vector_math_64.dart' as v;
|
// import 'package:vector_math/vector_math_64.dart' as v;
|
||||||
|
|
||||||
class LightSliderWidget extends StatefulWidget {
|
// class LightSliderWidget extends StatefulWidget {
|
||||||
final ThermionViewer controller;
|
// final ThermionViewer controller;
|
||||||
|
|
||||||
final LightOptions options;
|
// final LightOptions options;
|
||||||
final bool showControls;
|
// final bool showControls;
|
||||||
|
|
||||||
LightSliderWidget(
|
// LightSliderWidget(
|
||||||
{super.key,
|
// {super.key,
|
||||||
required this.controller,
|
// required this.controller,
|
||||||
this.showControls = false,
|
// this.showControls = false,
|
||||||
required this.options});
|
// required this.options});
|
||||||
@override
|
// @override
|
||||||
State<StatefulWidget> createState() => _LightSliderWidgetState();
|
// State<StatefulWidget> createState() => _LightSliderWidgetState();
|
||||||
}
|
// }
|
||||||
|
|
||||||
class _LightSliderWidgetState extends State<LightSliderWidget> {
|
// class _LightSliderWidgetState extends State<LightSliderWidget> {
|
||||||
ThermionEntity? _light;
|
// ThermionEntity? _light;
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
void initState() {
|
// void initState() {
|
||||||
_set();
|
// _set();
|
||||||
super.initState();
|
// super.initState();
|
||||||
}
|
// }
|
||||||
|
|
||||||
Future _set() async {
|
// Future _set() async {
|
||||||
await widget.controller.clearLights();
|
// await widget.controller.clearLights();
|
||||||
|
|
||||||
if (widget.options.iblPath != null) {
|
// if (widget.options.iblPath != null) {
|
||||||
_light = await widget.controller.loadIbl(widget.options.iblPath!,
|
// _light = await widget.controller.loadIbl(widget.options.iblPath!,
|
||||||
intensity: widget.options.iblIntensity);
|
// intensity: widget.options.iblIntensity);
|
||||||
}
|
// }
|
||||||
|
|
||||||
_light = await widget.controller.addLight(
|
// _light = await widget.controller.addLight(
|
||||||
LightType.values[
|
// LightType.values[
|
||||||
widget.options.directionalType],
|
// widget.options.directionalType],
|
||||||
widget.options.directionalColor,
|
// widget.options.directionalColor,
|
||||||
widget.options.directionalIntensity,
|
// widget.options.directionalIntensity,
|
||||||
widget.options.directionalPosition.x,
|
// widget.options.directionalPosition.x,
|
||||||
widget.options.directionalPosition.y,
|
// widget.options.directionalPosition.y,
|
||||||
widget.options.directionalPosition.z,
|
// widget.options.directionalPosition.z,
|
||||||
widget.options.directionalDirection.x,
|
// widget.options.directionalDirection.x,
|
||||||
widget.options.directionalDirection.y,
|
// widget.options.directionalDirection.y,
|
||||||
widget.options.directionalDirection.z,
|
// widget.options.directionalDirection.z,
|
||||||
castShadows:widget.options.directionalCastShadows);
|
// castShadows:widget.options.directionalCastShadows);
|
||||||
|
|
||||||
setState(() {});
|
// setState(() {});
|
||||||
}
|
// }
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
Widget build(BuildContext context) {
|
// Widget build(BuildContext context) {
|
||||||
if (_light == null || !widget.showControls) {
|
// if (_light == null || !widget.showControls) {
|
||||||
return Container();
|
// return Container();
|
||||||
}
|
// }
|
||||||
return Theme(
|
// return Theme(
|
||||||
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: SliderTheme(
|
// child: SliderTheme(
|
||||||
data: const SliderThemeData(
|
// data: const SliderThemeData(
|
||||||
showValueIndicator: ShowValueIndicator.always,
|
// showValueIndicator: ShowValueIndicator.always,
|
||||||
valueIndicatorTextStyle: TextStyle(color: Colors.black)),
|
// valueIndicatorTextStyle: TextStyle(color: Colors.black)),
|
||||||
child: Column(mainAxisSize: MainAxisSize.min, children: [
|
// child: Column(mainAxisSize: MainAxisSize.min, children: [
|
||||||
Text("Directional"),
|
// Text("Directional"),
|
||||||
Row(children: [
|
// Row(children: [
|
||||||
Expanded(
|
// Expanded(
|
||||||
child: Slider(
|
// child: Slider(
|
||||||
label:
|
// label:
|
||||||
"POSX ${widget.options.directionalPosition.x}",
|
// "POSX ${widget.options.directionalPosition.x}",
|
||||||
value: widget.options.directionalPosition.x,
|
// value: widget.options.directionalPosition.x,
|
||||||
min: -10.0,
|
// min: -10.0,
|
||||||
max: 10.0,
|
// max: 10.0,
|
||||||
onChanged: (value) {
|
// onChanged: (value) {
|
||||||
widget.options.directionalPosition.x = value;
|
// widget.options.directionalPosition.x = value;
|
||||||
_set();
|
// _set();
|
||||||
})),
|
// })),
|
||||||
Expanded(
|
// Expanded(
|
||||||
child: Slider(
|
// child: Slider(
|
||||||
label:
|
// label:
|
||||||
"POSY ${widget.options.directionalPosition.y}",
|
// "POSY ${widget.options.directionalPosition.y}",
|
||||||
value: widget.options.directionalPosition.y,
|
// value: widget.options.directionalPosition.y,
|
||||||
min: -100.0,
|
// min: -100.0,
|
||||||
max: 100.0,
|
// max: 100.0,
|
||||||
onChanged: (value) {
|
// onChanged: (value) {
|
||||||
widget.options.directionalPosition.y = value;
|
// widget.options.directionalPosition.y = value;
|
||||||
_set();
|
// _set();
|
||||||
})),
|
// })),
|
||||||
Expanded(
|
// Expanded(
|
||||||
child: Slider(
|
// child: Slider(
|
||||||
label:
|
// label:
|
||||||
"POSZ ${widget.options.directionalPosition.z}",
|
// "POSZ ${widget.options.directionalPosition.z}",
|
||||||
value: widget.options.directionalPosition.z,
|
// value: widget.options.directionalPosition.z,
|
||||||
min: -100.0,
|
// min: -100.0,
|
||||||
max: 100.0,
|
// max: 100.0,
|
||||||
onChanged: (value) {
|
// onChanged: (value) {
|
||||||
widget.options.directionalPosition.z = value;
|
// widget.options.directionalPosition.z = value;
|
||||||
_set();
|
// _set();
|
||||||
}))
|
// }))
|
||||||
]),
|
// ]),
|
||||||
Row(children: [
|
// Row(children: [
|
||||||
Expanded(
|
// Expanded(
|
||||||
child: Slider(
|
// child: Slider(
|
||||||
label: "DIRX",
|
// label: "DIRX",
|
||||||
value: widget.options.directionalDirection.x,
|
// value: widget.options.directionalDirection.x,
|
||||||
min: -1.0,
|
// min: -1.0,
|
||||||
max: 1.0,
|
// max: 1.0,
|
||||||
onChanged: (value) {
|
// onChanged: (value) {
|
||||||
widget.options.directionalDirection.x = value;
|
// widget.options.directionalDirection.x = value;
|
||||||
_set();
|
// _set();
|
||||||
})),
|
// })),
|
||||||
Expanded(
|
// Expanded(
|
||||||
child: Slider(
|
// child: Slider(
|
||||||
label: "DIRY",
|
// label: "DIRY",
|
||||||
value: widget.options.directionalDirection.y,
|
// value: widget.options.directionalDirection.y,
|
||||||
min: -1.0,
|
// min: -1.0,
|
||||||
max: 1.0,
|
// max: 1.0,
|
||||||
onChanged: (value) {
|
// onChanged: (value) {
|
||||||
widget.options.directionalDirection.y = value;
|
// widget.options.directionalDirection.y = value;
|
||||||
_set();
|
// _set();
|
||||||
})),
|
// })),
|
||||||
Expanded(
|
// Expanded(
|
||||||
child: Slider(
|
// child: Slider(
|
||||||
label: "DIRZ",
|
// label: "DIRZ",
|
||||||
value: widget.options.directionalDirection.z,
|
// value: widget.options.directionalDirection.z,
|
||||||
min: -1.0,
|
// min: -1.0,
|
||||||
max: 1.0,
|
// max: 1.0,
|
||||||
onChanged: (value) {
|
// onChanged: (value) {
|
||||||
widget.options.directionalDirection.z = value;
|
// widget.options.directionalDirection.z = value;
|
||||||
_set();
|
// _set();
|
||||||
}))
|
// }))
|
||||||
]),
|
// ]),
|
||||||
Slider(
|
// Slider(
|
||||||
label: "Color",
|
// label: "Color",
|
||||||
value: widget.options.directionalColor,
|
// value: widget.options.directionalColor,
|
||||||
min: 0,
|
// min: 0,
|
||||||
max: 16000,
|
// max: 16000,
|
||||||
onChanged: (value) {
|
// onChanged: (value) {
|
||||||
widget.options.directionalColor = value;
|
// widget.options.directionalColor = value;
|
||||||
_set();
|
// _set();
|
||||||
}),
|
// }),
|
||||||
Slider(
|
// Slider(
|
||||||
label: "Intensity ${widget.options.directionalIntensity}",
|
// label: "Intensity ${widget.options.directionalIntensity}",
|
||||||
value: widget.options.directionalIntensity,
|
// value: widget.options.directionalIntensity,
|
||||||
min: 0,
|
// min: 0,
|
||||||
max: 1000000,
|
// max: 1000000,
|
||||||
onChanged: (value) {
|
// onChanged: (value) {
|
||||||
widget.options.directionalIntensity = value;
|
// widget.options.directionalIntensity = value;
|
||||||
_set();
|
// _set();
|
||||||
}),
|
// }),
|
||||||
DropdownButton(
|
// DropdownButton(
|
||||||
onChanged: (v) {
|
// onChanged: (v) {
|
||||||
this.widget.options.directionalType = v;
|
// this.widget.options.directionalType = v;
|
||||||
_set();
|
// _set();
|
||||||
},
|
// },
|
||||||
value: this.widget.options.directionalType,
|
// value: this.widget.options.directionalType,
|
||||||
items: List<DropdownMenuItem>.generate(
|
// items: List<DropdownMenuItem>.generate(
|
||||||
5,
|
// 5,
|
||||||
(idx) => DropdownMenuItem(
|
// (idx) => DropdownMenuItem(
|
||||||
value: idx,
|
// value: idx,
|
||||||
child: Text("$idx"),
|
// child: Text("$idx"),
|
||||||
))),
|
// ))),
|
||||||
Row(children: [
|
// Row(children: [
|
||||||
Text(
|
// Text(
|
||||||
"Shadows: ${this.widget.options.directionalCastShadows}"),
|
// "Shadows: ${this.widget.options.directionalCastShadows}"),
|
||||||
Checkbox(
|
// Checkbox(
|
||||||
value: widget.options.directionalCastShadows,
|
// value: widget.options.directionalCastShadows,
|
||||||
onChanged: (v) {
|
// onChanged: (v) {
|
||||||
this.widget.options.directionalCastShadows = v!;
|
// this.widget.options.directionalCastShadows = v!;
|
||||||
_set();
|
// _set();
|
||||||
})
|
// })
|
||||||
]),
|
// ]),
|
||||||
Text("Indirect"),
|
// Text("Indirect"),
|
||||||
Row(children: [
|
// Row(children: [
|
||||||
Expanded(
|
// Expanded(
|
||||||
child: Slider(
|
// child: Slider(
|
||||||
label: "Intensity ${widget.options.iblIntensity}",
|
// label: "Intensity ${widget.options.iblIntensity}",
|
||||||
value: widget.options.iblIntensity,
|
// value: widget.options.iblIntensity,
|
||||||
min: 0.0,
|
// min: 0.0,
|
||||||
max: 200000,
|
// max: 200000,
|
||||||
onChanged: (value) {
|
// onChanged: (value) {
|
||||||
widget.options.iblIntensity = value;
|
// widget.options.iblIntensity = value;
|
||||||
_set();
|
// _set();
|
||||||
})),
|
// })),
|
||||||
])
|
// ])
|
||||||
]))));
|
// ]))));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|||||||
Reference in New Issue
Block a user