Browse Source

[flutter] Minor cosmetics.

Mario Zechner 2 years ago
parent
commit
d596731ca3

+ 5 - 7
spine-flutter/example/lib/ik_following.dart

@@ -21,13 +21,11 @@ class IkFollowingState extends State<IkFollowing> {
       controller.animationState.setAnimationByName(0, "walk", true);
       controller.animationState.setAnimationByName(1, "aim", true);
     }, onAfterUpdateWorldTransforms: (controller) {
-      var worldPosition = crossHairPosition;
+      final worldPosition = crossHairPosition;
       if (worldPosition == null) return;
-      var bone = controller.skeleton.findBone("crosshair");
-      if (bone == null) return;
-      var parent = bone.getParent();
-      if (parent == null) return;
-      var position = parent.worldToLocal(worldPosition.dx, worldPosition.dy);
+      final bone = controller.skeleton.findBone("crosshair")!;
+      final parent = bone.getParent()!;
+      final position = parent.worldToLocal(worldPosition.dx, worldPosition.dy);
       bone.setX(position.x);
       bone.setY(position.y);
     });
@@ -46,7 +44,7 @@ class IkFollowingState extends State<IkFollowing> {
         body: GestureDetector(
           onPanDown: (drag) => _updateBonePosition(drag.localPosition),
           onPanUpdate: (drag) => _updateBonePosition(drag.localPosition),
-          child: SpineWidget.fromAsset("assets/spineboy.atlas", "assets/spineboy-pro.skel", controller),
+          child: SpineWidget.fromAsset("assets/spineboy.atlas", "assets/spineboy-pro.skel", controller, alignment: Alignment.centerLeft,),
         ));
   }
 }

+ 2 - 2
spine-flutter/example/pubspec.lock

@@ -13,10 +13,10 @@ packages:
     dependency: transitive
     description:
       name: characters
-      sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c
+      sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
       url: "https://pub.dev"
     source: hosted
-    version: "1.2.1"
+    version: "1.3.0"
   collection:
     dependency: transitive
     description:

+ 2 - 2
spine-flutter/lib/spine_flutter.dart

@@ -1597,8 +1597,8 @@ class RegionAttachment extends Attachment<spine_region_attachment> {
 
   Float32List getUVs() {
     final num = _bindings.spine_region_attachment_get_num_uvs(_attachment);
-    final offset = _bindings.spine_region_attachment_get_uvs(_attachment);
-    return offset.asTypedList(num);
+    final uvs = _bindings.spine_region_attachment_get_uvs(_attachment);
+    return uvs.asTypedList(num);
   }
 }