-
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wasm): replace
dart:html
and dart:js
with package:web
and …
…`dart:js_interop` for WebAssembly support (#304) * feat(video): begin implementation of video combine example - Created the initial setup for the video combine feature - Added `combine_video_editor_example.dart` to handle the main logic - Introduced utility for video image elements in `video_image_element.dart` - Added widgets for video editing pages and media picking - Included a bottom bar widget for video sending functionality Note: The implementation is not yet complete. * Merge branch 'stable' of https://github.com/hm21/pro_image_editor into dev * feat(examples): add download button functionality - Added a download button to enhance usability in example pages. - Updated `main.dart` and relevant pages to support the feature. - Removed unused video-related files and widgets to streamline the codebase. - Updated generated files and configurations in `linux`, `macOS`, and `Windows` to reflect changes. * fix(zoom): correct layer rotation calculation during user drag Resolved an issue where the layer rotation was calculated incorrectly when the user dragged the rotation button. Resolve #266 * Merge branch 'stable' into dev * Merge branch 'stable' of https://github.com/hm21/pro_image_editor into dev * fix(merge): resolve conflicts during stable to dev merge Resolved merge conflicts in `preview_img.dart` and `zoom_example.dart` while merging changes from the `stable` branch into the `dev` branch. * feat(wasm): replace `dart:html` and `dart:js` with `package:web` and `dart:js_interop` for WebAssembly support - Updated dependencies in `pubspec.yaml` to use `package:web` and `dart:js_interop`. - Added new constants in `editor_web_constants.dart`. - Refactored threading logic in `thread_request_model.dart`, `web_worker_manager.dart`, and related files to enable WebAssembly support. - Introduced `web_worker.dart.wasm` and related files for WebAssembly integration. - Updated image utilities (`convert_raw_image.dart`, `encode_image.dart`) for compatibility. - Adjusted configurations in `analysis_options.yaml` and added relevant changes to `CHANGELOG.md`. These changes enable better performance and compatibility for WebAssembly (Wasm). * Merge remote-tracking branch 'origin/stable' into dev
- Loading branch information
Showing
23 changed files
with
5,894 additions
and
6,471 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/// The URL of the web worker script. | ||
/// | ||
/// This URL points to the JavaScript file that will be loaded by the | ||
/// [web.Worker] instance to run the web worker's code. | ||
const kImageEditorWebWorkerPath = | ||
'assets/packages/pro_image_editor/lib/web/web_worker.dart.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
lib/utils/content_recorder.dart/threads_managers/web_worker/web_utils.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import 'dart:js_interop'; | ||
import 'dart:typed_data'; | ||
|
||
/// Returns Dart representation from JS Object. | ||
dynamic dartify(dynamic object) { | ||
// Convert JSObject to Dart equivalents directly | ||
// Cannot be done with Dart 3.2 constraints | ||
// ignore: invalid_runtime_check_with_js_interop_types | ||
if (object is! JSObject) { | ||
return object; | ||
} | ||
|
||
final jsObject = object; | ||
|
||
// Convert nested structures | ||
final dartObject = jsObject.dartify(); | ||
return convertNested(dartObject); | ||
} | ||
|
||
/// Convert nested objects | ||
dynamic convertNested(dynamic object) { | ||
if (object is ByteBuffer) { | ||
return object; | ||
} else if (object is List) { | ||
return object.map(convertNested).toList(); | ||
} else if (object is Map) { | ||
var map = <dynamic, dynamic>{}; | ||
object.forEach((key, value) { | ||
map[key] = convertNested(value); | ||
}); | ||
return map; | ||
} else { | ||
// For non-nested types, attempt to convert directly | ||
return dartify(object); | ||
} | ||
} | ||
|
||
/// Returns the JS implementation from Dart Object. | ||
JSAny? jsify(Object? dartObject) { | ||
if (dartObject == null) { | ||
return dartObject?.jsify(); | ||
} | ||
|
||
if (dartObject is List) { | ||
return dartObject.map(jsify).toList().toJS; | ||
} | ||
|
||
if (dartObject is Map) { | ||
return dartObject | ||
.map((key, value) => MapEntry(jsify(key), jsify(value))) | ||
.jsify(); | ||
} | ||
|
||
if (dartObject is JSAny Function()) { | ||
return dartObject.toJS; | ||
} | ||
|
||
return dartObject.jsify(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.