Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][native_video_editor] Remove unused preview widget

Prateek Sunalead7d8084d58
diff --git a/mobile/packages/native_video_editor/lib/src/video_preview_widget.dart b/mobile/packages/native_video_editor/lib/src/video_preview_widget.dart
deleted file mode 100644
index 535b1fdcac..0000000000
--- a/mobile/packages/native_video_editor/lib/src/video_preview_widget.dart
+++ /dev/null
@@ -1,111 +0,0 @@
-import 'dart:io';
-
-import 'package:flutter/material.dart';
-import 'package:logging/logging.dart';
-import 'package:native_video_editor/native_video_editor.dart';
-import 'package:video_editor/video_editor.dart';
-
-/// A wrapper widget that properly handles video preview with rotation correction
-/// on Android, maintaining the correct aspect ratio.
-class NativeVideoPreview extends StatefulWidget {
- final VideoEditorController controller;
- final int? quarterTurnsForRotationCorrection;
-
- const NativeVideoPreview({
- Key? key,
- required this.controller,
- this.quarterTurnsForRotationCorrection,
- }) : super(key: key);
-
- @override
- State<NativeVideoPreview> createState() => _NativeVideoPreviewState();
-}
-
-class _NativeVideoPreviewState extends State<NativeVideoPreview> {
- final _logger = Logger('NativeVideoPreview');
- bool _isLoading = true;
-
- @override
- void initState() {
- super.initState();
- _loadVideoInfo();
- }
-
- Future<void> _loadVideoInfo() async {
- if (Platform.isAndroid) {
- try {
- // Validate rotation metadata from native code
- // This ensures the rotation correction is needed
- final videoPath = widget.controller.file.path;
- final videoInfo = await NativeVideoEditor.getVideoInfo(videoPath);
-
- final rotation = videoInfo['rotation'] as int? ?? 0;
- final needsDimensionSwap = rotation == 90 ||
- rotation == 270 ||
- rotation == -90 ||
- rotation == -270;
-
- _logger.info(
- 'NativeVideoPreview - Video info from native: '
- 'width=${videoInfo['width']}, height=${videoInfo['height']}, '
- 'rotation=${videoInfo['rotation']} '
- '${needsDimensionSwap ? "(dimensions swapped for display due to rotation)" : ""}',
- );
- _logger.info(
- 'NativeVideoPreview - Controller video: '
- 'width=${widget.controller.video.value.size.width}, '
- 'height=${widget.controller.video.value.size.height}',
- );
- _logger.info(
- 'NativeVideoPreview - quarterTurnsForRotationCorrection=${widget.quarterTurnsForRotationCorrection}',
- );
-
- // The controller already has the correct aspect ratio from FFProbeProps
- // which handles rotation internally. We only apply visual rotation correction.
-
- setState(() {
- _isLoading = false;
- });
- } catch (e) {
- // Failed to get video info, fallback to default behavior
- _logger.warning('Failed to get video info: $e');
- setState(() {
- _isLoading = false;
- });
- }
- } else {
- setState(() {
- _isLoading = false;
- });
- }
- }
-
- @override
- Widget build(BuildContext context) {
- if (widget.quarterTurnsForRotationCorrection != null &&
- widget.quarterTurnsForRotationCorrection != 0) {
- final controllerWidth = widget.controller.video.value.size.width;
- final controllerHeight = widget.controller.video.value.size.height;
-
- final displayWidth = controllerHeight;
- final displayHeight = controllerWidth;
-
- _logger.info(
- 'NativeVideoPreview build - '
- 'quarterTurns=${widget.quarterTurnsForRotationCorrection}, '
- 'Controller: ${controllerWidth}x${controllerHeight}, '
- 'Display: ${displayWidth}x${displayHeight}',
- );
-
- return RotatedBox(
- quarterTurns: widget.quarterTurnsForRotationCorrection!,
- child: CropGridViewer.preview(
- controller: widget.controller,
- overrideWidth: displayWidth,
- overrideHeight: displayHeight,
- ),
- );
- }
- return CropGridViewer.preview(controller: widget.controller);
- }
-}
diff --git a/mobile/packages/native_video_editor/pubspec.lock b/mobile/packages/native_video_editor/pubspec.lock
index cf6f8f6ba3..576da48fc4 100644
--- a/mobile/packages/native_video_editor/pubspec.lock
+++ b/mobile/packages/native_video_editor/pubspec.lock
@@ -41,14 +41,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.19.1"
- csslib:
- dependency: transitive
- description:
- name: csslib
- sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e"
- url: "https://pub.dev"
- source: hosted
- version: "1.0.2"
fake_async:
dependency: transitive
description:
@@ -57,14 +49,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.3"
- ffi:
- dependency: transitive
- description:
- name: ffi
- sha256: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418"
- url: "https://pub.dev"
- source: hosted
- version: "2.1.4"
flutter:
dependency: "direct main"
description: flutter
@@ -83,19 +67,6 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
- flutter_web_plugins:
- dependency: transitive
- description: flutter
- source: sdk
- version: "0.0.0"
- html:
- dependency: transitive
- description:
- name: html
- sha256: "6d1264f2dffa1b1101c25a91dff0dc2daee4c18e87cd8538729773c073dbf602"
- url: "https://pub.dev"
- source: hosted
- version: "0.15.6"
leak_tracker:
dependency: transitive
description:
@@ -128,14 +99,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.1"
- logging:
- dependency: "direct main"
- description:
- name: logging
- sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61
- url: "https://pub.dev"
- source: hosted
- version: "1.3.0"
matcher:
dependency: transitive
description:
@@ -168,70 +131,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.9.1"
- path_provider:
- dependency: transitive
- description:
- name: path_provider
- sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd"
- url: "https://pub.dev"
- source: hosted
- version: "2.1.5"
- path_provider_android:
- dependency: transitive
- description:
- name: path_provider_android
- sha256: "993381400e94d18469750e5b9dcb8206f15bc09f9da86b9e44a9b0092a0066db"
- url: "https://pub.dev"
- source: hosted
- version: "2.2.18"
- path_provider_foundation:
- dependency: transitive
- description:
- name: path_provider_foundation
- sha256: "16eef174aacb07e09c351502740fa6254c165757638eba1e9116b0a781201bbd"
- url: "https://pub.dev"
- source: hosted
- version: "2.4.2"
- path_provider_linux:
- dependency: transitive
- description:
- name: path_provider_linux
- sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279
- url: "https://pub.dev"
- source: hosted
- version: "2.2.1"
- path_provider_platform_interface:
- dependency: transitive
- description:
- name: path_provider_platform_interface
- sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334"
- url: "https://pub.dev"
- source: hosted
- version: "2.1.2"
- path_provider_windows:
- dependency: transitive
- description:
- name: path_provider_windows
- sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7
- url: "https://pub.dev"
- source: hosted
- version: "2.3.0"
- platform:
- dependency: transitive
- description:
- name: platform
- sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984"
- url: "https://pub.dev"
- source: hosted
- version: "3.1.6"
- plugin_platform_interface:
- dependency: "direct main"
- description:
- name: plugin_platform_interface
- sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
- url: "https://pub.dev"
- source: hosted
- version: "2.1.8"
sky_engine:
dependency: transitive
description: flutter
@@ -285,14 +184,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.7.4"
- transparent_image:
- dependency: transitive
- description:
- name: transparent_image
- sha256: e8991d955a2094e197ca24c645efec2faf4285772a4746126ca12875e54ca02f
- url: "https://pub.dev"
- source: hosted
- version: "2.0.1"
vector_math:
dependency: transitive
description:
@@ -301,63 +192,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.4"
- video_editor:
- dependency: "direct main"
- description:
- path: "."
- ref: master
- resolved-ref: "1eeb18e2b1ce36bd8ca70178c0d4b485e9982257"
- url: "https://github.com/ente-io/video_editor_fork.git"
- source: git
- version: "3.0.0"
- video_player:
- dependency: transitive
- description:
- name: video_player
- sha256: "0d55b1f1a31e5ad4c4967bfaa8ade0240b07d20ee4af1dfef5f531056512961a"
- url: "https://pub.dev"
- source: hosted
- version: "2.10.0"
- video_player_android:
- dependency: transitive
- description:
- name: video_player_android
- sha256: "59e5a457ddcc1688f39e9aef0efb62aa845cf0cbbac47e44ac9730dc079a2385"
- url: "https://pub.dev"
- source: hosted
- version: "2.8.13"
- video_player_avfoundation:
- dependency: transitive
- description:
- name: video_player_avfoundation
- sha256: f9a780aac57802b2892f93787e5ea53b5f43cc57dc107bee9436458365be71cd
- url: "https://pub.dev"
- source: hosted
- version: "2.8.4"
- video_player_platform_interface:
- dependency: transitive
- description:
- name: video_player_platform_interface
- sha256: cf2a1d29a284db648fd66cbd18aacc157f9862d77d2cc790f6f9678a46c1db5a
- url: "https://pub.dev"
- source: hosted
- version: "6.4.0"
- video_player_web:
- dependency: transitive
- description:
- name: video_player_web
- sha256: "9f3c00be2ef9b76a95d94ac5119fb843dca6f2c69e6c9968f6f2b6c9e7afbdeb"
- url: "https://pub.dev"
- source: hosted
- version: "2.4.0"
- video_thumbnail:
- dependency: transitive
- description:
- name: video_thumbnail
- sha256: "181a0c205b353918954a881f53a3441476b9e301641688a581e0c13f00dc588b"
- url: "https://pub.dev"
- source: hosted
- version: "0.5.6"
vm_service:
dependency: transitive
description:
@@ -366,22 +200,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "15.0.0"
- web:
- dependency: transitive
- description:
- name: web
- sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a"
- url: "https://pub.dev"
- source: hosted
- version: "1.1.1"
- xdg_directories:
- dependency: transitive
- description:
- name: xdg_directories
- sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15"
- url: "https://pub.dev"
- source: hosted
- version: "1.1.0"
sdks:
- dart: ">=3.7.0 <4.0.0"
- flutter: ">=3.29.0"
+ dart: ">=3.7.0-0 <4.0.0"
+ flutter: ">=3.18.0-18.0.pre.54"
diff --git a/mobile/packages/native_video_editor/pubspec.yaml b/mobile/packages/native_video_editor/pubspec.yaml
index 3d9b99308d..a77a85e58d 100644
--- a/mobile/packages/native_video_editor/pubspec.yaml
+++ b/mobile/packages/native_video_editor/pubspec.yaml
@@ -2,6 +2,7 @@ name: native_video_editor
description: Native video editing operations for trim, crop, and rotate without re-encoding
version: 1.0.0
homepage: https://github.com/ente-io/ente
+publish_to: none
environment:
sdk: ">=2.17.0 <4.0.0"
@@ -10,17 +11,11 @@ environment:
dependencies:
flutter:
sdk: flutter
- plugin_platform_interface: ^2.0.0
- logging: ^1.2.0
- video_editor:
- git:
- url: https://github.com/ente-io/video_editor_fork.git
- ref: master
dev_dependencies:
+ flutter_lints: ^2.0.0
flutter_test:
sdk: flutter
- flutter_lints: ^2.0.0
flutter:
plugin: