Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[web] Migrate Flutter Web to JS static interop - 2. #32427

Merged
merged 1 commit into from
Apr 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions lib/web_ui/lib/src/engine/canvaskit/canvaskit_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ typedef LocateFileCallback = String Function(String file, String unusedBase);

@JS()
@anonymous
@staticInterop
class CanvasKitInitOptions {
external factory CanvasKitInitOptions({
required LocateFileCallback locateFile,
Expand All @@ -179,7 +180,10 @@ class CanvasKitInitOptions {
typedef CanvasKitInitCallback = void Function(CanvasKit canvasKit);

@JS()
class CanvasKitInitPromise {
@staticInterop
class CanvasKitInitPromise {}

extension CanvasKitInitPromiseExtension on CanvasKitInitPromise {
external void then(CanvasKitInitCallback callback);
}

Expand All @@ -191,6 +195,7 @@ class ColorSpace {}

@JS()
@anonymous
@staticInterop
class SkWebGLContextOptions {
external factory SkWebGLContextOptions({
required int antialias,
Expand All @@ -200,7 +205,10 @@ class SkWebGLContextOptions {
}

@JS('window.flutterCanvasKit.Surface')
class SkSurface {
@staticInterop
class SkSurface {}

extension SkSurfaceExtension on SkSurface {
external SkCanvas getCanvas();
external void flush();
external int width();
Expand All @@ -210,8 +218,10 @@ class SkSurface {
}

@JS()
@anonymous
class SkGrContext {
@staticInterop
class SkGrContext {}

extension SkGrContextExtension on SkGrContext {
external void setResourceCacheLimitBytes(int limit);
external void releaseResourcesAndAbandonContext();
external void delete();
Expand Down