feat: add ThermionFlutterOptions classes, rename interface parameter for offsetTop and ensure pixelRatio is passed to resizeTexture

This commit is contained in:
Nick Fisher
2024-09-05 17:43:04 +08:00
parent 683105c4f7
commit abe6e1fcb8
2 changed files with 22 additions and 5 deletions

View File

@@ -4,6 +4,12 @@ import 'package:thermion_dart/thermion_dart/thermion_viewer.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import 'thermion_flutter_texture.dart'; import 'thermion_flutter_texture.dart';
abstract class ThermionFlutterOptions {
final String? uberarchivePath;
ThermionFlutterOptions({this.uberarchivePath});
}
abstract class ThermionFlutterPlatform extends PlatformInterface { abstract class ThermionFlutterPlatform extends PlatformInterface {
ThermionFlutterPlatform() : super(token: _token); ThermionFlutterPlatform() : super(token: _token);
@@ -17,14 +23,17 @@ abstract class ThermionFlutterPlatform extends PlatformInterface {
_instance = instance; _instance = instance;
} }
Future<ThermionViewer> createViewer({String? uberArchivePath}); Future<ThermionViewer> createViewerWithOptions(
covariant ThermionFlutterOptions options);
Future<ThermionFlutterTexture?> createTexture( @deprecated
double width, double height, double offsetLeft, double offsetRight, double pixelRatio); Future<ThermionViewer> createViewer({String? uberarchivePath});
Future<ThermionFlutterTexture?> createTexture(double width, double height,
double offsetLeft, double offsetTop, double pixelRatio);
Future destroyTexture(ThermionFlutterTexture texture); Future destroyTexture(ThermionFlutterTexture texture);
Future<ThermionFlutterTexture?> resizeTexture(ThermionFlutterTexture texture, Future<ThermionFlutterTexture?> resizeTexture(ThermionFlutterTexture texture,
int width, int height, int offsetLeft, int offsetRight); int width, int height, int offsetTop, int offsetRight, double pixelRatio);
} }

View File

@@ -0,0 +1,8 @@
import 'package:thermion_flutter_platform_interface/thermion_flutter_platform_interface.dart';
class ThermionFlutterWebOptions extends ThermionFlutterOptions {
bool createCanvas;
bool importCanvasAsWidget;
ThermionFlutterWebOptions({this.importCanvasAsWidget = false, this.createCanvas = true, String? uberarchivePath}) : super(uberarchivePath:uberarchivePath);
}