add stub method for resizeWebCanvas to make pub.dev happy

This commit is contained in:
Nick Fisher
2025-07-03 13:04:24 +08:00
parent 3cfa26d284
commit 37f8558794
3 changed files with 12 additions and 5 deletions

View File

@@ -221,8 +221,11 @@ extension DartBigIntExtension on int {
}
extension Float32ListExtension on Float32List {
Uint8List asUint8List() {
return this.buffer.asUint8List(this.offsetInBytes);
}
}
}
void resizeWebCanvas(int width, int height) {
throw UnsupportedError("Not supported on non-web platforms");
}

View File

@@ -157,7 +157,6 @@ extension Uint8ListExtension on Uint8List {
extension Float32ListExtension on Float32List {
Pointer<Float32> get address {
final ptr = getPointer<Float32>(this, this.toJS);
final bar =
Float32ArrayWrapper(NativeLibrary.instance.HEAPU8.buffer, ptr, length)
@@ -167,7 +166,8 @@ extension Float32ListExtension on Float32List {
}
Uint8List asUint8List() {
var ptr = Pointer<Uint8>(_NativeLibrary.instance._emscripten_get_byte_offset(this.toJS));
var ptr = Pointer<Uint8>(
_NativeLibrary.instance._emscripten_get_byte_offset(this.toJS));
return ptr.asTypedList(length * 4);
}
}
@@ -468,3 +468,7 @@ void stackRestore(Pointer ptr) =>
void getStackFree() {
print(_NativeLibrary.instance._emscripten_stack_get_free());
}
void resizeWebCanvas(int width, int height) {
Thermion_resizeCanvas(width, height);
}

View File

@@ -117,7 +117,7 @@ class ThermionFlutterWebPlugin extends ThermionFlutterPlatform {
///
void resizeCanvas(double width, double height) async {
_logger.info("Resizing canvas to ${width}x${height}");
Thermion_resizeCanvas((window.devicePixelRatio * width).ceil(),
resizeWebCanvas((window.devicePixelRatio * width).ceil(),
(window.devicePixelRatio * height).ceil());
}
}