From dadd7d1f5d985e181724fc22d71e61a31f852f51 Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Tue, 4 Jun 2024 13:16:16 +0800 Subject: [PATCH] add looping to animation debug widget --- .../widgets/debug/entity_list_widget.dart | 41 +++++++++++++++---- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/flutter_filament_federated/flutter_filament/lib/filament/widgets/debug/entity_list_widget.dart b/flutter_filament_federated/flutter_filament/lib/filament/widgets/debug/entity_list_widget.dart index b400fa28..ad5929cc 100644 --- a/flutter_filament_federated/flutter_filament/lib/filament/widgets/debug/entity_list_widget.dart +++ b/flutter_filament_federated/flutter_filament/lib/filament/widgets/debug/entity_list_widget.dart @@ -66,15 +66,38 @@ class _EntityListWidget extends State { SubmenuButton( child: const Text("Animations"), menuChildren: animations.data! - .map((a) => MenuItemButton( - child: Text(a), - onPressed: () async { - await widget.controller! - .addAnimationComponent(entity); - widget.controller!.playAnimation( - entity, animations.data!.indexOf(a)); - }, - )) + .map((a) => SubmenuButton( + child: Text(a), + menuChildren: [ + MenuItemButton( + child: Text("Play"), + onPressed: () async { + await widget.controller! + .addAnimationComponent(entity); + widget.controller!.playAnimation(entity, + animations.data!.indexOf(a)); + }, + ), + MenuItemButton( + child: Text("Loop"), + onPressed: () async { + await widget.controller! + .addAnimationComponent(entity); + widget.controller!.playAnimation( + entity, animations.data!.indexOf(a), + loop: true); + }, + ), + MenuItemButton( + child: Text("Stop"), + onPressed: () async { + await widget.controller! + .addAnimationComponent(entity); + widget.controller!.stopAnimation( + entity, animations.data!.indexOf(a)); + }, + ) + ])) .toList()), ChildRenderableWidget( controller: widget.controller!, entity: entity),