update example project

This commit is contained in:
Nick Fisher
2022-12-05 17:56:47 +08:00
parent e8559ab5aa
commit b108c2dcf0

View File

@@ -52,10 +52,12 @@ class _MyAppState extends State<MyApp> {
height: _vertical ? 400 : 200,
alignment: Alignment.center,
child: SizedBox(
child: GestureDetectingFilamentView(
child: FilamentGestureDetector(
showControls: true,
controller: _filamentController,
),
child: FilamentWidget(
controller: _filamentController,
)),
)),
Text(
"Target names : ${_targetNames.join(",")}, Animation names : ${_animationNames.join(",")}"),
@@ -71,8 +73,7 @@ class _MyAppState extends State<MyApp> {
onSelected: (int item) async {
switch (item) {
case -1:
await _filamentController
.initialize();
await _filamentController.initialize();
break;
case 0:
await _filamentController
@@ -217,18 +218,41 @@ class _MyAppState extends State<MyApp> {
break;
case 27:
_framerate = _framerate == 60 ? 30 : 60;
await _filamentController.setFrameRate(_framerate);
await _filamentController
.setFrameRate(_framerate);
break;
case 28:
await _filamentController.setBackgroundImagePosition(25, 25);
await _filamentController
.setBackgroundImagePosition(25, 25);
break;
case 29:
_light = await _filamentController.addLight(2, 6500, 15000000, 0,1,0, 0, -1 , 0, true);
_light = await _filamentController.addLight(2, 6500, 15000000, 0,0,1, 0, 0 , -1, true);
_light = await _filamentController.addLight(
2,
6500,
15000000,
0,
1,
0,
0,
-1,
0,
true);
_light = await _filamentController.addLight(
2,
6500,
15000000,
0,
0,
1,
0,
0,
-1,
true);
break;
case 30:
if (_light != null) {
await _filamentController.removeLight(_light!);
await _filamentController
.removeLight(_light!);
}
break;
case 31:
@@ -239,8 +263,7 @@ class _MyAppState extends State<MyApp> {
itemBuilder: (BuildContext context) =>
<PopupMenuEntry<int>>[
const PopupMenuItem(
value: -1,
child: Text("initialize")),
value: -1, child: Text("initialize")),
const PopupMenuItem(
value: 0,
child: Text("load background image")),
@@ -318,28 +341,20 @@ class _MyAppState extends State<MyApp> {
: 'set vertical')),
PopupMenuItem(
value: 26,
child:
Text('set camera pos to 0,0,3')),
child: Text('set camera pos to 0,0,3')),
PopupMenuItem(
value: 27,
child:
Text('toggle framerate')),
child: Text('toggle framerate')),
PopupMenuItem(
value: 28,
child:
Text('set bg image pos')),
child: Text('set bg image pos')),
PopupMenuItem(
value: 29,
child:
Text('add light')),
value: 29, child: Text('add light')),
PopupMenuItem(
value: 30,
child:
Text('remove light')),
value: 30, child: Text('remove light')),
PopupMenuItem(
value: 31,
child:
Text('clear all lights')),
child: Text('clear all lights')),
]))),
Align(
alignment: Alignment.bottomRight,
@@ -365,7 +380,8 @@ class _MyAppState extends State<MyApp> {
child: Container(
color: Colors.white,
padding: const EdgeInsets.all(50),
child:Text("$_framerate fps")) )]))
child: Text("$_framerate fps")))
]))
])));
}
}