From 851d2df84e8910e991ae586aaf6aad0afdb96e39 Mon Sep 17 00:00:00 2001 From: LukasPoque Date: Mon, 6 Nov 2023 14:27:16 +0100 Subject: [PATCH] Run dart fix in lib --- lib/animations/animation_builder.dart | 11 ++++++----- lib/filament_controller_ffi.dart | 11 +++++------ lib/widgets/filament_gesture_detector.dart | 2 -- lib/widgets/filament_gesture_detector_desktop.dart | 4 ++-- lib/widgets/filament_widget.dart | 3 +-- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/lib/animations/animation_builder.dart b/lib/animations/animation_builder.dart index 083b4070..bbb1ba30 100644 --- a/lib/animations/animation_builder.dart +++ b/lib/animations/animation_builder.dart @@ -25,8 +25,9 @@ class AnimationBuilder { } MorphAnimationData build() { - if (availableMorphs.isEmpty == 0 || _duration == 0 || _frameLengthInMs == 0) + if (availableMorphs.isEmpty || _duration == 0 || _frameLengthInMs == 0) { throw Exception(); + } int numFrames = _duration * 1000 ~/ _frameLengthInMs; @@ -64,10 +65,10 @@ class AnimationBuilder { AnimationBuilder interpolateMorphWeights( double start, double end, double startValue, double endValue) { - this._interpMorphStart = start; - this._interpMorphEnd = end; - this._interpMorphStartValue = startValue; - this._interpMorphEndValue = endValue; + _interpMorphStart = start; + _interpMorphEnd = end; + _interpMorphStartValue = startValue; + _interpMorphEndValue = endValue; return this; } diff --git a/lib/filament_controller_ffi.dart b/lib/filament_controller_ffi.dart index 6516ab09..2bfee438 100644 --- a/lib/filament_controller_ffi.dart +++ b/lib/filament_controller_ffi.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'dart:ffi'; import 'dart:io'; -import 'dart:typed_data'; import 'dart:ui' as ui; import 'package:flutter/services.dart'; import 'package:ffi/ffi.dart'; @@ -69,7 +68,7 @@ class FilamentControllerFFI extends FilamentController { _resizingWidth = call.arguments[0]; _resizingHeight = call.arguments[1]; _resizeTimer = Timer(const Duration(milliseconds: 500), () async { - this.rect.value = Offset.zero & + rect.value = Offset.zero & ui.Size(_resizingWidth!.toDouble(), _resizingHeight!.toDouble()); await resize(); }); @@ -215,7 +214,7 @@ class FilamentControllerFFI extends FilamentController { } textureDetails.value = TextureDetails( - textureId: renderingSurface.flutterTextureId!, + textureId: renderingSurface.flutterTextureId, width: rect.value!.width.toInt(), height: rect.value!.height.toInt()); print("texture details ${textureDetails.value}"); @@ -352,7 +351,7 @@ class FilamentControllerFFI extends FilamentController { } textureDetails.value = TextureDetails( - textureId: renderingSurface.flutterTextureId!, + textureId: renderingSurface.flutterTextureId, width: rect.value!.width.toInt(), height: rect.value!.height.toInt()); @@ -644,7 +643,7 @@ class FilamentControllerFFI extends FilamentController { calloc.free(dataPtr); calloc.free(idxPtr); throw Exception( - "Morph target ${animation.morphTargets[i]} is specified in the animation but could not be found in the mesh ${animation.meshName} under entity ${entity}"); + "Morph target ${animation.morphTargets[i]} is specified in the animation but could not be found in the mesh ${animation.meshName} under entity $entity"); } idxPtr.elementAt(i).value = index; } @@ -776,7 +775,7 @@ class FilamentControllerFFI extends FilamentController { throw Exception("No viewer available, ignoring"); } var result = _lib.set_camera( - _viewer!, asset, name?.toNativeUtf8()?.cast() ?? nullptr); + _viewer!, asset, name?.toNativeUtf8().cast() ?? nullptr); if (!result) { throw Exception("Failed to set camera"); } diff --git a/lib/widgets/filament_gesture_detector.dart b/lib/widgets/filament_gesture_detector.dart index 5a6f2669..5bcdbf20 100644 --- a/lib/widgets/filament_gesture_detector.dart +++ b/lib/widgets/filament_gesture_detector.dart @@ -1,8 +1,6 @@ -import 'dart:async'; import 'dart:io'; import 'package:flutter/foundation.dart'; -import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_filament/widgets/filament_gesture_detector_desktop.dart'; import 'package:flutter_filament/widgets/filament_gesture_detector_mobile.dart'; diff --git a/lib/widgets/filament_gesture_detector_desktop.dart b/lib/widgets/filament_gesture_detector_desktop.dart index a2088313..2f9832fa 100644 --- a/lib/widgets/filament_gesture_detector_desktop.dart +++ b/lib/widgets/filament_gesture_detector_desktop.dart @@ -49,7 +49,7 @@ class _FilamentGestureDetectorDesktopState /// /// /// - bool _scaling = false; + final bool _scaling = false; bool _pointerMoving = false; @@ -78,7 +78,7 @@ class _FilamentGestureDetectorDesktopState // we don't want to end the zoom in the same frame, because this will destroy the camera manipulator (and cancel the zoom update). // here, we just defer calling [zoomEnd] for 100ms to ensure the update is propagated through. - _scrollTimer = Timer(Duration(milliseconds: 100), () async { + _scrollTimer = Timer(const Duration(milliseconds: 100), () async { await widget.controller.zoomEnd(); }); } diff --git a/lib/widgets/filament_widget.dart b/lib/widgets/filament_widget.dart index fa1bc504..6988adaa 100644 --- a/lib/widgets/filament_widget.dart +++ b/lib/widgets/filament_widget.dart @@ -110,8 +110,7 @@ class _SizedFilamentWidget extends StatefulWidget { final FilamentController controller; const _SizedFilamentWidget( - {super.key, - required this.width, + {required this.width, required this.height, this.initial, required this.controller});