feat! js_interop improvements
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:thermion_dart/thermion_dart.dart';
|
||||
import 'package:thermion_dart/src/filament/filament.dart';
|
||||
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
|
||||
import 'thermion_flutter_texture.dart';
|
||||
|
||||
@@ -9,7 +8,8 @@ class ThermionFlutterOptions {
|
||||
final String? uberarchivePath;
|
||||
final Backend? backend;
|
||||
|
||||
const ThermionFlutterOptions({this.uberarchivePath = null, this.backend = null});
|
||||
const ThermionFlutterOptions(
|
||||
{this.uberarchivePath = null, this.backend = null});
|
||||
}
|
||||
|
||||
abstract class ThermionFlutterPlatform extends PlatformInterface {
|
||||
@@ -20,6 +20,29 @@ abstract class ThermionFlutterPlatform extends PlatformInterface {
|
||||
static late final ThermionFlutterPlatform _instance;
|
||||
static ThermionFlutterPlatform get instance => _instance;
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
ThermionFlutterOptions? _options;
|
||||
ThermionFlutterOptions get options {
|
||||
_options ??= const ThermionFlutterOptions();
|
||||
return _options!;
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
void setOptions(covariant ThermionFlutterOptions options) {
|
||||
if (_options != null) {
|
||||
throw Exception(
|
||||
"Options can only be set once for the entire app lifecycle.");
|
||||
}
|
||||
_options = options;
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
static set instance(ThermionFlutterPlatform instance) {
|
||||
PlatformInterface.verifyToken(instance, _token);
|
||||
_instance = instance;
|
||||
@@ -28,8 +51,9 @@ abstract class ThermionFlutterPlatform extends PlatformInterface {
|
||||
///
|
||||
///
|
||||
///
|
||||
Future<ThermionViewer> createViewer(
|
||||
{covariant ThermionFlutterOptions? options});
|
||||
Future<ThermionViewer> createViewer() {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
///
|
||||
/// Creates a raw rendering surface.
|
||||
@@ -38,12 +62,16 @@ abstract class ThermionFlutterPlatform extends PlatformInterface {
|
||||
/// call this yourself. May not be supported on all platforms.
|
||||
///
|
||||
Future<PlatformTextureDescriptor> createTextureDescriptor(
|
||||
int width, int height);
|
||||
int width, int height) {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
///
|
||||
/// Destroys a raw rendering surface.
|
||||
///
|
||||
Future destroyTextureDescriptor(PlatformTextureDescriptor descriptor);
|
||||
Future destroyTextureDescriptor(PlatformTextureDescriptor descriptor) {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
///
|
||||
/// Create a rendering surface and binds to the given [View]
|
||||
@@ -52,17 +80,23 @@ abstract class ThermionFlutterPlatform extends PlatformInterface {
|
||||
/// call this yourself. May not be supported on all platforms.
|
||||
///
|
||||
Future<PlatformTextureDescriptor?> createTextureAndBindToView(
|
||||
View view, int width, int height);
|
||||
View view, int width, int height) {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
///
|
||||
Future<PlatformTextureDescriptor?> resizeTexture(
|
||||
PlatformTextureDescriptor texture, View view, int width, int height);
|
||||
PlatformTextureDescriptor texture, View view, int width, int height) {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
Future markTextureFrameAvailable(PlatformTextureDescriptor texture);
|
||||
Future markTextureFrameAvailable(PlatformTextureDescriptor texture) {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user