Run dart fix in lib

This commit is contained in:
LukasPoque
2023-11-06 14:27:16 +01:00
parent 8120cbea6d
commit 851d2df84e
5 changed files with 14 additions and 17 deletions

View File

@@ -25,8 +25,9 @@ class AnimationBuilder {
} }
MorphAnimationData build() { MorphAnimationData build() {
if (availableMorphs.isEmpty == 0 || _duration == 0 || _frameLengthInMs == 0) if (availableMorphs.isEmpty || _duration == 0 || _frameLengthInMs == 0) {
throw Exception(); throw Exception();
}
int numFrames = _duration * 1000 ~/ _frameLengthInMs; int numFrames = _duration * 1000 ~/ _frameLengthInMs;
@@ -64,10 +65,10 @@ class AnimationBuilder {
AnimationBuilder interpolateMorphWeights( AnimationBuilder interpolateMorphWeights(
double start, double end, double startValue, double endValue) { double start, double end, double startValue, double endValue) {
this._interpMorphStart = start; _interpMorphStart = start;
this._interpMorphEnd = end; _interpMorphEnd = end;
this._interpMorphStartValue = startValue; _interpMorphStartValue = startValue;
this._interpMorphEndValue = endValue; _interpMorphEndValue = endValue;
return this; return this;
} }

View File

@@ -1,7 +1,6 @@
import 'dart:async'; import 'dart:async';
import 'dart:ffi'; import 'dart:ffi';
import 'dart:io'; import 'dart:io';
import 'dart:typed_data';
import 'dart:ui' as ui; import 'dart:ui' as ui;
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:ffi/ffi.dart'; import 'package:ffi/ffi.dart';
@@ -69,7 +68,7 @@ class FilamentControllerFFI extends FilamentController {
_resizingWidth = call.arguments[0]; _resizingWidth = call.arguments[0];
_resizingHeight = call.arguments[1]; _resizingHeight = call.arguments[1];
_resizeTimer = Timer(const Duration(milliseconds: 500), () async { _resizeTimer = Timer(const Duration(milliseconds: 500), () async {
this.rect.value = Offset.zero & rect.value = Offset.zero &
ui.Size(_resizingWidth!.toDouble(), _resizingHeight!.toDouble()); ui.Size(_resizingWidth!.toDouble(), _resizingHeight!.toDouble());
await resize(); await resize();
}); });
@@ -215,7 +214,7 @@ class FilamentControllerFFI extends FilamentController {
} }
textureDetails.value = TextureDetails( textureDetails.value = TextureDetails(
textureId: renderingSurface.flutterTextureId!, textureId: renderingSurface.flutterTextureId,
width: rect.value!.width.toInt(), width: rect.value!.width.toInt(),
height: rect.value!.height.toInt()); height: rect.value!.height.toInt());
print("texture details ${textureDetails.value}"); print("texture details ${textureDetails.value}");
@@ -352,7 +351,7 @@ class FilamentControllerFFI extends FilamentController {
} }
textureDetails.value = TextureDetails( textureDetails.value = TextureDetails(
textureId: renderingSurface.flutterTextureId!, textureId: renderingSurface.flutterTextureId,
width: rect.value!.width.toInt(), width: rect.value!.width.toInt(),
height: rect.value!.height.toInt()); height: rect.value!.height.toInt());
@@ -644,7 +643,7 @@ class FilamentControllerFFI extends FilamentController {
calloc.free(dataPtr); calloc.free(dataPtr);
calloc.free(idxPtr); calloc.free(idxPtr);
throw Exception( 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; idxPtr.elementAt(i).value = index;
} }
@@ -776,7 +775,7 @@ class FilamentControllerFFI extends FilamentController {
throw Exception("No viewer available, ignoring"); throw Exception("No viewer available, ignoring");
} }
var result = _lib.set_camera( var result = _lib.set_camera(
_viewer!, asset, name?.toNativeUtf8()?.cast<Char>() ?? nullptr); _viewer!, asset, name?.toNativeUtf8().cast<Char>() ?? nullptr);
if (!result) { if (!result) {
throw Exception("Failed to set camera"); throw Exception("Failed to set camera");
} }

View File

@@ -1,8 +1,6 @@
import 'dart:async';
import 'dart:io'; import 'dart:io';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_filament/widgets/filament_gesture_detector_desktop.dart'; import 'package:flutter_filament/widgets/filament_gesture_detector_desktop.dart';
import 'package:flutter_filament/widgets/filament_gesture_detector_mobile.dart'; import 'package:flutter_filament/widgets/filament_gesture_detector_mobile.dart';

View File

@@ -49,7 +49,7 @@ class _FilamentGestureDetectorDesktopState
/// ///
/// ///
/// ///
bool _scaling = false; final bool _scaling = false;
bool _pointerMoving = 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). // 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. // 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(); await widget.controller.zoomEnd();
}); });
} }

View File

@@ -110,8 +110,7 @@ class _SizedFilamentWidget extends StatefulWidget {
final FilamentController controller; final FilamentController controller;
const _SizedFilamentWidget( const _SizedFilamentWidget(
{super.key, {required this.width,
required this.width,
required this.height, required this.height,
this.initial, this.initial,
required this.controller}); required this.controller});