Compare commits
No files matched your search
+11
-5
@@ -3,18 +3,24 @@
|
||||
# Values are literal: no shell commands, interpolation or escape expansion.
|
||||
# Use quotes for spaces; Windows paths may use / or literal backslashes.
|
||||
|
||||
# Windows native source development (requires Rust and FFMPEG_DIR).
|
||||
# CUTDEX_WINDOWS_PATH=D:/workspace/cutdex_windows
|
||||
# Default: consume exact platform releases from cutdex_native_flutter/native-dependencies.json.
|
||||
# Explicit pinned releases: CUTDEX_NATIVE_BUILD_MODE=artifacts (clear source overrides).
|
||||
# CUTDEX_NATIVE_BUILD_MODE=source
|
||||
|
||||
# Optional Windows native source override. Rustup/LLVM must be installed;
|
||||
# the plugin prepares the pinned Rust target and FFmpeg SDK automatically.
|
||||
# CUTDEX_WINDOWS_PATH=D:/workspace/cutdex-windows
|
||||
# FFMPEG_DIR=D:/tools/ffmpeg
|
||||
|
||||
# Alternatively, use an extracted Windows native package. Choose only one path.
|
||||
# Artifacts mode only: use an extracted Windows native package.
|
||||
# CUTDEX_WINDOWS_PACKAGE_PATH=D:/packages/cutdex-windows
|
||||
# CUTDEX_WINDOWS_PACKAGE_SHA256=<verified Windows release ZIP digest>
|
||||
|
||||
# macOS / iOS native source development.
|
||||
# CUTDEX_APPLE_PATH=/Users/your-name/workspace/cutdex_apple
|
||||
# CUTDEX_APPLE_PATH=/Users/your-name/workspace/CutdexApple
|
||||
|
||||
# Android native source development (Gradle composite build).
|
||||
# CUTDEX_ANDROID_PATH=D:/workspace/cutdex-project/cutdex_android
|
||||
# CUTDEX_ANDROID_PATH=D:/workspace/cutdex-project/cutdex-android
|
||||
|
||||
# Optional processing workers directory.
|
||||
# CUTDEX_PROCESSING_ROOT=D:/packages/cutdex-processing
|
||||
|
||||
@@ -1,9 +1,28 @@
|
||||
# Gitea Windows and Android builds
|
||||
|
||||
The Windows x64 host runner needs the Flutter version pinned in `.fvmrc`, Python, Node, Visual Studio C++,
|
||||
JDK 21 and Android SDK 36. The native cutdex_windows Release and cutdex_android
|
||||
Maven packages must be published before building this app. The SDK Git dependency
|
||||
is pinned to Gitea; the runner account needs SSH access to that private repository.
|
||||
JDK 21 and Android SDK 36. `dependencies.json` fixes the Core release version,
|
||||
source commit and source ZIP SHA256, together with its bundled native Flutter
|
||||
version and commit. `.gitea/actions/prepare-flutter` downloads that published Core
|
||||
archive and verifies its SHA256 and `RELEASE.json` before extracting a job-local
|
||||
`.dependencies/cutdex_core`. The app and preview package both use its
|
||||
`native_flutter` directory, so Pub resolves one integration source.
|
||||
Core is hosted at `lingjhf/cutdex_core`; Flutter integration is hosted at
|
||||
`cutdex-native/cutdex_native_flutter`. Local source development uses the ignored
|
||||
`pubspec_overrides.yaml` sibling overrides. Release CI does not follow branches or
|
||||
need platform repository checkout steps.
|
||||
|
||||
Production Android/Windows CI defaults to `CUTDEX_NATIVE_BUILD_MODE=artifacts` and
|
||||
consumes the exact platform versions and Windows archive digest recorded by the
|
||||
Flutter integration. Set the repository variable to `source` only for development CI;
|
||||
that mode lets the Flutter integration fetch the platform's locked SHA during the
|
||||
build. Android uses its single Settings hook; Windows automatically prepares the
|
||||
pinned Rust toolchain/target and verified FFmpeg SDK, then links and bundles DLLs.
|
||||
Applications do not need platform checkout steps or `FFMPEG_DIR`. Source-mode
|
||||
hosts need Git, Python 3.11+, Rustup/LLVM for Windows and NDK/CMake/MSYS2 for Android.
|
||||
`CUTDEX_NATIVE_SOURCE_TOKEN` reads private Gitea platform source repositories;
|
||||
`CUTDEX_NATIVE_SOURCE_SERVER_URL` selects the runner-reachable checkout server.
|
||||
Platform publication and Flutter integration CI are owned by their independent repositories.
|
||||
|
||||
Set CUTDEX_GITEA_TOKEN in repository Actions Secrets with repository read and
|
||||
package read access. It authenticates private Gitea native package downloads.
|
||||
@@ -11,7 +30,7 @@ The Android APK includes ARM64 and x86_64, uses the production flavor and curren
|
||||
uses the project's debug signing configuration. Configure formal signing before
|
||||
shipping a production signed Android release. The Windows ZIP includes the whole
|
||||
Flutter Release directory and passes the PE dependency audit. Processing workers
|
||||
and optional models are separate; these four repositories contain no worker bundle.
|
||||
and optional models are distributed separately; these workflows do not bundle them.
|
||||
|
||||
CI and local checks share `tool/check.py` suites for analysis, app/package tests
|
||||
and repository/tool tests. Local tooling loads `.env.local` with the project FVM
|
||||
|
||||
@@ -109,6 +109,12 @@ CI artifact ZIP download requests retain the loopback Host instead: Gitea return
|
||||
a signed redirect to the raw archive, and its Host must remain local for that
|
||||
second request to avoid the public tunnel. Release attachment links stay public.
|
||||
|
||||
Core source archives are cached by their pinned SHA256 under the runner user's
|
||||
`.cache/cutdex/core`. Every use verifies the bytes and both dependency identities;
|
||||
the archive is freshly extracted into each job's workspace. Native Flutter is
|
||||
bundled with Core and reused from that one source directory. No application build
|
||||
outputs or package configurations are shared between jobs.
|
||||
|
||||
Compare warm CI runs after the first cache fill. Measure checks, Android compile,
|
||||
Windows compile, packaging and artifact transfer separately. Total duration follows
|
||||
the slower platform branch, plus checks and final assembly; no fixed speedup is
|
||||
|
||||
@@ -7,6 +7,9 @@ inputs:
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Prepare verified Core source release
|
||||
shell: pwsh
|
||||
run: python tool/gitea/prepare_dependencies.py
|
||||
- name: Configure persistent build caches
|
||||
shell: pwsh
|
||||
run: ./tool/gitea/prepare-build-cache.ps1
|
||||
|
||||
+16
-1
@@ -14,7 +14,9 @@ concurrency:
|
||||
env:
|
||||
CI: 'true'
|
||||
PYTHONUTF8: '1'
|
||||
CUTDEX_NATIVE_SOURCE_TOKEN: ${{ secrets.CUTDEX_NATIVE_SOURCE_TOKEN }}
|
||||
CUTDEX_GITEA_INTERNAL_URL: http://127.0.0.1:3000
|
||||
CUTDEX_NATIVE_SOURCE_SERVER_URL: http://127.0.0.1:3000
|
||||
GIT_CONFIG_COUNT: '2'
|
||||
GIT_CONFIG_KEY_0: core.autocrlf
|
||||
GIT_CONFIG_VALUE_0: 'false'
|
||||
@@ -78,10 +80,13 @@ jobs:
|
||||
$file = 'android/gradle.properties'
|
||||
$properties = [IO.File]::ReadAllText($file).Replace('-Xmx8G', '-Xmx3G').Replace('MaxMetaspaceSize=4G', 'MaxMetaspaceSize=768m')
|
||||
[IO.File]::WriteAllText($file, $properties + "`norg.gradle.workers.max=4`norg.gradle.caching=true`n")
|
||||
- uses: ./.dependencies/cutdex_core/native_flutter/.gitea/actions/setup-android
|
||||
if: vars.CUTDEX_NATIVE_BUILD_MODE == 'source'
|
||||
- name: Build production Android APK
|
||||
env:
|
||||
GITEA_ACTOR: lingjhf
|
||||
run: |
|
||||
$env:CUTDEX_NATIVE_BUILD_MODE = '${{ vars.CUTDEX_NATIVE_BUILD_MODE || 'artifacts' }}'
|
||||
Remove-Item Env:CUTDEX_ANDROID_PATH -ErrorAction SilentlyContinue
|
||||
python tool/build.py android
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Android build failed.' }
|
||||
@@ -109,13 +114,23 @@ jobs:
|
||||
github-server-url: ${{ env.CUTDEX_GITEA_INTERNAL_URL }}
|
||||
- name: Prepare Flutter environment
|
||||
uses: ./.gitea/actions/prepare-flutter
|
||||
- name: Clear inherited native build overrides
|
||||
run: |
|
||||
foreach ($key in @('CUTDEX_WINDOWS_PATH', 'CUTDEX_WINDOWS_PACKAGE_PATH', 'FFMPEG_DIR', 'LIBCLANG_PATH')) {
|
||||
Remove-Item "Env:$key" -ErrorAction SilentlyContinue
|
||||
"$key=" >> $env:GITHUB_ENV
|
||||
}
|
||||
- uses: ./.dependencies/cutdex_core/native_flutter/.gitea/actions/setup-windows
|
||||
if: vars.CUTDEX_NATIVE_BUILD_MODE == 'source'
|
||||
with:
|
||||
libclang-path: ${{ vars.CUTDEX_LIBCLANG_PATH }}
|
||||
- name: Reuse verified Velopack native archive
|
||||
run: |
|
||||
python tool/windows/native_cache.py
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Windows native archive cache preparation failed.' }
|
||||
- name: Build production Windows app
|
||||
run: |
|
||||
Remove-Item Env:CUTDEX_WINDOWS_PATH, Env:CUTDEX_WINDOWS_PACKAGE_PATH -ErrorAction SilentlyContinue
|
||||
$env:CUTDEX_NATIVE_BUILD_MODE = '${{ vars.CUTDEX_NATIVE_BUILD_MODE || 'artifacts' }}'
|
||||
python tool/build.py windows
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Windows build failed.' }
|
||||
- name: Verify native SDK matches pinned packaging tools
|
||||
|
||||
@@ -105,3 +105,6 @@ pubspec_overrides.yaml
|
||||
|
||||
# FVM Version Cache
|
||||
.fvm/
|
||||
|
||||
# Core and native source checkouts prepared by CI or local development.
|
||||
.dependencies/
|
||||
@@ -17,7 +17,7 @@ Cutdex 是一款视频剪辑应用。你可以在时间线上编辑视频、音
|
||||
|
||||
## 下载与安装
|
||||
|
||||
本仓库目前尚未发布可下载的安装包。
|
||||
可从 [Gitea Releases](https://git.orangraph.com/lingjhf/cutdex/releases) 下载 Windows x64 安装包或便携包,以及 Android ARM64/x86_64 APK。当前 Android APK 使用开发签名;macOS 和 iOS 暂未提供安装包。
|
||||
|
||||
## 可以做什么
|
||||
|
||||
|
||||
@@ -7,3 +7,5 @@ Flutter/Dart 依赖及解析版本记录在 `pubspec.yaml`、内部包的 `pubsp
|
||||
应用发行包捆绑的媒体处理库、推理工具和模型遵循各自的许可与再分发要求。打包时保留随附的许可证和通知文件;不能用本仓库的 MIT 许可替代。
|
||||
|
||||
仓库中的测试不附带个人媒体或模型。新增第三方素材、字体或代码时,应一同记录来源和许可证,并保留要求的版权声明。
|
||||
|
||||
桌面属性栏使用 [Inter 4.1](https://github.com/rsms/inter/releases/tag/v4.1) 的可变字体,遵循 SIL Open Font License 1.1。原始字体与版权声明保存在 `packages/cutdex_ui/assets/fonts/InterVariable.ttf` 和 `INTER_LICENSE.txt` 中。
|
||||
@@ -13,7 +13,6 @@ analyzer:
|
||||
- windows/**
|
||||
- macos/**
|
||||
- linux/**
|
||||
- packages/*/example/**
|
||||
|
||||
plugins:
|
||||
riverpod_lint: ^3.1.9
|
||||
|
||||
@@ -25,14 +25,5 @@ plugins {
|
||||
|
||||
include(":app")
|
||||
|
||||
// Native source development is opt-in; default resolution uses Gitea Maven packages.
|
||||
val nativeAndroidPath = providers.gradleProperty("cutdex.android.path")
|
||||
.orElse(providers.environmentVariable("CUTDEX_ANDROID_PATH"))
|
||||
.orNull
|
||||
nativeAndroidPath?.takeIf { it.isNotBlank() }?.let { nativePath ->
|
||||
includeBuild(nativePath) {
|
||||
dependencySubstitution {
|
||||
substitute(module("dev.cutdex:cutdex-android")).using(project(":cutdex-android"))
|
||||
}
|
||||
}
|
||||
}
|
||||
// Register native source dependencies before Gradle creates the projects.
|
||||
apply(from = project(":cutdex_native_flutter").projectDir.resolve("native-settings.gradle"))
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"core": {
|
||||
"repository": "lingjhf/cutdex_core",
|
||||
"version": "0.0.1",
|
||||
"ref": "v0.0.1",
|
||||
"revision": "a9c245ada56536f1642b39b1370c6ec2bb1a2a13",
|
||||
"artifact": {
|
||||
"file": "cutdex-core-0.0.1.zip",
|
||||
"sha256": "9fbff6317b8e4876c423c73dc0da319fad6d96523c50878687dffdb88edde979"
|
||||
}
|
||||
},
|
||||
"nativeFlutter": {
|
||||
"repository": "cutdex-native/cutdex_native_flutter",
|
||||
"version": "0.0.1",
|
||||
"ref": "v0.0.1",
|
||||
"revision": "6349cd61676617eb1f739b37b7758a74b0a780cb"
|
||||
}
|
||||
}
|
||||
+23
-14
@@ -12,21 +12,30 @@
|
||||
|
||||
本地联调其他包时,可参考 `pubspec_overrides.yaml.example` 创建覆盖配置。覆盖文件只用于本机开发,不提交。
|
||||
|
||||
## 运行应用
|
||||
应用直接依赖 `cutdex_core` 和 `cutdex_native_flutter`,预览协调与时间线 UI 位于应用内部包。
|
||||
正式构建由 `dependencies.json` 固定 Core 的发布版本、源码提交和 ZIP SHA256,
|
||||
同时记录随 Core 分发的 Flutter 集成版本与提交。运行
|
||||
`python3 tool/gitea/prepare_dependencies.py` 后,验证的 Core 源码放到
|
||||
`.dependencies/cutdex_core`;应用及预览包共用其中的 `native_flutter`,避免重复解析两个原生集成来源。
|
||||
私有下载使用 `CUTDEX_GITEA_TOKEN`。缓存只复用校验过的 ZIP,每个 CI job 独立解压。
|
||||
|
||||
本地路径与原生包认证统一放在应用根目录的 `.env.local`。复制
|
||||
[配置示例](../.env.example),按需取消注释并填写本机路径;文件已忽略,不提交、
|
||||
不作为应用资源打包。没有配置时,SDK 使用固定版本的已发布原生包。
|
||||
Core 远端为 `lingjhf/cutdex_core`,Flutter 集成远端为 `cutdex-native/cutdex_native_flutter`。
|
||||
本地源码联调使用 `pubspec_overrides.yaml.example` 指向同级 checkout,覆盖文件不提交。
|
||||
发布 ZIP 包含 `RELEASE.json`,应用同时校验 Core 和 Flutter 集成的版本、提交及平台依赖元数据。
|
||||
|
||||
原生实现位于独立的 `CutdexApple`、`cutdex-android`、`cutdex-windows` 仓库。
|
||||
它们的开发提交和确切发布版本由 Flutter 集成的 `native-dependencies.json` 固定。
|
||||
默认 `CUTDEX_NATIVE_BUILD_MODE=artifacts` 消费发布版本;开发设置 `source` 按完整 SHA 编译。
|
||||
本地联调显式设置 `CUTDEX_APPLE_PATH`、`CUTDEX_ANDROID_PATH` 或 `CUTDEX_WINDOWS_PATH`,
|
||||
可以使用未提交修改。正式构建清除这些覆盖。
|
||||
|
||||
源码模式需要目标平台工具链;Android 通过共享 Settings 注册 composite build,
|
||||
Windows 需要 Rust、FFmpeg SDK 与 libclang,Apple 通过 SwiftPM 消费独立源码包。
|
||||
发布模式使用确切 Apple Git 版本、Android Maven 版本和 Windows Release 版本及架构摘要。
|
||||
切换模式后清理宿主生成目录并重新解析依赖。认证和具体构建说明见独立 Flutter 集成 README。
|
||||
|
||||
Windows 可用 `CUTDEX_WINDOWS_PATH` 联调本地源码(需要 Rust 和 `FFMPEG_DIR`),
|
||||
或用 `CUTDEX_WINDOWS_PACKAGE_PATH` 指定已解压的离线包,两者只选其一。
|
||||
macOS/iOS 可用 `CUTDEX_APPLE_PATH` 指定本地源码。
|
||||
Android 可用 `CUTDEX_ANDROID_PATH` 指向 `cutdex_android` 工程根目录,Gradle 会用
|
||||
本地源码替换 Maven 原生依赖;未配置或留空时使用已发布包。
|
||||
已有 Gradle 属性 `cutdex.android.path` 优先于该环境变量,显式空属性会关闭本地替换。
|
||||
`CUTDEX_PROCESSING_ROOT` 指定处理 worker 目录;Android 私有 Maven 认证可填写
|
||||
`GITEA_ACTOR` 和 `CUTDEX_GITEA_TOKEN`。这里的 `GITEA_ACTOR` 是令牌所属的认证
|
||||
账号,CI 中也按令牌账号设置,与触发工作流的用户无关。
|
||||
`GITEA_ACTOR` 和 `CUTDEX_GITEA_TOKEN`,账号应属于令牌的认证用户。
|
||||
|
||||
VS Code 的 Debug、Profile、Release 启动项与下述命令共用
|
||||
`tool/flutter_local.dart` 加载规则。VS Code 的项目 SDK 设置由 `fvm use` 自动同步,
|
||||
@@ -77,7 +86,7 @@ python3 tool/build.py android --flavor development --split-per-abi
|
||||
| 设置、诊断与更新界面 | `lib/features/settings/` |
|
||||
| 桌面、平板与手机布局 | `lib/app/shells/` |
|
||||
|
||||
应用根目录是 Pub workspace。[cutdex_ui](../packages/cutdex_ui/README.md) 维护通用组件与基础主题,[cutdex_native](../packages/cutdex_native/README.md) 维护设备信息与桌面交互。应用集成入口在 `lib/integrations/`,共享布局与业务样式在 `lib/shared/`。
|
||||
应用根目录是 Pub workspace。`packages/cutdex_preview` 持有预览协调与画布交互,`packages/cutdex_timeline_ui` 持有时间线 UI 和示例;正式编辑计划由 core 统一编译与同步。[cutdex_ui](../packages/cutdex_ui/README.md) 维护通用组件与基础主题,[cutdex_native](../packages/cutdex_native/README.md) 维护设备信息与桌面交互。应用集成入口在 `lib/integrations/`,共享布局与业务样式在 `lib/shared/`。
|
||||
|
||||
修改剪辑操作时,检查预览、保存、撤销和重做;修改素材导入时,检查文件访问及项目重新打开后的可用性;修改后台任务时,检查完成、失败和取消后的界面状态。
|
||||
|
||||
@@ -103,7 +112,7 @@ python3 tool/build.py android --flavor development --split-per-abi
|
||||
额外 Flutter 参数放在 `--` 后。仅构建 macOS 应用时使用此入口;完整 ZIP/DMG
|
||||
打包、processing 嵌入、签名和公证使用 `build_macos_release.py`。
|
||||
|
||||
环境文件合并时进程变量优先,包括空值。原生构建仍遵循所属 SDK 的覆盖规则:
|
||||
环境文件合并时进程变量优先,包括空值。原生构建仍遵循 `cutdex_native_flutter` 的覆盖规则:
|
||||
Android Gradle 属性先于环境变量;Windows CMake 已缓存的非空路径先于环境变量,
|
||||
修改后需 clean;processing 的非空 Dart define 先于进程环境,再使用随包默认路径。
|
||||
`CUTDEX_GITEA_TOKEN` 用于依赖访问,Release 的 `GITEA_TOKEN` 用于发布和 CI 产物读取。
|
||||
|
||||
@@ -49,3 +49,17 @@ fvm dart tool/flutter_local.dart test test/generated_code_test.dart test/localiz
|
||||
普通测试中的可选真实模型回归使用环境变量:`CUTDEX_ACCEPTANCE_LIVE` 和 `CUTDEX_BEAT_LIVE` 指向对应测试的配置 JSON,`CUTDEX_ASR_FIXTURE` 指定语音素材。配置字段以测试读取代码为准,素材、模型及凭据放在仓库外。
|
||||
|
||||
记录实际运行的平台、输入、失败和跳过原因。缺少模型、设备或素材时明确跳过;失败先核对夹具与当前契约,不通过放宽断言或无条件跳过掩盖问题。
|
||||
|
||||
## 应用持有的编辑 UI
|
||||
|
||||
迁入的预览协调和时间线 UI 与应用一起验证:
|
||||
|
||||
```sh
|
||||
flutter test --no-pub packages/cutdex_preview/test packages/cutdex_timeline_ui/test packages/cutdex_timeline_ui/example/test
|
||||
```
|
||||
|
||||
这两个包及时间线示例的测试由 `tool/check.py --suite flutter` 自动纳入常规 CI;示例源码也纳入静态分析。示例从时间 `0` 开始,测试手势通过实际视口和片段布局计算位置,并验证命中目标。裁剪的逐帧预览需先 `pump` 再断言;选择、提交、撤销与重做仍验证明确的编辑结果和版本。
|
||||
|
||||
core 的编译、求值、同步和编辑业务测试在 core 仓库使用 Dart VM 运行;native Flutter 的平台适配测试仍在 native 仓库。
|
||||
|
||||
应用及 UI 包的生产源码不得持有 `cutdex_runtime` 通道;原生媒体通信通过 `cutdex_native_flutter` 的公共接口进入内部 transport。`tool/check_package_boundaries.py` 检查通道名称,测试可以保留 wire mock,应用自己的窗口与生命周期通道仍由应用管理。性能诊断使用已有原生会话的 `previewDiagnostics()`,应用只负责采样、计时校准与报告。
|
||||
@@ -56,8 +56,7 @@ fvm dart tool/flutter_local.dart drive --profile --flavor development -d DEVICE_
|
||||
--dart-define=CUTDEX_TEST_REPORT=/data/user/0/com.example.cutdex.dev/files/cutdex-validation/results.json
|
||||
```
|
||||
|
||||
The pinned SDK uses the published Android 0.1.3 Maven artifacts. Use explicit SDK
|
||||
and Android source overrides only when comparing unpublished changes. Calibration
|
||||
The Flutter adapter uses the Android Maven version pinned in its `native-dependencies.json` by default. For unpublished changes, select `CUTDEX_NATIVE_BUILD_MODE=source` and set `CUTDEX_ANDROID_PATH` to the local native checkout. Calibration
|
||||
requires a `--debug` build; profile/production hosts do not register its channel.
|
||||
UI timing ends at the
|
||||
target workspace's post-frame callback. Native diagnostics record queued output
|
||||
|
||||
@@ -11,13 +11,13 @@ import 'package:cutdex/persistence/app_database.dart';
|
||||
import 'package:cutdex/workspace/project_state.dart';
|
||||
import 'package:cutdex/workspace/projects.dart';
|
||||
import 'package:cutdex/workspace/timeline_provider.dart';
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/preview.dart';
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_sdk/timeline/layout.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_sdk/timeline_ui.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:cutdex_core/timeline/layout.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -7,8 +7,8 @@ import 'package:cutdex/workspace/external_media_import.dart';
|
||||
import 'package:cutdex/workspace/media_import.dart';
|
||||
import 'package:cutdex/workspace/persistence/project_workspace.dart';
|
||||
import 'package:cutdex/workspace/persistence/timeline_creation_names.dart';
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:integration_test/integration_test.dart';
|
||||
|
||||
@@ -11,13 +11,13 @@ import 'package:cutdex/persistence/app_database.dart';
|
||||
import 'package:cutdex/workspace/project_state.dart';
|
||||
import 'package:cutdex/workspace/projects.dart';
|
||||
import 'package:cutdex/workspace/timeline_provider.dart';
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/preview.dart';
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_sdk/timeline/layout.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_sdk/timeline_ui.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:cutdex_core/timeline/layout.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -16,12 +16,14 @@ import 'package:cutdex/workspace/projects.dart';
|
||||
import 'package:cutdex/workspace/preview_controller_registry.dart';
|
||||
import 'package:cutdex/workspace/timeline_provider.dart';
|
||||
import 'package:cutdex_native/cutdex_native.dart';
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_sdk/timeline/engine.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_core/execution.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:cutdex_core/timeline/engine.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:integration_test/integration_test.dart';
|
||||
@@ -215,7 +217,12 @@ void main() {
|
||||
try {
|
||||
info = await runtime.probe(media);
|
||||
} catch (_) {
|
||||
final raw = await runtime.invoke('probe', {'media': media.toMap()});
|
||||
// This diagnostic test deliberately inspects the native wire response.
|
||||
final raw = await const MethodChannel('cutdex_runtime')
|
||||
.invokeMethod<Object?>('probe', {
|
||||
'contractVersion': 1,
|
||||
'media': media.toMap(),
|
||||
});
|
||||
result['rawProbeMetadata'] = raw;
|
||||
// Preserve the actual wire-contract failure in the device report.
|
||||
MediaInfo.fromMap(raw! as Map);
|
||||
|
||||
@@ -8,10 +8,11 @@ import 'package:cutdex/workspace/timeline_provider.dart';
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
import 'package:cutdex/features/preview/preview_panel.dart';
|
||||
import 'package:cutdex_sdk/preview.dart';
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_core/execution.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
@@ -15,8 +15,8 @@ import 'package:cutdex/persistence/app_database.dart';
|
||||
import 'package:cutdex/workspace/media_file_extensions.dart';
|
||||
import 'package:cutdex/workspace/preview_target.dart';
|
||||
import 'package:cutdex/workspace/projects.dart';
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
@@ -19,10 +19,10 @@ import 'package:cutdex/workspace/media_file_extensions.dart';
|
||||
import 'package:cutdex/workspace/preview_target.dart';
|
||||
import 'package:cutdex/workspace/projects.dart';
|
||||
import 'package:cutdex/workspace/timeline_provider.dart';
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_sdk/timeline/layout.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:cutdex_core/timeline/layout.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -13,11 +13,11 @@ import 'package:cutdex/l10n/app_localizations.dart';
|
||||
import 'package:cutdex/persistence/app_database.dart';
|
||||
import 'package:cutdex/workspace/timeline_provider.dart';
|
||||
import 'package:cutdex/workspace/timeline_session.dart';
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/preview.dart';
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -6,11 +6,12 @@ import 'package:cutdex/workspace/persistence/project_workspace.dart';
|
||||
import 'package:cutdex/workspace/project_state.dart';
|
||||
import 'package:cutdex/workspace/projects.dart';
|
||||
import 'package:cutdex/workspace/timeline_session.dart';
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/preview.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||
import 'package:cutdex_core/execution.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
@@ -4,12 +4,13 @@ import 'package:cutdex/l10n/app_localizations.dart';
|
||||
import 'dart:io';
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex/features/preview/preview_panel.dart';
|
||||
import 'package:cutdex/features/properties/picture_properties.dart';
|
||||
import 'package:cutdex_sdk/preview.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||
import 'package:cutdex_core/execution.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
@@ -7,10 +7,10 @@ import 'package:cutdex/features/preview/preview_panel.dart';
|
||||
import 'package:cutdex/persistence/app_database.dart';
|
||||
import 'package:cutdex/workspace/projects.dart';
|
||||
import 'package:cutdex/workspace/timeline_provider.dart';
|
||||
import 'package:cutdex_sdk/preview.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_sdk/timeline_ui.dart';
|
||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -8,11 +8,11 @@ import 'package:cutdex/workspace/timeline_provider.dart';
|
||||
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:cutdex_sdk/preview.dart';
|
||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||
import 'package:cutdex/features/preview/preview_panel.dart';
|
||||
import 'package:cutdex/features/properties/properties_panel.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
@@ -3,9 +3,9 @@ import '../test/support/creation_names.dart';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cutdex/workspace/persistence/project_workspace.dart';
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
|
||||
import '../test/support/processing_fixture.dart';
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ import 'dart:ui' as ui;
|
||||
|
||||
import 'package:cutdex/features/preview/preview_panel.dart';
|
||||
import 'package:cutdex/features/timeline/timeline_panel.dart';
|
||||
import 'package:cutdex_sdk/preview.dart';
|
||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||
import 'package:cutdex/integrations/runtime/timeline_thumbnails.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_sdk/timeline_ui.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
@@ -6,10 +6,10 @@ import 'dart:convert';
|
||||
import 'package:cutdex/integrations/runtime/processing_configuration.dart';
|
||||
import 'package:cutdex/workspace/persistence/project_workspace.dart';
|
||||
import 'package:cutdex/workspace/timeline_session.dart';
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/preview.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:integration_test/integration_test.dart';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'dart:math' as math;
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:flutter/painting.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
class SavedEditValidation {
|
||||
|
||||
@@ -4,9 +4,9 @@ import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cutdex/integrations/runtime/timeline_thumbnails.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_sdk/timeline/engine.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:cutdex_core/timeline/engine.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
@@ -17,11 +17,12 @@ import 'package:cutdex/workspace/media_import.dart';
|
||||
import 'package:cutdex/workspace/preview_controller_registry.dart';
|
||||
import 'package:cutdex/workspace/projects.dart';
|
||||
import 'package:cutdex/workspace/timeline_provider.dart';
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/preview.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_sdk/timeline/engine.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||
import 'package:cutdex_core/execution.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:cutdex_core/timeline/engine.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
@@ -17,10 +17,11 @@ import 'package:cutdex/workspace/media_import.dart';
|
||||
import 'package:cutdex/workspace/projects.dart';
|
||||
import 'package:cutdex/workspace/preview_controller_registry.dart';
|
||||
import 'package:cutdex/workspace/timeline_provider.dart';
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_sdk/timeline/engine.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_core/execution.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:cutdex_core/timeline/engine.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
@@ -7,10 +7,10 @@ import 'dart:math' as math;
|
||||
import 'package:cutdex/features/preview/preview_panel.dart';
|
||||
import 'package:cutdex/l10n/app_localizations.dart';
|
||||
import 'package:cutdex/workspace/timeline_provider.dart';
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/preview.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
@@ -0,0 +1,264 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:cutdex/app/app.dart';
|
||||
import 'package:cutdex/integrations/agent/conversation_repository.dart';
|
||||
import 'package:cutdex/integrations/platform/device_experience.dart';
|
||||
import 'package:cutdex/persistence/app_database.dart';
|
||||
import 'package:cutdex/persistence/settings/view_settings_repositories.dart';
|
||||
import 'package:cutdex/workspace/projects.dart';
|
||||
import 'package:cutdex/workspace/view_settings.dart';
|
||||
import 'package:cutdex/workspace/workspace_mode.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:integration_test/integration_test.dart';
|
||||
|
||||
import '../test/support/empty_conversation_repository.dart';
|
||||
import '../test/support/preview_fixture.dart';
|
||||
|
||||
/// Run with flutter drive --profile on macOS and test_driver/integration_test.dart.
|
||||
/// Define CUTDEX_RESIZE_SOURCE (an image) and CUTDEX_RESIZE_REPORT (JSON output).
|
||||
/// Widget-test timings are not comparable to these real-engine measurements.
|
||||
void main() {
|
||||
final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
||||
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;
|
||||
const source = String.fromEnvironment('CUTDEX_RESIZE_SOURCE');
|
||||
const output = String.fromEnvironment('CUTDEX_RESIZE_REPORT');
|
||||
const rounds = int.fromEnvironment('CUTDEX_RESIZE_ROUNDS', defaultValue: 3);
|
||||
const inputHz = 120;
|
||||
const inputCount = 240;
|
||||
const clipCount = 64;
|
||||
const assetCount = 100;
|
||||
|
||||
testWidgets('profile full desktop workspace split and junction dragging', (
|
||||
tester,
|
||||
) async {
|
||||
expect(kProfileMode, isTrue, reason: 'Use flutter drive --profile');
|
||||
expect(Platform.isMacOS, isTrue);
|
||||
expect(await File(source).exists(), isTrue);
|
||||
final ids = List.generate(clipCount, (i) => ElementId('clip-$i'));
|
||||
final fixture = await createPreviewFixture(
|
||||
File(source).uri,
|
||||
mediaType: 'image',
|
||||
renderSize: {'width': 1280, 'height': 720},
|
||||
timelineOverride: TimelineDto(
|
||||
id: SequenceId('one'),
|
||||
name: 'Resize profiling',
|
||||
format: TimelineFormat.fps30,
|
||||
primaryStorylineId: StorylineId('primary'),
|
||||
storylines: [StorylineDto(id: StorylineId('primary'), elementIds: ids)],
|
||||
elements: [
|
||||
for (final (i, id) in ids.indexed)
|
||||
ElementDto(
|
||||
id: id,
|
||||
name: 'Clip $i',
|
||||
structure: ElementStructure.content,
|
||||
payloadRef: PayloadRef('source'),
|
||||
duration: RationalTime.seconds(2),
|
||||
sourceRange: TimeRange(
|
||||
start: RationalTime.zero,
|
||||
duration: RationalTime.seconds(2),
|
||||
),
|
||||
mediaRange: TimeRange(
|
||||
start: RationalTime.zero,
|
||||
duration: RationalTime.seconds(2),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
for (var i = 0; i < assetCount; i++) {
|
||||
await fixture.workspace.project!.saveAsset(
|
||||
AssetDocument(
|
||||
id: i == 0 ? 'media' : 'media-$i',
|
||||
name: 'Image $i',
|
||||
storage: AssetStorage.external,
|
||||
location: File(source).uri.toString(),
|
||||
metadata: {'kind': 'image'},
|
||||
),
|
||||
);
|
||||
}
|
||||
final projectPath = '${fixture.directory.path}/Preview.cutdex';
|
||||
await fixture.workspace.close();
|
||||
final database = AppDatabase(
|
||||
NativeDatabase(File('${fixture.directory.path}/settings.sqlite')),
|
||||
);
|
||||
final workspaceWrites = _CountWorkspaceWrites(
|
||||
DriftWorkspaceViewSettingsRepository(database),
|
||||
);
|
||||
final projectWrites = _CountProjectWrites(
|
||||
DriftProjectViewSettingsRepository(database),
|
||||
);
|
||||
final container = ProviderContainer(
|
||||
overrides: [
|
||||
appDatabaseProvider.overrideWithValue(database),
|
||||
deviceExperienceProvider.overrideWithValue(DeviceExperience.desktop),
|
||||
workspaceViewSettingsRepositoryProvider.overrideWithValue(
|
||||
workspaceWrites,
|
||||
),
|
||||
projectViewSettingsRepositoryProvider.overrideWithValue(projectWrites),
|
||||
conversationRepositoryProvider.overrideWith(
|
||||
(ref) async => EmptyConversationRepository(),
|
||||
),
|
||||
],
|
||||
);
|
||||
addTearDown(() async {
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
await container.read(projectsProvider.notifier).prepareToQuit();
|
||||
container.dispose();
|
||||
await database.close();
|
||||
await fixture.directory.delete(recursive: true);
|
||||
});
|
||||
await container.read(workspaceViewSettingsProvider.future);
|
||||
container
|
||||
.read(workspaceViewSettingsProvider.notifier)
|
||||
.setMode(WorkspaceMode.cut);
|
||||
expect(
|
||||
await container.read(projectsProvider.notifier).open(projectPath),
|
||||
isTrue,
|
||||
);
|
||||
// This is the normal app/router/editor, with only isolated storage and chat.
|
||||
// ignore: riverpod_lint/provider_scope_placement
|
||||
await tester.pumpWidget(
|
||||
UncontrolledProviderScope(container: container, child: const CutdexApp()),
|
||||
);
|
||||
await const MethodChannel('cutdex_native/window')
|
||||
.invokeMethod<void>('toggleMaximize');
|
||||
final readyClock = Stopwatch()..start();
|
||||
final junction = find.byKey(const Key('desktop-chat-timeline-junction'));
|
||||
while (junction.evaluate().isEmpty) {
|
||||
if (readyClock.elapsed.inSeconds > 60) {
|
||||
throw TimeoutException('Desktop editor did not open');
|
||||
}
|
||||
await tester.pump();
|
||||
await Future<void>.delayed(const Duration(milliseconds: 16));
|
||||
}
|
||||
await Future<void>.delayed(const Duration(seconds: 3));
|
||||
final size = tester.view.physicalSize / tester.view.devicePixelRatio;
|
||||
expect(size.width, greaterThan(1100));
|
||||
final results = <String, dynamic>{
|
||||
'mode': 'profile',
|
||||
'platform': Platform.operatingSystemVersion,
|
||||
'logicalSize': [size.width, size.height],
|
||||
'pixelRatio': tester.view.devicePixelRatio,
|
||||
'displayRefreshHz': tester.view.display.refreshRate,
|
||||
'inputHz': inputHz,
|
||||
'inputsPerDrag': inputCount,
|
||||
'clips': clipCount,
|
||||
'assets': assetCount,
|
||||
'scope': 'Full app, native still-image preview, file-backed SQLite; synthetic mouse input',
|
||||
'runs': <Map<String, dynamic>>[],
|
||||
};
|
||||
final report = File(output);
|
||||
await report.parent.create(recursive: true);
|
||||
Future<void> save() => report.writeAsString(
|
||||
const JsonEncoder.withIndent(' ').convert(results),
|
||||
);
|
||||
await save();
|
||||
const scenarios = {
|
||||
'sidebar': ('project-sidebar-resize', Offset(55, 0)),
|
||||
'media': ('editor-media-resize', Offset(65, 0)),
|
||||
'timeline': ('editor-timeline-resize', Offset(0, 80)),
|
||||
'mediaJunction': ('editor-media-timeline-junction', Offset(65, 80)),
|
||||
'chatJunction': ('desktop-chat-timeline-junction', Offset(55, 80)),
|
||||
};
|
||||
for (var round = 0; round < rounds; round++) {
|
||||
for (final entry in scenarios.entries) {
|
||||
final (key, amplitude) = entry.value;
|
||||
final reportKey = '${entry.key}-$round';
|
||||
final start = tester.getCenter(find.byKey(Key(key)));
|
||||
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
|
||||
await mouse.addPointer(location: start);
|
||||
await Future<void>.delayed(const Duration(milliseconds: 250));
|
||||
final writesBefore = workspaceWrites.count;
|
||||
final projectWritesBefore = projectWrites.count;
|
||||
final dispatchTimes = <int>[];
|
||||
await binding.watchPerformance(() async {
|
||||
await mouse.down(start);
|
||||
final clock = Stopwatch()..start();
|
||||
for (var i = 1; i <= inputCount; i++) {
|
||||
final dueUs = (i * 1000000 / inputHz).round();
|
||||
final waitUs = dueUs - clock.elapsedMicroseconds;
|
||||
if (waitUs > 0) {
|
||||
await Future<void>.delayed(Duration(microseconds: waitUs));
|
||||
}
|
||||
final dispatch = Stopwatch()..start();
|
||||
await mouse.moveTo(
|
||||
start + amplitude * math.sin(2 * math.pi * i / inputCount),
|
||||
);
|
||||
dispatchTimes.add(dispatch.elapsedMicroseconds);
|
||||
}
|
||||
await mouse.up();
|
||||
await mouse.removePointer();
|
||||
}, reportKey: reportKey);
|
||||
// Allow queued persistence writes and batched engine timings to arrive.
|
||||
await Future<void>.delayed(const Duration(seconds: 1));
|
||||
final timings = Map<String, dynamic>.from(
|
||||
binding.reportData![reportKey] as Map,
|
||||
);
|
||||
final build = List<int>.from(timings['frame_build_times'] as List);
|
||||
final raster = List<int>.from(
|
||||
timings['frame_rasterizer_times'] as List,
|
||||
);
|
||||
int overBudget(int budgetUs) => List.generate(
|
||||
build.length,
|
||||
(i) => i,
|
||||
).where((i) => build[i] > budgetUs || raster[i] > budgetUs).length;
|
||||
final row = <String, dynamic>{
|
||||
'scenario': entry.key,
|
||||
'round': round,
|
||||
'workspaceWrites': workspaceWrites.count - writesBefore,
|
||||
'projectWrites': projectWrites.count - projectWritesBefore,
|
||||
'over16ms': overBudget(16667),
|
||||
'over8ms': overBudget(8333),
|
||||
'dispatchUs': dispatchTimes,
|
||||
'timings': timings,
|
||||
};
|
||||
(results['runs'] as List).add(row);
|
||||
await save();
|
||||
debugPrint(
|
||||
'RESIZE_PROFILE ${entry.key} $round frames=${build.length} '
|
||||
'over16ms=${row['over16ms']} writes=${row['workspaceWrites']}',
|
||||
);
|
||||
}
|
||||
}
|
||||
results['status'] = 'passed';
|
||||
await save();
|
||||
expect(tester.takeException(), isNull);
|
||||
}, skip: !Platform.isMacOS || source.isEmpty || output.isEmpty);
|
||||
}
|
||||
|
||||
class _CountWorkspaceWrites implements WorkspaceViewSettingsRepository {
|
||||
_CountWorkspaceWrites(this.delegate);
|
||||
final WorkspaceViewSettingsRepository delegate;
|
||||
int count = 0;
|
||||
@override
|
||||
Future<WorkspaceViewSettingsData> load() => delegate.load();
|
||||
@override
|
||||
Future<void> save(WorkspaceViewSettingsData settings) {
|
||||
count++;
|
||||
return delegate.save(settings);
|
||||
}
|
||||
}
|
||||
|
||||
class _CountProjectWrites implements ProjectViewSettingsRepository {
|
||||
_CountProjectWrites(this.delegate);
|
||||
final ProjectViewSettingsRepository delegate;
|
||||
int count = 0;
|
||||
@override
|
||||
Future<ProjectViewSettingsData> load(String id) => delegate.load(id);
|
||||
@override
|
||||
Future<void> save(String id, ProjectViewSettingsData settings) {
|
||||
count++;
|
||||
return delegate.save(id, settings);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
enum DesktopContent { workspace, library, resourceLibrary, settings }
|
||||
enum DesktopContent { workspace, library, resourceLibrary, workflow, settings }
|
||||
|
||||
typedef DesktopContentSelection = ({
|
||||
DesktopContent surface,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
import 'package:cutdex_sdk/timeline_ui.dart';
|
||||
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Connects the application palette to the SDK timeline presentation.
|
||||
|
||||
@@ -17,9 +17,9 @@ class DesktopWindowFrame extends StatelessWidget {
|
||||
this.projectTabs,
|
||||
this.headerTrailing = const SizedBox.shrink(),
|
||||
this.settingsSelected = false,
|
||||
this.resourceLibrarySelected = false,
|
||||
this.onResourceLibraryPressed,
|
||||
this.workflowSelected = false,
|
||||
required this.onHomePressed,
|
||||
required this.onWorkflowPressed,
|
||||
required this.onSettingsPressed,
|
||||
required this.child,
|
||||
});
|
||||
@@ -35,9 +35,9 @@ class DesktopWindowFrame extends StatelessWidget {
|
||||
final Widget? projectTabs;
|
||||
final Widget headerTrailing;
|
||||
final bool settingsSelected;
|
||||
final bool resourceLibrarySelected;
|
||||
final VoidCallback? onResourceLibraryPressed;
|
||||
final bool workflowSelected;
|
||||
final VoidCallback onHomePressed;
|
||||
final VoidCallback onWorkflowPressed;
|
||||
final VoidCallback onSettingsPressed;
|
||||
final Widget child;
|
||||
|
||||
@@ -119,88 +119,110 @@ class DesktopWindowFrame extends StatelessWidget {
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
if (projectTabs == null)
|
||||
SizedBox(
|
||||
key: const Key('desktop-navigation-rail'),
|
||||
width: railWidth,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
for (final section in [0, 2])
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
child: IconButton.filledTonal(
|
||||
key: ValueKey(switch (section) {
|
||||
0 => 'desktop-rail-home',
|
||||
_ => 'desktop-rail-resources',
|
||||
}),
|
||||
tooltip: switch (section) {
|
||||
0 => context.l10n.navigationHome,
|
||||
_ => context.l10n.navigationLibrary,
|
||||
},
|
||||
isSelected:
|
||||
!settingsSelected &&
|
||||
(section == 2
|
||||
? resourceLibrarySelected
|
||||
: !resourceLibrarySelected),
|
||||
style: IconButton.styleFrom(
|
||||
fixedSize: const Size.square(railButtonSize),
|
||||
minimumSize: const Size.square(railButtonSize),
|
||||
maximumSize: const Size.square(railButtonSize),
|
||||
padding: EdgeInsets.zero,
|
||||
iconSize: railIconSize,
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
backgroundColor:
|
||||
!settingsSelected &&
|
||||
(section == 2
|
||||
? resourceLibrarySelected
|
||||
: !resourceLibrarySelected)
|
||||
? null
|
||||
: Colors.transparent,
|
||||
SizedBox(
|
||||
key: const Key('desktop-navigation-rail'),
|
||||
width: railWidth,
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) => SingleChildScrollView(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: constraints.maxHeight,
|
||||
),
|
||||
child: IntrinsicHeight(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
IconButton.filledTonal(
|
||||
key: const ValueKey('desktop-rail-home'),
|
||||
tooltip: context.l10n.navigationHome,
|
||||
isSelected:
|
||||
!settingsSelected && !workflowSelected,
|
||||
style: IconButton.styleFrom(
|
||||
fixedSize: const Size.square(railButtonSize),
|
||||
minimumSize: const Size.square(
|
||||
railButtonSize,
|
||||
),
|
||||
maximumSize: const Size.square(
|
||||
railButtonSize,
|
||||
),
|
||||
padding: EdgeInsets.zero,
|
||||
iconSize: railIconSize,
|
||||
tapTargetSize:
|
||||
MaterialTapTargetSize.shrinkWrap,
|
||||
backgroundColor:
|
||||
settingsSelected || workflowSelected
|
||||
? Colors.transparent
|
||||
: null,
|
||||
),
|
||||
onPressed: onHomePressed,
|
||||
icon: const Icon(AppIcons.home),
|
||||
),
|
||||
onPressed: switch (section) {
|
||||
0 => onHomePressed,
|
||||
_ => onResourceLibraryPressed,
|
||||
},
|
||||
icon: Icon(switch (section) {
|
||||
0 => AppIcons.home,
|
||||
_ => AppIcons.folder,
|
||||
}),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
IconButton.filledTonal(
|
||||
key: const ValueKey('desktop-rail-workflow'),
|
||||
tooltip: context.l10n.workflow,
|
||||
isSelected: workflowSelected,
|
||||
style: IconButton.styleFrom(
|
||||
fixedSize: const Size.square(railButtonSize),
|
||||
minimumSize: const Size.square(
|
||||
railButtonSize,
|
||||
),
|
||||
maximumSize: const Size.square(
|
||||
railButtonSize,
|
||||
),
|
||||
padding: EdgeInsets.zero,
|
||||
iconSize: railIconSize,
|
||||
tapTargetSize:
|
||||
MaterialTapTargetSize.shrinkWrap,
|
||||
backgroundColor: workflowSelected
|
||||
? null
|
||||
: Colors.transparent,
|
||||
),
|
||||
onPressed: onWorkflowPressed,
|
||||
icon: const Icon(AppIcons.timeline),
|
||||
),
|
||||
const Spacer(),
|
||||
IconButton(
|
||||
key: const Key('desktop-rail-settings'),
|
||||
tooltip: context.l10n.settings,
|
||||
isSelected: settingsSelected,
|
||||
onPressed: onSettingsPressed,
|
||||
style: IconButton.styleFrom(
|
||||
fixedSize: const Size.square(railButtonSize),
|
||||
minimumSize: const Size.square(
|
||||
railButtonSize,
|
||||
),
|
||||
maximumSize: const Size.square(
|
||||
railButtonSize,
|
||||
),
|
||||
padding: EdgeInsets.zero,
|
||||
iconSize: railIconSize,
|
||||
tapTargetSize:
|
||||
MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
icon: const Icon(AppIcons.settings),
|
||||
),
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
IconButton(
|
||||
key: const Key('project-settings-button'),
|
||||
tooltip: context.l10n.settings,
|
||||
isSelected: settingsSelected,
|
||||
onPressed: onSettingsPressed,
|
||||
style: IconButton.styleFrom(
|
||||
fixedSize: const Size.square(railButtonSize),
|
||||
minimumSize: const Size.square(railButtonSize),
|
||||
maximumSize: const Size.square(railButtonSize),
|
||||
padding: EdgeInsets.zero,
|
||||
iconSize: railIconSize,
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
icon: const Icon(AppIcons.settings),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: projectTabs == null ? 0 : contentInset,
|
||||
padding: const EdgeInsets.only(
|
||||
left: contentInset,
|
||||
right: contentInset,
|
||||
bottom: contentInset,
|
||||
),
|
||||
child: SizedBox(
|
||||
key: const Key('desktop-content-container'),
|
||||
child: WindowHeaderPane(
|
||||
offset: Offset(
|
||||
projectTabs == null ? railWidth : contentInset,
|
||||
offset: const Offset(
|
||||
railWidth + contentInset,
|
||||
headerHeight,
|
||||
),
|
||||
child: LayoutBuilder(
|
||||
|
||||
@@ -32,6 +32,11 @@ class DesktopWorkspaceShell extends StatefulWidget {
|
||||
required this.scaffoldKey,
|
||||
required this.navigationDrawer,
|
||||
this.projectTabsLayout = false,
|
||||
this.timelineHeight,
|
||||
this.onTimelineHeightChanged,
|
||||
this.onJunctionResizeEnd,
|
||||
this.onSidebarResizeEnd,
|
||||
this.sidebarCanExpand = true,
|
||||
});
|
||||
|
||||
static const gutterWidth = WorkspaceLayoutMetrics.desktopSpacing;
|
||||
@@ -47,12 +52,53 @@ class DesktopWorkspaceShell extends StatefulWidget {
|
||||
final GlobalKey<ScaffoldState> scaffoldKey;
|
||||
final Widget navigationDrawer;
|
||||
final bool projectTabsLayout;
|
||||
final double? timelineHeight;
|
||||
final ValueChanged<double>? onTimelineHeightChanged;
|
||||
final VoidCallback? onJunctionResizeEnd;
|
||||
final VoidCallback? onSidebarResizeEnd;
|
||||
final bool sidebarCanExpand;
|
||||
|
||||
@override
|
||||
State<DesktopWorkspaceShell> createState() => _DesktopWorkspaceShellState();
|
||||
}
|
||||
|
||||
class _DesktopWorkspaceShellState extends State<DesktopWorkspaceShell> {
|
||||
double? _sidebarRestoreWidth;
|
||||
bool _sidebarJunctionDragging = false;
|
||||
|
||||
void _startSidebarResize(double width, {bool junction = false}) {
|
||||
_sidebarRestoreWidth = width;
|
||||
if (junction) setState(() => _sidebarJunctionDragging = true);
|
||||
}
|
||||
|
||||
void _resizeSidebar(double requestedWidth, double maximum) {
|
||||
if (!widget.sidebarCanExpand || widget.controller.agentFloating) return;
|
||||
if (requestedWidth < WorkspaceLayoutMetrics.sidebarSnapThreshold) {
|
||||
if (!widget.sidebarCollapsed) {
|
||||
final restoreWidth = _sidebarRestoreWidth;
|
||||
if (restoreWidth != null && widget.sidebarWidth != restoreWidth) {
|
||||
widget.onSidebarWidthChanged(restoreWidth);
|
||||
}
|
||||
widget.onSidebarCollapsedChanged(true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (widget.sidebarCollapsed) widget.onSidebarCollapsedChanged(false);
|
||||
widget.onSidebarWidthChanged(
|
||||
requestedWidth.clamp(WorkspaceLayoutMetrics.sidebarMinimumWidth, maximum),
|
||||
);
|
||||
}
|
||||
|
||||
void _finishSidebarResize() {
|
||||
_sidebarRestoreWidth = null;
|
||||
if (_sidebarJunctionDragging) {
|
||||
setState(() => _sidebarJunctionDragging = false);
|
||||
widget.onJunctionResizeEnd?.call();
|
||||
} else {
|
||||
widget.onSidebarResizeEnd?.call();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -64,6 +110,11 @@ class _DesktopWorkspaceShellState extends State<DesktopWorkspaceShell> {
|
||||
@override
|
||||
void didUpdateWidget(covariant DesktopWorkspaceShell oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (widget.controller.agentFloating ||
|
||||
!widget.sidebarCanExpand ||
|
||||
widget.onTimelineHeightChanged == null) {
|
||||
_sidebarJunctionDragging = false;
|
||||
}
|
||||
if (oldWidget.controller != widget.controller) {
|
||||
oldWidget.controller.removeListener(_changed);
|
||||
widget.controller.addListener(_changed);
|
||||
@@ -85,6 +136,9 @@ class _DesktopWorkspaceShellState extends State<DesktopWorkspaceShell> {
|
||||
required ValueChanged<double> onResize,
|
||||
double direction = 1,
|
||||
VoidCallback? onEnd,
|
||||
VoidCallback? onStart,
|
||||
Set<WorkspaceResizeBoundary> highlightTargets = const {},
|
||||
Offset highlightOffset = Offset.zero,
|
||||
}) => SizedBox(
|
||||
width: WorkspaceLayoutMetrics.desktopResizeHitExtent,
|
||||
height: double.infinity,
|
||||
@@ -95,11 +149,17 @@ class _DesktopWorkspaceShellState extends State<DesktopWorkspaceShell> {
|
||||
direction: direction,
|
||||
onResize: onResize,
|
||||
onEnd: onEnd,
|
||||
onStart: onStart,
|
||||
highlightTargets: highlightTargets,
|
||||
highlightOffset: highlightOffset,
|
||||
),
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => widget.projectTabsLayout
|
||||
Widget build(BuildContext context) =>
|
||||
WorkspaceResizeHighlightScope(child: _workspace(context));
|
||||
|
||||
Widget _workspace(BuildContext context) => widget.projectTabsLayout
|
||||
? _projectWorkspace(context)
|
||||
: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
@@ -164,6 +224,7 @@ class _DesktopWorkspaceShellState extends State<DesktopWorkspaceShell> {
|
||||
|
||||
return Scaffold(
|
||||
key: widget.scaffoldKey,
|
||||
drawerEnableOpenDragGesture: false,
|
||||
backgroundColor: Colors.transparent,
|
||||
drawer: Drawer(
|
||||
width: 320,
|
||||
@@ -317,6 +378,12 @@ class _DesktopWorkspaceShellState extends State<DesktopWorkspaceShell> {
|
||||
.toDouble();
|
||||
final floating = widget.controller.agentFloating;
|
||||
final collapsed = widget.sidebarCollapsed || floating;
|
||||
double resolveTimelineHeight(double? height) =>
|
||||
WorkspaceLayoutMetrics.resolveTimelineHeight(
|
||||
constraints.maxHeight,
|
||||
height,
|
||||
);
|
||||
final timelineHeight = resolveTimelineHeight(widget.timelineHeight);
|
||||
final geometry = DesktopWorkspaceGeometry(
|
||||
sidebarWidth: sidebarWidth,
|
||||
agentWidth: 0,
|
||||
@@ -324,6 +391,7 @@ class _DesktopWorkspaceShellState extends State<DesktopWorkspaceShell> {
|
||||
);
|
||||
return Scaffold(
|
||||
key: widget.scaffoldKey,
|
||||
drawerEnableOpenDragGesture: false,
|
||||
backgroundColor: Colors.transparent,
|
||||
drawer: Drawer(
|
||||
width: 320,
|
||||
@@ -356,20 +424,64 @@ class _DesktopWorkspaceShellState extends State<DesktopWorkspaceShell> {
|
||||
),
|
||||
],
|
||||
),
|
||||
if (!collapsed)
|
||||
if (!floating &&
|
||||
widget.sidebarCanExpand &&
|
||||
WorkspaceLayoutPolicy.desktopNavigationFits(width))
|
||||
Positioned(
|
||||
left: sidebarWidth - WorkspaceLayoutMetrics.desktopResizeSlop,
|
||||
left: collapsed
|
||||
? 0
|
||||
: sidebarWidth - WorkspaceLayoutMetrics.desktopResizeSlop,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
child: _gutter(
|
||||
name: 'project-sidebar',
|
||||
initialWidth: sidebarWidth,
|
||||
onResize: (value) => widget.onSidebarWidthChanged(
|
||||
value.clamp(
|
||||
WorkspaceLayoutMetrics.sidebarMinimumWidth,
|
||||
maximum,
|
||||
),
|
||||
highlightTargets: const {WorkspaceResizeBoundary.sidebar},
|
||||
highlightOffset: collapsed
|
||||
? const Offset(
|
||||
-WorkspaceLayoutMetrics.desktopResizeHitExtent / 2,
|
||||
0,
|
||||
)
|
||||
: Offset.zero,
|
||||
initialWidth: collapsed ? 0 : sidebarWidth,
|
||||
onStart: () => _startSidebarResize(sidebarWidth),
|
||||
onResize: (value) => _resizeSidebar(value, maximum),
|
||||
onEnd: _finishSidebarResize,
|
||||
),
|
||||
),
|
||||
if (!floating &&
|
||||
widget.sidebarCanExpand &&
|
||||
WorkspaceLayoutPolicy.desktopNavigationFits(width) &&
|
||||
widget.onTimelineHeightChanged != null)
|
||||
Positioned(
|
||||
left: collapsed
|
||||
? 0
|
||||
: sidebarWidth - WorkspaceLayoutMetrics.desktopResizeSlop,
|
||||
bottom:
|
||||
timelineHeight - WorkspaceLayoutMetrics.desktopResizeSlop,
|
||||
width: WorkspaceLayoutMetrics.desktopResizeHitExtent,
|
||||
height: WorkspaceLayoutMetrics.desktopResizeHitExtent,
|
||||
child: WorkspaceResizeHandle.junction(
|
||||
key: const Key('desktop-chat-timeline-junction'),
|
||||
highlightOffset: collapsed
|
||||
? const Offset(
|
||||
-WorkspaceLayoutMetrics.desktopResizeHitExtent / 2,
|
||||
0,
|
||||
)
|
||||
: Offset.zero,
|
||||
highlightTargets: const {
|
||||
WorkspaceResizeBoundary.sidebar,
|
||||
WorkspaceResizeBoundary.timeline,
|
||||
},
|
||||
initialWidth: collapsed ? 0 : sidebarWidth,
|
||||
initialHeight: timelineHeight,
|
||||
verticalDirection: -1,
|
||||
onStart: () =>
|
||||
_startSidebarResize(sidebarWidth, junction: true),
|
||||
onWidthChanged: (value) => _resizeSidebar(value, maximum),
|
||||
onHeightChanged: (value) => widget.onTimelineHeightChanged!(
|
||||
resolveTimelineHeight(value),
|
||||
),
|
||||
onEnd: _finishSidebarResize,
|
||||
),
|
||||
),
|
||||
if (floating)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:cutdex_native/cutdex_native.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
|
||||
@@ -2,24 +2,20 @@ import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
|
||||
/// Native QPC clock calibration and bounded asynchronous diagnostics sampling.
|
||||
class BenchDiagnostics {
|
||||
BenchDiagnostics(this.sessionId, this.clock);
|
||||
final String sessionId;
|
||||
BenchDiagnostics(this.session, this.clock);
|
||||
final RuntimeSession session;
|
||||
final Stopwatch clock;
|
||||
static const _channel = MethodChannel('cutdex_runtime');
|
||||
double uncertaintyMs = double.infinity, _offset = 0;
|
||||
Timer? _timer;
|
||||
Future<void>? _pending;
|
||||
Object? _sampleError;
|
||||
|
||||
double now() => _offset + clock.elapsedMicroseconds / 1000;
|
||||
Future<Map<String, dynamic>> read() async =>
|
||||
(await _channel.invokeMapMethod<String, dynamic>('previewDiagnostics', {
|
||||
'sessionId': sessionId,
|
||||
}))!;
|
||||
Future<Map<String, Object?>> read() => session.previewDiagnostics();
|
||||
|
||||
Future<void> calibrate() async {
|
||||
for (var i = 0; i < 20; i++) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_sdk/timeline/layout.dart';
|
||||
import 'package:cutdex_sdk/timeline_ui.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:cutdex_core/timeline/layout.dart';
|
||||
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@ import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cutdex/features/preview/preview_panel.dart';
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_sdk/timeline/layout.dart';
|
||||
import 'package:cutdex_sdk/timeline_ui.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:cutdex_core/timeline/layout.dart';
|
||||
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
@@ -84,7 +84,7 @@ Future<void> runFullAppViewportBench(ViewportBenchConfig config) async {
|
||||
if (clipStart < 0 || clipEnd > viewport.width) {
|
||||
throw StateError('Clip outside viewport');
|
||||
}
|
||||
final native = diagnostics = BenchDiagnostics(preview.session!.id, clock);
|
||||
final native = diagnostics = BenchDiagnostics(preview.session!, clock);
|
||||
await native.calibrate();
|
||||
capture = await BenchCapture.start(config, output);
|
||||
final record = records = BenchRecords(output);
|
||||
|
||||
@@ -2,8 +2,8 @@ import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cutdex_sdk/timeline/layout.dart';
|
||||
import 'package:cutdex_sdk/timeline_ui.dart';
|
||||
import 'package:cutdex_core/timeline/layout.dart';
|
||||
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
@@ -191,7 +191,7 @@ Future<void> _run(String output) async {
|
||||
.cached((projectId, id));
|
||||
if (preview?.session != null && uiMs != null && dataMs != null) {
|
||||
final diagnostic = await BenchDiagnostics(
|
||||
preview!.session!.id,
|
||||
preview!.session!,
|
||||
clock,
|
||||
).read().timeout(const Duration(seconds: 2));
|
||||
if ((diagnostic['sourceSubmitted'] as num?) != null &&
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../media/media_asset_cover.dart';
|
||||
|
||||
@@ -7,7 +7,7 @@ import '../../shared/theme/composer_style.dart';
|
||||
|
||||
import 'package:cutdex/l10n/l10n.dart';
|
||||
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
|
||||
import '../../integrations/platform/platform_capabilities.dart';
|
||||
import 'agent_composer_controller.dart';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import '../../workspace/external_media_import.dart';
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'dart:convert';
|
||||
import 'package:cutdex_agent/cutdex_agent.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
import '../../diagnostics/agent_request_diagnostics.dart';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'agent_media_attachments.freezed.dart';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
||||
@@ -80,7 +80,6 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
||||
ProjectViewSettings get _viewController =>
|
||||
ref.read(projectViewSettingsProvider(widget.projectId).notifier);
|
||||
bool get _propertiesOpen => _viewSettings.propertiesOpen;
|
||||
double? get _timelineHeight => _viewSettings.timelineHeight;
|
||||
|
||||
void _saveViewSettings() {
|
||||
if (widget.projectId.isEmpty ||
|
||||
@@ -93,7 +92,8 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final viewSettings = ref.watch(
|
||||
projectViewSettingsProvider(widget.projectId),
|
||||
projectViewSettingsProvider(widget.projectId)
|
||||
.select((value) => (value.hasValue, value.value?.propertiesOpen)),
|
||||
);
|
||||
final preview = KeyedSubtree(
|
||||
key: _previewKey,
|
||||
@@ -205,10 +205,15 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
||||
if (desktop) mediaButton,
|
||||
Expanded(
|
||||
child: desktop
|
||||
? _PreviewHeaderTitle(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
pending: _timelinePending,
|
||||
? Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: AppSpacing.small,
|
||||
),
|
||||
child: _PreviewHeaderTitle(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
pending: _timelinePending,
|
||||
),
|
||||
)
|
||||
: widget.showProjectName
|
||||
? Row(
|
||||
@@ -249,7 +254,7 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
||||
? context.l10n.collapseProperties
|
||||
: context.l10n.expandProperties,
|
||||
isSelected: propertiesOpen,
|
||||
onPressed: !viewSettings.hasValue
|
||||
onPressed: !viewSettings.$1
|
||||
? null
|
||||
: () {
|
||||
if (desktop) {
|
||||
@@ -285,23 +290,40 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
||||
),
|
||||
),
|
||||
);
|
||||
Widget dockedEditing({required bool showTools}) =>
|
||||
ExpandedEditorLayout(
|
||||
Widget dockedEditing({required bool showTools}) => Consumer(
|
||||
builder: (context, ref, _) {
|
||||
final dimensions = ref.watch(
|
||||
projectViewSettingsProvider(widget.projectId).select(
|
||||
(value) =>
|
||||
(value.value?.mediaWidth, value.value?.timelineHeight),
|
||||
),
|
||||
);
|
||||
return ExpandedEditorLayout(
|
||||
preview: preview,
|
||||
header: header,
|
||||
properties: properties,
|
||||
media: media,
|
||||
showMedia: dockMedia,
|
||||
showProperties: showTools && dockProperties,
|
||||
timelineHeight: _timelineHeight,
|
||||
mediaWidth: dimensions.$1,
|
||||
onMediaWidthChanged: (width) {
|
||||
if (viewSettings.$1) {
|
||||
_viewController.setMediaWidth(width);
|
||||
}
|
||||
},
|
||||
onMediaWidthChangeEnd: _saveViewSettings,
|
||||
timelineHeight: dimensions.$2,
|
||||
onTimelineHeightChanged: (height) {
|
||||
if (viewSettings.hasValue) {
|
||||
if (viewSettings.$1) {
|
||||
_viewController.setTimelineHeight(height);
|
||||
}
|
||||
},
|
||||
onTimelineHeightChangeEnd: _saveViewSettings,
|
||||
onJunctionResizeEnd: _saveViewSettings,
|
||||
timeline: timeline,
|
||||
);
|
||||
},
|
||||
);
|
||||
return Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
|
||||
@@ -32,7 +32,7 @@ class EditorTimelineDefaults extends StatelessWidget {
|
||||
: 26,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: AppTheme.isDesktop(context) ? AppSpacing.tiny : 0,
|
||||
horizontal: AppTheme.isDesktop(context) ? AppSpacing.small : 0,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
@@ -90,7 +90,9 @@ class EditorTimelineDefaults extends StatelessWidget {
|
||||
),
|
||||
)
|
||||
: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: AppSpacing.medium,
|
||||
),
|
||||
child: AppCommandToolbar(
|
||||
groups: [
|
||||
[
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../integrations/platform/device_experience.dart';
|
||||
import '../../../l10n/l10n.dart';
|
||||
import '../../../shared/layout/workspace_layout_metrics.dart';
|
||||
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
@@ -61,6 +62,11 @@ class BoundedEditorLayout extends StatelessWidget {
|
||||
: context.l10n.expandProperties,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: desktop && tool == EditorTool.properties
|
||||
? AppTheme.propertiesPanelTheme(Theme.of(context))
|
||||
.textTheme
|
||||
.titleSmall
|
||||
: null,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -103,7 +109,12 @@ class BoundedEditorLayout extends StatelessWidget {
|
||||
right: 0,
|
||||
width: page
|
||||
? constraints.maxWidth
|
||||
: math.min(320, constraints.maxWidth),
|
||||
: math.min(
|
||||
desktop && tool == EditorTool.properties
|
||||
? WorkspaceLayoutMetrics.propertiesPanelWidth
|
||||
: 320,
|
||||
constraints.maxWidth,
|
||||
),
|
||||
child: Material(
|
||||
key: const Key('editor-tool-surface'),
|
||||
elevation: page ? 0 : 8,
|
||||
|
||||
@@ -15,9 +15,13 @@ class ExpandedEditorLayout extends StatefulWidget {
|
||||
required this.media,
|
||||
required this.showMedia,
|
||||
required this.showProperties,
|
||||
required this.mediaWidth,
|
||||
required this.onMediaWidthChanged,
|
||||
required this.onMediaWidthChangeEnd,
|
||||
required this.timelineHeight,
|
||||
required this.onTimelineHeightChanged,
|
||||
required this.onTimelineHeightChangeEnd,
|
||||
required this.onJunctionResizeEnd,
|
||||
required this.timeline,
|
||||
});
|
||||
|
||||
@@ -27,9 +31,13 @@ class ExpandedEditorLayout extends StatefulWidget {
|
||||
final Widget media;
|
||||
final bool showMedia;
|
||||
final bool showProperties;
|
||||
final double? mediaWidth;
|
||||
final ValueChanged<double> onMediaWidthChanged;
|
||||
final VoidCallback onMediaWidthChangeEnd;
|
||||
final double? timelineHeight;
|
||||
final ValueChanged<double> onTimelineHeightChanged;
|
||||
final VoidCallback onTimelineHeightChangeEnd;
|
||||
final VoidCallback onJunctionResizeEnd;
|
||||
final Widget timeline;
|
||||
|
||||
@override
|
||||
@@ -50,28 +58,35 @@ class _ExpandedEditorLayoutState extends State<ExpandedEditorLayout> {
|
||||
WorkspaceCard(key: Key('editor-$name-card'), child: child);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => LayoutBuilder(
|
||||
Widget build(BuildContext context) =>
|
||||
WorkspaceResizeHighlightScope(child: _layout());
|
||||
|
||||
Widget _layout() => LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final maximum = math.max(
|
||||
0.0,
|
||||
constraints.maxHeight -
|
||||
gap -
|
||||
WorkspaceLayoutMetrics.previewMinimumHeight,
|
||||
);
|
||||
final minimum = math.min(
|
||||
WorkspaceLayoutMetrics.timelineMinimumHeight,
|
||||
maximum,
|
||||
);
|
||||
final timelineHeight =
|
||||
(widget.timelineHeight ??
|
||||
constraints.maxHeight *
|
||||
WorkspaceLayoutMetrics.timelineDefaultHeightFraction)
|
||||
.clamp(minimum, maximum)
|
||||
.toDouble();
|
||||
const mediaWidth = WorkspaceLayoutMetrics.mediaPanelWidth;
|
||||
double resolveTimelineHeight(double? height) =>
|
||||
WorkspaceLayoutMetrics.resolveTimelineHeight(
|
||||
constraints.maxHeight,
|
||||
height,
|
||||
);
|
||||
final timelineHeight = resolveTimelineHeight(widget.timelineHeight);
|
||||
final propertiesWidth = widget.showProperties
|
||||
? WorkspaceLayoutMetrics.propertiesPanelWidth
|
||||
: 0.0;
|
||||
final mediaMaximumWidth = math.max(
|
||||
0.0,
|
||||
constraints.maxWidth -
|
||||
WorkspaceLayoutMetrics.previewMinimumWidth -
|
||||
gap -
|
||||
(widget.showProperties ? propertiesWidth + gap : 0),
|
||||
);
|
||||
final mediaMinimumWidth = math.min(
|
||||
WorkspaceLayoutMetrics.mediaPanelMinimumWidth,
|
||||
mediaMaximumWidth,
|
||||
);
|
||||
final mediaWidth =
|
||||
(widget.mediaWidth ?? WorkspaceLayoutMetrics.mediaPanelWidth)
|
||||
.clamp(mediaMinimumWidth, mediaMaximumWidth)
|
||||
.toDouble();
|
||||
return Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
@@ -130,6 +145,24 @@ class _ExpandedEditorLayoutState extends State<ExpandedEditorLayout> {
|
||||
),
|
||||
],
|
||||
),
|
||||
if (widget.showMedia)
|
||||
Positioned(
|
||||
key: const Key('editor-media-divider'),
|
||||
left: mediaWidth - WorkspaceLayoutMetrics.desktopResizeSlop,
|
||||
top: 0,
|
||||
bottom: timelineHeight + gap,
|
||||
width: WorkspaceLayoutMetrics.desktopResizeHitExtent,
|
||||
child: WorkspaceResizeHandle(
|
||||
key: const Key('editor-media-resize'),
|
||||
highlightTargets: const {WorkspaceResizeBoundary.media},
|
||||
axis: Axis.horizontal,
|
||||
initialValue: mediaWidth,
|
||||
onResize: (width) => widget.onMediaWidthChanged(
|
||||
width.clamp(mediaMinimumWidth, mediaMaximumWidth).toDouble(),
|
||||
),
|
||||
onEnd: widget.onMediaWidthChangeEnd,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
key: const Key('editor-timeline-divider'),
|
||||
left: 0,
|
||||
@@ -138,15 +171,39 @@ class _ExpandedEditorLayoutState extends State<ExpandedEditorLayout> {
|
||||
height: WorkspaceLayoutMetrics.desktopResizeHitExtent,
|
||||
child: WorkspaceResizeHandle(
|
||||
key: const Key('editor-timeline-resize'),
|
||||
highlightTargets: const {WorkspaceResizeBoundary.timeline},
|
||||
axis: Axis.vertical,
|
||||
initialValue: timelineHeight,
|
||||
direction: -1,
|
||||
onResize: (height) => widget.onTimelineHeightChanged(
|
||||
height.clamp(minimum, maximum).toDouble(),
|
||||
),
|
||||
onResize: (height) =>
|
||||
widget.onTimelineHeightChanged(resolveTimelineHeight(height)),
|
||||
onEnd: widget.onTimelineHeightChangeEnd,
|
||||
),
|
||||
),
|
||||
if (widget.showMedia)
|
||||
Positioned(
|
||||
left: mediaWidth - WorkspaceLayoutMetrics.desktopResizeSlop,
|
||||
bottom: timelineHeight - WorkspaceLayoutMetrics.desktopResizeSlop,
|
||||
width: WorkspaceLayoutMetrics.desktopResizeHitExtent,
|
||||
height: WorkspaceLayoutMetrics.desktopResizeHitExtent,
|
||||
child: WorkspaceResizeHandle.junction(
|
||||
key: const Key('editor-media-timeline-junction'),
|
||||
highlightTargets: const {
|
||||
WorkspaceResizeBoundary.media,
|
||||
WorkspaceResizeBoundary.timeline,
|
||||
},
|
||||
initialWidth: mediaWidth,
|
||||
initialHeight: timelineHeight,
|
||||
verticalDirection: -1,
|
||||
onWidthChanged: (width) => widget.onMediaWidthChanged(
|
||||
width.clamp(mediaMinimumWidth, mediaMaximumWidth).toDouble(),
|
||||
),
|
||||
onHeightChanged: (height) => widget.onTimelineHeightChanged(
|
||||
resolveTimelineHeight(height),
|
||||
),
|
||||
onEnd: widget.onJunctionResizeEnd,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_sdk/timeline_ui.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:cutdex/diagnostics/app_diagnostics.dart';
|
||||
import 'package:cutdex/errors/app_failure.dart';
|
||||
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'subtitle_download.dart';
|
||||
import 'subtitle_task_actions.dart';
|
||||
|
||||
import 'package:cutdex/l10n/l10n.dart';
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../integrations/runtime/processing_resource_repository.dart';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -24,12 +24,23 @@ class DesktopMediaAssetTile extends StatelessWidget {
|
||||
final MediaAvailability? availability;
|
||||
|
||||
static TextStyle? _nameStyle(BuildContext context) =>
|
||||
Theme.of(context).textTheme.bodyMedium
|
||||
?.copyWith(fontSize: 13, height: 20 / 13);
|
||||
Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontFamily: 'packages/cutdex_ui/Inter',
|
||||
fontSize: AppInspectorMetrics.fontSize,
|
||||
height: AppInspectorMetrics.lineHeight / AppInspectorMetrics.fontSize,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontVariations: const [FontVariation('wght', 500)],
|
||||
letterSpacing: AppInspectorMetrics.fontSize * .005,
|
||||
);
|
||||
|
||||
static TextStyle? _metadataStyle(BuildContext context) =>
|
||||
Theme.of(context).textTheme.bodySmall
|
||||
?.copyWith(fontSize: 12, height: 16 / 12);
|
||||
Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
fontFamily: 'packages/cutdex_ui/Inter',
|
||||
fontSize: AppInspectorMetrics.fontSize,
|
||||
height: AppInspectorMetrics.lineHeight / AppInspectorMetrics.fontSize,
|
||||
fontVariations: const [FontVariation('wght', 450)],
|
||||
letterSpacing: AppInspectorMetrics.fontSize * .005,
|
||||
);
|
||||
|
||||
/// Font fallback and fractional scaling can round a line above size × height.
|
||||
static double gridLabelHeight(BuildContext context) {
|
||||
@@ -106,7 +117,7 @@ class DesktopMediaAssetTile extends StatelessWidget {
|
||||
);
|
||||
final cover = ClipRRect(
|
||||
key: ValueKey('desktop-media-cover-${asset.id}'),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
borderRadius: BorderRadius.circular(AppInspectorMetrics.radius),
|
||||
child: Stack(
|
||||
children: [
|
||||
if (unavailable)
|
||||
@@ -215,66 +226,3 @@ class DesktopMediaAssetTile extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// List labels follow the same column widths and breakpoints as asset rows.
|
||||
class DesktopMediaListHeader extends StatelessWidget {
|
||||
const DesktopMediaListHeader({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: DesktopMediaMetrics.padding + DesktopMediaMetrics.tilePadding,
|
||||
),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final columns = DesktopMediaListColumns(constraints.maxWidth);
|
||||
Widget label(String text, {bool end = false}) => Text(
|
||||
text,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: end ? TextAlign.end : TextAlign.start,
|
||||
style: DesktopMediaAssetTile._metadataStyle(context)
|
||||
?.copyWith(color: Theme.of(context).colorScheme.onSurfaceVariant),
|
||||
);
|
||||
return SizedBox(
|
||||
height: (MediaQuery.textScalerOf(context).scale(16) + 8).clamp(
|
||||
DesktopMediaMetrics.listHeader,
|
||||
double.infinity,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.only(
|
||||
start:
|
||||
DesktopMediaMetrics.listCover + DesktopMediaMetrics.gap,
|
||||
),
|
||||
child: label(context.l10n.name),
|
||||
),
|
||||
),
|
||||
if (columns.duration)
|
||||
SizedBox(
|
||||
width: DesktopMediaListColumns.durationWidth,
|
||||
child: label(context.l10n.duration, end: true),
|
||||
),
|
||||
if (columns.specification) ...[
|
||||
const SizedBox(width: DesktopMediaMetrics.gap),
|
||||
SizedBox(
|
||||
width: DesktopMediaListColumns.specificationWidth,
|
||||
child: label(context.l10n.mediaSpecification),
|
||||
),
|
||||
],
|
||||
if (columns.kind) ...[
|
||||
const SizedBox(width: DesktopMediaMetrics.gap),
|
||||
SizedBox(
|
||||
width: DesktopMediaListColumns.kindWidth,
|
||||
child: label(context.l10n.mediaCategory),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:cutdex/errors/app_failure.dart';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:cutdex/l10n/l10n.dart';
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
@@ -298,6 +298,95 @@ class _MediaBrowserBodyState extends ConsumerState<MediaBrowserBody>
|
||||
_anchorOwner = null;
|
||||
_anchorAssets = const [];
|
||||
}
|
||||
Widget item(BuildContext context, int index) {
|
||||
final asset = assets[index];
|
||||
return Consumer(
|
||||
builder: (context, ref, _) {
|
||||
final availability = ref
|
||||
.watch(mediaAvailabilityProvider(widget.projectId, asset))
|
||||
.asData
|
||||
?.value;
|
||||
final unavailable =
|
||||
availability != null &&
|
||||
availability != MediaAvailability.available;
|
||||
return ListenableSelector<(bool, bool)>(
|
||||
listenable: _browser,
|
||||
select: () => (_selectedAssetId == asset.id, _checkingDrop),
|
||||
builder: (context, presentation) => AppContextMenu(
|
||||
key: ValueKey(('media-menu', asset.id)),
|
||||
itemsBuilder: (_) {
|
||||
final available = ref.read(projectsProvider).asData?.value;
|
||||
final canEdit =
|
||||
available?.activeProject?.id == widget.projectId &&
|
||||
available?.projectBusy == false &&
|
||||
!_checkingDrop;
|
||||
final sequence = timeline?.activeSequenceId;
|
||||
return [
|
||||
AppMenuItem(
|
||||
label: context.l10n.addToTimeline,
|
||||
icon: AppIcons.add,
|
||||
onPressed:
|
||||
canEdit &&
|
||||
!unavailable &&
|
||||
sequence != null &&
|
||||
available?.timeline?.id == timelineId
|
||||
? () => _action(() => _browser.insertAsset(asset))
|
||||
: null,
|
||||
),
|
||||
AppMenuItem(
|
||||
label: context.l10n.rename,
|
||||
icon: AppIcons.rename,
|
||||
onPressed: canEdit ? () => _rename(asset) : null,
|
||||
),
|
||||
AppMenuItem(
|
||||
label: defaultTargetPlatform == TargetPlatform.macOS
|
||||
? context.l10n.revealFinder
|
||||
: context.l10n.revealFileManager,
|
||||
icon: AppIcons.folderOpen,
|
||||
onPressed: canEdit && _desktop
|
||||
? () => _action(() => _browser.reveal(asset))
|
||||
: null,
|
||||
),
|
||||
const AppMenuSeparator(),
|
||||
AppMenuItem(
|
||||
label: context.l10n.removeMedia,
|
||||
icon: AppIcons.delete,
|
||||
destructive: true,
|
||||
onPressed: canEdit ? () => _remove(asset) : null,
|
||||
),
|
||||
];
|
||||
},
|
||||
child: Listener(
|
||||
onPointerDown: (event) {
|
||||
if (event.buttons == 2) {
|
||||
_selectedAssetId = asset.id;
|
||||
}
|
||||
},
|
||||
child: _SelectableAsset(
|
||||
key: ValueKey(asset.id),
|
||||
grid: _isGrid,
|
||||
desktop: widget.desktop,
|
||||
drag: MediaAssetDrag(
|
||||
projectId: widget.projectId,
|
||||
assetId: asset.id,
|
||||
),
|
||||
name: asset.name,
|
||||
draggable:
|
||||
widget.draggable &&
|
||||
!workspace!.projectBusy &&
|
||||
!presentation.$2 &&
|
||||
!unavailable,
|
||||
selected: presentation.$1,
|
||||
onTap: () => _browser.selectAsset(asset),
|
||||
child: _assetTile(asset, availability),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
final content = assets.isEmpty
|
||||
? Center(
|
||||
child: Padding(
|
||||
@@ -382,105 +471,6 @@ class _MediaBrowserBodyState extends ConsumerState<MediaBrowserBody>
|
||||
height: constraints.maxHeight,
|
||||
);
|
||||
}
|
||||
Widget item(BuildContext context, int index) {
|
||||
final asset = assets[index];
|
||||
return Consumer(
|
||||
builder: (context, ref, _) {
|
||||
final availability = ref
|
||||
.watch(
|
||||
mediaAvailabilityProvider(widget.projectId, asset),
|
||||
)
|
||||
.asData
|
||||
?.value;
|
||||
final unavailable =
|
||||
availability != null &&
|
||||
availability != MediaAvailability.available;
|
||||
return ListenableSelector<(bool, bool)>(
|
||||
listenable: _browser,
|
||||
select: () =>
|
||||
(_selectedAssetId == asset.id, _checkingDrop),
|
||||
builder: (context, presentation) => AppContextMenu(
|
||||
key: ValueKey(('media-menu', asset.id)),
|
||||
itemsBuilder: (_) {
|
||||
final available = ref
|
||||
.read(projectsProvider)
|
||||
.asData
|
||||
?.value;
|
||||
final canEdit =
|
||||
available?.activeProject?.id ==
|
||||
widget.projectId &&
|
||||
available?.projectBusy == false &&
|
||||
!_checkingDrop;
|
||||
final sequence = timeline?.activeSequenceId;
|
||||
return [
|
||||
AppMenuItem(
|
||||
label: context.l10n.addToTimeline,
|
||||
icon: AppIcons.add,
|
||||
onPressed:
|
||||
canEdit &&
|
||||
!unavailable &&
|
||||
sequence != null &&
|
||||
available?.timeline?.id == timelineId
|
||||
? () => _action(
|
||||
() => _browser.insertAsset(asset),
|
||||
)
|
||||
: null,
|
||||
),
|
||||
AppMenuItem(
|
||||
label: context.l10n.rename,
|
||||
icon: AppIcons.rename,
|
||||
onPressed: canEdit ? () => _rename(asset) : null,
|
||||
),
|
||||
AppMenuItem(
|
||||
label:
|
||||
defaultTargetPlatform == TargetPlatform.macOS
|
||||
? context.l10n.revealFinder
|
||||
: context.l10n.revealFileManager,
|
||||
icon: AppIcons.folderOpen,
|
||||
onPressed: canEdit && _desktop
|
||||
? () => _action(() => _browser.reveal(asset))
|
||||
: null,
|
||||
),
|
||||
const AppMenuSeparator(),
|
||||
AppMenuItem(
|
||||
label: context.l10n.removeMedia,
|
||||
icon: AppIcons.delete,
|
||||
destructive: true,
|
||||
onPressed: canEdit ? () => _remove(asset) : null,
|
||||
),
|
||||
];
|
||||
},
|
||||
child: Listener(
|
||||
onPointerDown: (event) {
|
||||
if (event.buttons == 2) {
|
||||
_selectedAssetId = asset.id;
|
||||
}
|
||||
},
|
||||
child: _SelectableAsset(
|
||||
key: ValueKey(asset.id),
|
||||
grid: _isGrid,
|
||||
desktop: widget.desktop,
|
||||
drag: MediaAssetDrag(
|
||||
projectId: widget.projectId,
|
||||
assetId: asset.id,
|
||||
),
|
||||
name: asset.name,
|
||||
draggable:
|
||||
widget.draggable &&
|
||||
!workspace!.projectBusy &&
|
||||
!presentation.$2 &&
|
||||
!unavailable,
|
||||
selected: presentation.$1,
|
||||
onTap: () => _browser.selectAsset(asset),
|
||||
child: _assetTile(asset, availability),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget scrollView(ScrollController controller) => !_isGrid
|
||||
? widget.desktop
|
||||
? ListView.builder(
|
||||
@@ -509,9 +499,10 @@ class _MediaBrowserBodyState extends ConsumerState<MediaBrowserBody>
|
||||
separatorBuilder: (_, _) =>
|
||||
SizedBox(height: spacing),
|
||||
)
|
||||
: GridView.builder(
|
||||
: GridView.custom(
|
||||
key: PageStorageKey(('media-grid', widget.projectId)),
|
||||
controller: controller,
|
||||
semanticChildCount: assets.length,
|
||||
padding: EdgeInsets.all(padding),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: columns,
|
||||
@@ -528,8 +519,10 @@ class _MediaBrowserBodyState extends ConsumerState<MediaBrowserBody>
|
||||
labelHeight +
|
||||
2,
|
||||
),
|
||||
itemCount: assets.length,
|
||||
itemBuilder: item,
|
||||
childrenDelegate: _MediaChildrenDelegate(
|
||||
item,
|
||||
childCount: assets.length,
|
||||
),
|
||||
);
|
||||
if (widget.desktop) {
|
||||
return ScrollEdgeFade(
|
||||
@@ -546,8 +539,6 @@ class _MediaBrowserBodyState extends ConsumerState<MediaBrowserBody>
|
||||
if (!widget.desktop) return content;
|
||||
return Column(
|
||||
children: [
|
||||
if (!_isGrid)
|
||||
const DesktopMediaListHeader(key: Key('media-list-header')),
|
||||
Expanded(child: content),
|
||||
const Divider(height: 1),
|
||||
SizedBox(
|
||||
@@ -811,3 +802,13 @@ class _SelectableAsset extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Constraint changes reflow existing cells without rebuilding menus and tiles.
|
||||
// A new builder is created when assets, filters or the project change.
|
||||
class _MediaChildrenDelegate extends SliverChildBuilderDelegate {
|
||||
const _MediaChildrenDelegate(super.builder, {super.childCount});
|
||||
|
||||
@override
|
||||
bool shouldRebuild(covariant _MediaChildrenDelegate oldDelegate) =>
|
||||
builder != oldDelegate.builder || childCount != oldDelegate.childCount;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import '../../integrations/platform/file_picker.dart';
|
||||
@@ -30,9 +30,9 @@ enum MediaSort { importOrder, nameAscending, nameDescending }
|
||||
|
||||
/// Desktop thumbnail density, independent of touch-page presentation.
|
||||
enum MediaGridSize {
|
||||
small(120),
|
||||
medium(160),
|
||||
large(200);
|
||||
small(96),
|
||||
medium(120),
|
||||
large(160);
|
||||
|
||||
const MediaGridSize(this.targetWidth);
|
||||
final double targetWidth;
|
||||
|
||||
@@ -2,15 +2,14 @@ import 'dart:math' as math;
|
||||
|
||||
/// Shared desktop geometry for cards, rows, headers and browse anchoring.
|
||||
abstract final class DesktopMediaMetrics {
|
||||
static const padding = 12.0;
|
||||
static const padding = 16.0;
|
||||
static const gap = 8.0;
|
||||
static const tilePadding = 5.0;
|
||||
static const tilePadding = 8.0;
|
||||
static const listCover = 56.0;
|
||||
static const listRow = 48.0;
|
||||
static const listHeader = 28.0;
|
||||
|
||||
static int columns(double width, double targetWidth) =>
|
||||
math.max(1, ((width + gap) / (targetWidth + gap)).floor());
|
||||
math.max(1, ((width + gap) / (targetWidth + gap)).ceil());
|
||||
|
||||
static double gridExtent(double tileWidth, double labelHeight) =>
|
||||
(tileWidth - tilePadding * 2) * 9 / 16 +
|
||||
@@ -19,7 +18,7 @@ abstract final class DesktopMediaMetrics {
|
||||
tilePadding * 2;
|
||||
}
|
||||
|
||||
/// Matching list-column visibility for a header and its asset rows.
|
||||
/// List-column visibility within asset rows.
|
||||
final class DesktopMediaListColumns {
|
||||
const DesktopMediaListColumns(double width)
|
||||
: duration = width >= 240,
|
||||
|
||||
@@ -292,6 +292,34 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
||||
}
|
||||
|
||||
Widget _desktopToolbar(BuildContext context, RecentProject? selected) {
|
||||
final desktopButtonStyle = AppTheme.toolbarButtonStyle(context).copyWith(
|
||||
textStyle: WidgetStatePropertyAll(
|
||||
Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontFamily: 'packages/cutdex_ui/Inter',
|
||||
fontSize: AppInspectorMetrics.fontSize,
|
||||
height: AppInspectorMetrics.lineHeight / AppInspectorMetrics.fontSize,
|
||||
fontWeight: FontWeight.w400,
|
||||
fontVariations: const [FontVariation('wght', 450)],
|
||||
letterSpacing: AppInspectorMetrics.fontSize * .005,
|
||||
),
|
||||
),
|
||||
minimumSize: const WidgetStatePropertyAll(
|
||||
Size(0, AppInspectorMetrics.input),
|
||||
),
|
||||
maximumSize: const WidgetStatePropertyAll(
|
||||
Size(double.infinity, AppInspectorMetrics.input),
|
||||
),
|
||||
padding: const WidgetStatePropertyAll(
|
||||
EdgeInsets.symmetric(horizontal: AppSpacing.small),
|
||||
),
|
||||
shape: const WidgetStatePropertyAll(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(AppInspectorMetrics.radius),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
Widget category() => Semantics(
|
||||
label: context.l10n.mediaCategory,
|
||||
child: AppDropdownMenu(
|
||||
@@ -309,6 +337,7 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
||||
buttonKey: const Key('media-category-button'),
|
||||
focusNode: focus,
|
||||
onPressed: toggle,
|
||||
style: desktopButtonStyle,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@@ -341,9 +370,14 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
||||
else
|
||||
SizedBox(
|
||||
key: const Key('media-project-row'),
|
||||
height: 36,
|
||||
height: AppInspectorMetrics.row,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||
AppInspectorMetrics.padding,
|
||||
AppInspectorMetrics.rowPadding,
|
||||
AppInspectorMetrics.trailingPadding,
|
||||
AppInspectorMetrics.rowPadding,
|
||||
),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) => Row(
|
||||
children: [
|
||||
@@ -369,6 +403,7 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
||||
buttonKey: const Key('media-project-button'),
|
||||
focusNode: focusNode,
|
||||
onPressed: toggle,
|
||||
style: desktopButtonStyle,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@@ -385,7 +420,7 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
const SizedBox(width: AppSpacing.small),
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: (constraints.maxWidth * .45).clamp(
|
||||
@@ -394,12 +429,12 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
||||
),
|
||||
),
|
||||
child: SizedBox(
|
||||
height: 28,
|
||||
height: AppInspectorMetrics.input,
|
||||
child: Tooltip(
|
||||
message: context.l10n.importMedia,
|
||||
child: TextButton(
|
||||
key: const Key('media-import-button'),
|
||||
style: AppTheme.toolbarButtonStyle(context),
|
||||
style: desktopButtonStyle,
|
||||
onPressed: canImport ? onImport : null,
|
||||
child: Text(
|
||||
context.l10n.importMedia,
|
||||
@@ -427,6 +462,14 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
||||
Widget Function() category,
|
||||
String Function(MediaSort) sortLabel,
|
||||
) {
|
||||
final searchText = Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontFamily: 'packages/cutdex_ui/Inter',
|
||||
fontSize: AppInspectorMetrics.fontSize,
|
||||
height: AppInspectorMetrics.lineHeight / AppInspectorMetrics.fontSize,
|
||||
fontVariations: const [FontVariation('wght', 450)],
|
||||
letterSpacing: AppInspectorMetrics.fontSize * .005,
|
||||
);
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
List<Widget> sortItems() => [
|
||||
for (final value in MediaSort.values)
|
||||
AppMenuItem(
|
||||
@@ -462,7 +505,7 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
||||
required IconData icon,
|
||||
required List<Widget> items,
|
||||
}) => SizedBox.square(
|
||||
dimension: 28,
|
||||
dimension: AppInspectorMetrics.action,
|
||||
child: AppDropdownMenu(
|
||||
items: items,
|
||||
builder: (context, toggle, focus) => IconButton(
|
||||
@@ -477,9 +520,14 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
||||
);
|
||||
return SizedBox(
|
||||
key: const Key('media-filter-row'),
|
||||
height: 40,
|
||||
height: AppInspectorMetrics.row,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(12, 4, 12, 4),
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
AppInspectorMetrics.padding,
|
||||
AppInspectorMetrics.rowPadding,
|
||||
AppInspectorMetrics.trailingPadding,
|
||||
AppInspectorMetrics.rowPadding,
|
||||
),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final wide = constraints.maxWidth >= 400;
|
||||
@@ -490,13 +538,10 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
||||
key: const Key('media-search'),
|
||||
controller: _search,
|
||||
enabled: widget.onQueryChanged != null,
|
||||
style: AppTheme.inputTextStyle(
|
||||
context,
|
||||
style: AppTheme.toolbarTextStyle(context),
|
||||
),
|
||||
style: AppTheme.inputTextStyle(context, style: searchText),
|
||||
cursorHeight: AppTheme.inputCursorHeight(
|
||||
context,
|
||||
style: AppTheme.toolbarTextStyle(context),
|
||||
style: searchText,
|
||||
),
|
||||
textAlignVertical: TextAlignVertical.center,
|
||||
decoration: InputDecoration(
|
||||
@@ -505,36 +550,61 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
||||
),
|
||||
hintStyle: AppTheme.inputHintStyle(
|
||||
context,
|
||||
style: AppTheme.toolbarTextStyle(context),
|
||||
style: searchText,
|
||||
),
|
||||
filled: true,
|
||||
fillColor: colors.surfaceContainer,
|
||||
isDense: true,
|
||||
constraints: const BoxConstraints(minHeight: 32),
|
||||
constraints: const BoxConstraints(
|
||||
minHeight: AppInspectorMetrics.input,
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 4,
|
||||
horizontal: AppSpacing.small,
|
||||
),
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(AppInspectorMetrics.radius),
|
||||
),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(AppInspectorMetrics.radius),
|
||||
),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(AppInspectorMetrics.radius),
|
||||
),
|
||||
borderSide: BorderSide(color: colors.primary),
|
||||
),
|
||||
prefixIcon: constraints.maxWidth < 160
|
||||
? null
|
||||
: const Icon(AppIcons.search, size: 16),
|
||||
prefixIconConstraints: const BoxConstraints(
|
||||
minWidth: 28,
|
||||
minHeight: 28,
|
||||
minWidth: AppInspectorMetrics.input,
|
||||
minHeight: AppInspectorMetrics.input,
|
||||
),
|
||||
),
|
||||
onChanged: (value) => widget.onQueryChanged?.call(value),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
const SizedBox(width: AppSpacing.small),
|
||||
if (wide) ...[
|
||||
SizedBox(width: 88, height: 28, child: category()),
|
||||
const SizedBox(width: 4),
|
||||
SizedBox(
|
||||
width: 88,
|
||||
height: AppInspectorMetrics.input,
|
||||
child: category(),
|
||||
),
|
||||
const SizedBox(width: AppSpacing.small),
|
||||
menuButton(
|
||||
key: const Key('media-sort-button'),
|
||||
tooltip: context.l10n.sortMedia,
|
||||
icon: AppIcons.sort,
|
||||
items: sortItems(),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
const SizedBox(width: AppSpacing.small),
|
||||
menuButton(
|
||||
key: const Key('media-size-button'),
|
||||
tooltip: context.l10n.mediaThumbnailSize,
|
||||
@@ -564,9 +634,9 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
||||
...sizeItems(),
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
const SizedBox(width: AppSpacing.small),
|
||||
SizedBox.square(
|
||||
dimension: 28,
|
||||
dimension: AppInspectorMetrics.action,
|
||||
child: IconButton(
|
||||
key: const Key('media-layout-toggle'),
|
||||
onPressed: onToggleGrid,
|
||||
@@ -581,9 +651,9 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
||||
),
|
||||
),
|
||||
if (widget.projectScoped) ...[
|
||||
const SizedBox(width: 4),
|
||||
const SizedBox(width: AppSpacing.small),
|
||||
SizedBox.square(
|
||||
dimension: 28,
|
||||
dimension: AppInspectorMetrics.action,
|
||||
child: IconButton(
|
||||
key: const Key('media-import-button'),
|
||||
onPressed: canImport ? () => onImport() : null,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'processing_targets.freezed.dart';
|
||||
|
||||
@@ -115,9 +115,13 @@ class _ResourceSectionTabsState extends State<ResourceSectionTabs> {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
return SizedBox(
|
||||
key: const Key('resource-section-tabs'),
|
||||
height: 36,
|
||||
height: AppDesktopMetrics.timelineTabs,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
|
||||
padding: const EdgeInsetsDirectional.only(
|
||||
start: AppSpacing.small,
|
||||
top: 4,
|
||||
bottom: 4,
|
||||
),
|
||||
child: ScrollEdgeFade(
|
||||
controller: _scrollController,
|
||||
axis: Axis.horizontal,
|
||||
@@ -127,35 +131,30 @@ class _ResourceSectionTabsState extends State<ResourceSectionTabs> {
|
||||
key: const Key('resource-tabs-list'),
|
||||
controller: _scrollController,
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Row(
|
||||
children: [
|
||||
for (final section in ResourceSection.values) ...[
|
||||
if (section != ResourceSection.values.first)
|
||||
const SizedBox(width: 4),
|
||||
KeyedSubtree(
|
||||
key: widget.selected == section
|
||||
? _selectedTabKey
|
||||
: null,
|
||||
child: Semantics(
|
||||
selected: widget.selected == section,
|
||||
child: TextButton(
|
||||
key: ValueKey('resource-tab-${section.name}'),
|
||||
style: AppTheme.timelineTabStyle(
|
||||
context,
|
||||
selected: widget.selected == section,
|
||||
),
|
||||
onPressed: widget.onSelected == null
|
||||
? null
|
||||
: () => widget.onSelected!(section),
|
||||
child: Text(section.label(l10n), maxLines: 1),
|
||||
child: Row(
|
||||
children: [
|
||||
for (final section in ResourceSection.values) ...[
|
||||
if (section != ResourceSection.values.first)
|
||||
const SizedBox(width: AppSpacing.tiny),
|
||||
KeyedSubtree(
|
||||
key: widget.selected == section ? _selectedTabKey : null,
|
||||
child: Semantics(
|
||||
selected: widget.selected == section,
|
||||
child: TextButton(
|
||||
key: ValueKey('resource-tab-${section.name}'),
|
||||
style: AppTheme.timelineTabStyle(
|
||||
context,
|
||||
selected: widget.selected == section,
|
||||
),
|
||||
onPressed: widget.onSelected == null
|
||||
? null
|
||||
: () => widget.onSelected!(section),
|
||||
child: Text(section.label(l10n), maxLines: 1),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import 'package:cutdex/diagnostics/app_diagnostics.dart';
|
||||
import 'package:cutdex/errors/app_failure.dart';
|
||||
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ import '../../shared/widgets/listenable_selector.dart';
|
||||
|
||||
import 'package:cutdex/l10n/l10n.dart';
|
||||
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_sdk/runtime/processing_contracts.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
import 'package:cutdex_native_flutter/processing_contracts.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'media_asset_cover.dart';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../l10n/l10n.dart';
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:flutter/services.dart';
|
||||
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
import 'package:cutdex_native/cutdex_native.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
|
||||
/// Moves the existing preview into the root overlay, retaining its native view.
|
||||
class PreviewFullscreenHost extends StatefulWidget {
|
||||
|
||||
@@ -2,8 +2,9 @@ import 'package:cutdex/l10n/l10n.dart';
|
||||
|
||||
import '../../errors/app_failure.dart';
|
||||
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_core/execution.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
|
||||
String previewErrorMessage(Object e, AppLocalizations l10n) => switch (e) {
|
||||
AppException(:final failure) => l10n.failureMessage(failure),
|
||||
|
||||
@@ -6,11 +6,11 @@ import 'dart:async';
|
||||
|
||||
import 'package:cutdex/features/properties/canvas_presets.dart';
|
||||
import 'package:cutdex/l10n/l10n.dart';
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/preview.dart';
|
||||
import 'package:cutdex_sdk/project.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||
import 'package:cutdex_core/project.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
@@ -228,6 +228,8 @@ class _EditorPreviewContent extends ConsumerWidget {
|
||||
select: () => (
|
||||
activeController.positionTick,
|
||||
activeController.selectedVisualIds.isNotEmpty,
|
||||
activeController.distortionEditingElement,
|
||||
activeController.distortionPerspective,
|
||||
activeController.maskEditingElement,
|
||||
activeController.obscureEditingElement,
|
||||
),
|
||||
@@ -621,6 +623,22 @@ class _PreviewToolbar extends StatelessWidget {
|
||||
final PreviewController? controller;
|
||||
final SourcePreviewController? source;
|
||||
|
||||
ButtonStyle? _compactButtonStyle(BuildContext context) =>
|
||||
AppTheme.isDesktop(context)
|
||||
? IconButton.styleFrom(
|
||||
fixedSize: const Size.square(AppInspectorMetrics.action),
|
||||
minimumSize: const Size.square(AppInspectorMetrics.action),
|
||||
maximumSize: const Size.square(AppInspectorMetrics.action),
|
||||
padding: EdgeInsets.zero,
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(AppInspectorMetrics.radius),
|
||||
),
|
||||
),
|
||||
)
|
||||
: null;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (PreviewFullscreenScope.of(context)?.fullscreen == true) {
|
||||
@@ -661,7 +679,7 @@ class _PreviewToolbar extends StatelessWidget {
|
||||
try {
|
||||
final time = CommandTime(tick, TimelineClock.ticksPerSecond);
|
||||
if (source case final source?) {
|
||||
await source.control(SourcePreviewAction.seek, at: time);
|
||||
await source.seekInteractive(tick);
|
||||
} else if (preview?.activeSequence() case final sequence?) {
|
||||
await preview!.controlPreview(sequence, PreviewAction.seek, at: time);
|
||||
}
|
||||
@@ -705,12 +723,25 @@ class _PreviewToolbar extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
icon: Icon(direction < 0 ? AppIcons.previousFrame : AppIcons.nextFrame),
|
||||
style: _compactButtonStyle(context),
|
||||
),
|
||||
);
|
||||
|
||||
Widget _build(BuildContext context) {
|
||||
final preview = controller;
|
||||
final playing = source?.playing ?? preview?.playing ?? false;
|
||||
final timeTextStyle = AppTheme.isDesktop(context)
|
||||
? Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontFamily: 'packages/cutdex_ui/Inter',
|
||||
fontSize: AppInspectorMetrics.fontSize,
|
||||
height:
|
||||
AppInspectorMetrics.lineHeight / AppInspectorMetrics.fontSize,
|
||||
fontVariations: const [FontVariation('wght', 450)],
|
||||
letterSpacing: AppInspectorMetrics.fontSize * .005,
|
||||
fontFeatures: [const FontFeature.tabularFigures()],
|
||||
)
|
||||
: Theme.of(context).textTheme.bodySmall
|
||||
?.copyWith(fontFeatures: [const FontFeature.tabularFigures()]);
|
||||
final frameDuration =
|
||||
source?.frameDuration ??
|
||||
preview?.frameDuration ??
|
||||
@@ -762,7 +793,9 @@ class _PreviewToolbar extends StatelessWidget {
|
||||
? AppDesktopMetrics.playbackBar
|
||||
: AppControlSize.panelHeader,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: AppSpacing.compact),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: AppInspectorMetrics.padding,
|
||||
),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final controls = Row(
|
||||
@@ -803,13 +836,14 @@ class _PreviewToolbar extends StatelessWidget {
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
fontFeatures: [const FontFeature.tabularFigures()],
|
||||
),
|
||||
style: timeTextStyle,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (AppTheme.isDesktop(context)) _frameButton(context, -1),
|
||||
if (AppTheme.isDesktop(context)) ...[
|
||||
const SizedBox(width: AppSpacing.small),
|
||||
_frameButton(context, -1),
|
||||
],
|
||||
ListenableSelector(
|
||||
listenable: source ?? preview,
|
||||
select: () => (
|
||||
@@ -826,10 +860,14 @@ class _PreviewToolbar extends StatelessWidget {
|
||||
? preview.togglePlayback
|
||||
: null,
|
||||
icon: Icon(playing ? AppIcons.pause : AppIcons.play),
|
||||
style: _compactButtonStyle(context),
|
||||
);
|
||||
},
|
||||
),
|
||||
if (AppTheme.isDesktop(context)) _frameButton(context, 1),
|
||||
if (AppTheme.isDesktop(context)) ...[
|
||||
_frameButton(context, 1),
|
||||
const SizedBox(width: AppSpacing.small),
|
||||
],
|
||||
Expanded(
|
||||
child: ListenableSelector(
|
||||
listenable: source ?? preview,
|
||||
@@ -854,8 +892,9 @@ class _PreviewToolbar extends StatelessWidget {
|
||||
tooltip: context.l10n.retryPreview,
|
||||
onPressed: preview.busy ? null : preview.retry,
|
||||
icon: const Icon(AppIcons.refresh),
|
||||
style: _compactButtonStyle(context),
|
||||
),
|
||||
const SizedBox(width: AppSpacing.gap),
|
||||
const SizedBox(width: AppSpacing.small),
|
||||
],
|
||||
if (source == null &&
|
||||
PreviewFullscreenScope.of(context)?.fullscreen !=
|
||||
@@ -865,6 +904,25 @@ class _PreviewToolbar extends StatelessWidget {
|
||||
emptyLabel: context.l10n.noMatchingOptions,
|
||||
label: context.l10n.canvasRatio,
|
||||
outlined: false,
|
||||
controlHeight: AppTheme.isDesktop(context)
|
||||
? AppInspectorMetrics.input
|
||||
: null,
|
||||
textStyle: AppTheme.isDesktop(context)
|
||||
? Theme.of(
|
||||
context,
|
||||
).textTheme.bodyMedium?.copyWith(
|
||||
fontFamily: 'packages/cutdex_ui/Inter',
|
||||
fontSize: AppInspectorMetrics.fontSize,
|
||||
height:
|
||||
AppInspectorMetrics.lineHeight /
|
||||
AppInspectorMetrics.fontSize,
|
||||
fontVariations: const [
|
||||
FontVariation('wght', 450),
|
||||
],
|
||||
letterSpacing:
|
||||
AppInspectorMetrics.fontSize * .005,
|
||||
)
|
||||
: null,
|
||||
value:
|
||||
preview?.canvas ?? ProjectCanvas.widescreen,
|
||||
onChanged: preview?.setCanvas,
|
||||
@@ -894,6 +952,7 @@ class _PreviewToolbar extends StatelessWidget {
|
||||
? AppIcons.exitFullscreen
|
||||
: AppIcons.fullscreen,
|
||||
),
|
||||
style: _compactButtonStyle(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -45,6 +45,7 @@ import 'project_switch_region.dart';
|
||||
import 'project_sidebar.dart';
|
||||
import 'project_tabs_bar.dart';
|
||||
import 'project_tabs_controller.dart';
|
||||
import 'workflow_page.dart';
|
||||
import 'widgets/name_dialog.dart';
|
||||
|
||||
/// The single application surface: project navigation beside the editor.
|
||||
@@ -294,6 +295,19 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
);
|
||||
final projects = ref.read(projectsProvider);
|
||||
final state = projects.value ?? const ProjectState();
|
||||
final editorProjectId = state.timeline == null
|
||||
? null
|
||||
: state.activeProject?.id;
|
||||
final editorViewSettings = desktop && editorProjectId != null
|
||||
? ref.watch(
|
||||
projectViewSettingsProvider(editorProjectId).select(
|
||||
(value) => (
|
||||
ready: value.hasValue,
|
||||
timelineHeight: value.value?.timelineHeight,
|
||||
),
|
||||
),
|
||||
)
|
||||
: null;
|
||||
return EditorWindowChrome(
|
||||
headerHeight: desktop ? DesktopWindowFrame.headerHeight : 48,
|
||||
builder: (context, integrated) => Scaffold(
|
||||
@@ -631,30 +645,33 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
),
|
||||
),
|
||||
);
|
||||
bool isActiveContent(DesktopContent surface) =>
|
||||
surface == DesktopContent.workspace
|
||||
? contentSelection.surface ==
|
||||
DesktopContent.workspace ||
|
||||
contentSelection.surface ==
|
||||
DesktopContent.library ||
|
||||
contentSelection.surface ==
|
||||
DesktopContent.resourceLibrary
|
||||
: contentSelection.surface == surface;
|
||||
Widget contentSurface(
|
||||
DesktopContent surface,
|
||||
Widget child,
|
||||
) => ExcludeFocus(
|
||||
excluding:
|
||||
(contentSelection.surface ==
|
||||
DesktopContent.settings) !=
|
||||
(surface == DesktopContent.settings),
|
||||
excluding: !isActiveContent(surface),
|
||||
child: TickerMode(
|
||||
enabled:
|
||||
(contentSelection.surface ==
|
||||
DesktopContent.settings) ==
|
||||
(surface == DesktopContent.settings),
|
||||
enabled: isActiveContent(surface),
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
Widget desktopContents(
|
||||
Widget workspace,
|
||||
) => IndexedStack(
|
||||
index:
|
||||
contentSelection.surface ==
|
||||
DesktopContent.settings
|
||||
? 1
|
||||
: 0,
|
||||
index: switch (contentSelection.surface) {
|
||||
DesktopContent.settings => 1,
|
||||
DesktopContent.workflow => 2,
|
||||
_ => 0,
|
||||
},
|
||||
children: [
|
||||
contentSurface(
|
||||
DesktopContent.workspace,
|
||||
@@ -685,6 +702,10 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
),
|
||||
contentSurface(
|
||||
DesktopContent.workflow,
|
||||
const WorkflowPage(),
|
||||
),
|
||||
],
|
||||
);
|
||||
return switch (experience) {
|
||||
@@ -773,17 +794,23 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
],
|
||||
),
|
||||
),
|
||||
resourceLibrarySelected:
|
||||
contentSelection.surface ==
|
||||
DesktopContent.resourceLibrary,
|
||||
onResourceLibraryPressed: () => selectSidebar(
|
||||
DesktopContent.resourceLibrary,
|
||||
),
|
||||
settingsSelected:
|
||||
contentSelection.surface ==
|
||||
DesktopContent.settings,
|
||||
onHomePressed: () =>
|
||||
selectSidebar(DesktopContent.workspace),
|
||||
workflowSelected:
|
||||
contentSelection.surface ==
|
||||
DesktopContent.workflow,
|
||||
onHomePressed: () {
|
||||
selectSidebar(DesktopContent.workspace);
|
||||
_setMode(WorkspaceMode.agent);
|
||||
},
|
||||
onWorkflowPressed: () {
|
||||
ref
|
||||
.read(desktopContentProvider.notifier)
|
||||
.select(DesktopContent.workflow);
|
||||
_desktopScaffoldKey.currentState
|
||||
?.closeDrawer();
|
||||
},
|
||||
onSettingsPressed: () =>
|
||||
showSettingsPage(context),
|
||||
child: desktopContents(
|
||||
@@ -794,15 +821,43 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
||||
navigationDrawer: navigation(drawer: true),
|
||||
mode: _mode,
|
||||
sidebarCollapsed: navigationCollapsed,
|
||||
sidebarCanExpand: !navigationHiddenBySpace,
|
||||
sidebarWidth: _sidebarWidthOverride,
|
||||
timelineHeight:
|
||||
editorViewSettings?.timelineHeight,
|
||||
onTimelineHeightChanged:
|
||||
editorViewSettings?.ready == true &&
|
||||
!_switchingProject
|
||||
? (height) => ref
|
||||
.read(
|
||||
projectViewSettingsProvider(
|
||||
editorProjectId!,
|
||||
).notifier,
|
||||
)
|
||||
.setTimelineHeight(height)
|
||||
: null,
|
||||
onJunctionResizeEnd: () {
|
||||
_saveViewState();
|
||||
if (editorViewSettings?.ready == true) {
|
||||
unawaited(
|
||||
ref
|
||||
.read(
|
||||
projectViewSettingsProvider(
|
||||
editorProjectId!,
|
||||
).notifier,
|
||||
)
|
||||
.save(),
|
||||
);
|
||||
}
|
||||
},
|
||||
onSidebarCollapsedChanged: (value) {
|
||||
_sidebarCollapsed = value;
|
||||
_saveViewState();
|
||||
},
|
||||
onSidebarWidthChanged: (value) {
|
||||
_sidebarWidthOverride = value;
|
||||
_saveViewState();
|
||||
},
|
||||
onSidebarResizeEnd: _saveViewState,
|
||||
sidebarBuilder: (geometry, expand) =>
|
||||
navigation(
|
||||
geometry: geometry,
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
import 'package:cutdex/l10n/l10n.dart';
|
||||
import 'package:cutdex/shared/layout/workspace_layout_metrics.dart';
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class WorkflowPage extends StatelessWidget {
|
||||
const WorkflowPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => ColoredBox(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(WorkspaceLayoutMetrics.desktopOuterSpacing),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
context.l10n.workflow,
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
),
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 420),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
AppIcons.timeline,
|
||||
size: 40,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
context.l10n.workflowDescription,
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -1,12 +1,17 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:cutdex/l10n/l10n.dart';
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
|
||||
extension TransformChannelLabel on TransformChannel {
|
||||
String label(BuildContext context) => switch (this) {
|
||||
TransformChannel.position => context.l10n.position,
|
||||
TransformChannel.rotation => context.l10n.rotation,
|
||||
TransformChannel.scale => context.l10n.scale,
|
||||
TransformChannel.cornerRadius => context.l10n.cornerRadius,
|
||||
TransformChannel.distortTopLeft => context.l10n.distortionTopLeft,
|
||||
TransformChannel.distortTopRight => context.l10n.distortionTopRight,
|
||||
TransformChannel.distortBottomRight => context.l10n.distortionBottomRight,
|
||||
TransformChannel.distortBottomLeft => context.l10n.distortionBottomLeft,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ import '../../shared/widgets/listenable_selector.dart';
|
||||
|
||||
import 'package:cutdex/l10n/l10n.dart';
|
||||
import 'package:cutdex/features/properties/audio_gain_scale.dart';
|
||||
import 'package:cutdex_sdk/timeline/engine.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_core/timeline/engine.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
@@ -12,9 +12,9 @@ import 'package:cutdex_ui/theme.dart';
|
||||
|
||||
import '../../workspace/timeline_session.dart';
|
||||
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
|
||||
export 'package:cutdex_sdk/editor.dart' show ClipAudioGain;
|
||||
export 'package:cutdex_core/editor.dart' show ClipAudioGain;
|
||||
|
||||
class AudioProperties extends StatefulWidget {
|
||||
const AudioProperties({
|
||||
@@ -169,8 +169,7 @@ class _AudioPropertiesState extends State<AudioProperties> {
|
||||
if (_text.text != text) _text.text = text;
|
||||
}
|
||||
if (ClipAudioGain.isDetached(record)) {
|
||||
return Padding(
|
||||
padding: AppTheme.propertySectionPadding(context),
|
||||
return AppPropertySection(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
@@ -343,15 +342,18 @@ class _AudioPropertiesState extends State<AudioProperties> {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Padding(
|
||||
padding: AppTheme.propertySectionPadding(context),
|
||||
AppPropertySection(
|
||||
child: AppTheme.isDesktop(context)
|
||||
? AppPropertyGroup(
|
||||
label: widget.hasAudio
|
||||
? context.l10n.volume
|
||||
: context.l10n.unboundAudio,
|
||||
actions: volumeActions,
|
||||
child: volumeControls,
|
||||
actions: volumeActions.skip(1).toList(),
|
||||
padChild: false,
|
||||
child: AppPropertyRow(
|
||||
trailing: volumeActions.first,
|
||||
children: [volumeControls],
|
||||
),
|
||||
)
|
||||
: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:cutdex/l10n/l10n.dart';
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
|
||||
abstract final class ProjectCanvasPresets {
|
||||
static const values = {
|
||||
|
||||
@@ -3,8 +3,8 @@ import '../../shared/widgets/presentation_list.dart';
|
||||
|
||||
import 'package:cutdex/shared/widgets/error_notification_host.dart';
|
||||
import 'package:cutdex/l10n/l10n.dart';
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
@@ -196,8 +196,7 @@ class _CaptionPropertiesState extends State<CaptionProperties> {
|
||||
: 28.0;
|
||||
return Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: AppTheme.propertySectionPadding(context),
|
||||
AppPropertySection(
|
||||
child: SizedBox(
|
||||
height: AppTheme.propertyInputHeight(context),
|
||||
child: Row(
|
||||
@@ -226,9 +225,13 @@ class _CaptionPropertiesState extends State<CaptionProperties> {
|
||||
vertical: 0,
|
||||
),
|
||||
prefixIcon: const Icon(AppIcons.search, size: 14),
|
||||
prefixIconConstraints: const BoxConstraints(
|
||||
minWidth: 28,
|
||||
minHeight: 28,
|
||||
prefixIconConstraints: BoxConstraints(
|
||||
minWidth: AppTheme.isCompactInspector(context)
|
||||
? 24
|
||||
: 28,
|
||||
minHeight: AppTheme.isCompactInspector(context)
|
||||
? 24
|
||||
: 28,
|
||||
),
|
||||
),
|
||||
onChanged: (value) => setState(
|
||||
@@ -448,7 +451,7 @@ class _CaptionPropertiesState extends State<CaptionProperties> {
|
||||
Widget panel(Widget content) => WorkspacePanel(
|
||||
paintBackground: false,
|
||||
headerHeight: AppTheme.isDesktop(context)
|
||||
? AppDesktopMetrics.panelHeader
|
||||
? AppInspectorMetrics.sectionHeader
|
||||
: CompactPanelTabs.height,
|
||||
headerPadding: EdgeInsets.zero,
|
||||
showHeaderDivider: false,
|
||||
@@ -564,7 +567,9 @@ class _CaptionPropertiesState extends State<CaptionProperties> {
|
||||
key: const ValueKey('caption-detail-scroll-fade'),
|
||||
builder: (controller) => ListView(
|
||||
controller: controller,
|
||||
padding: const EdgeInsets.symmetric(vertical: AppSpacing.small),
|
||||
padding: AppTheme.isDesktop(context)
|
||||
? EdgeInsets.zero
|
||||
: const EdgeInsets.symmetric(vertical: AppSpacing.small),
|
||||
children:
|
||||
[
|
||||
if (AppTheme.isDesktop(context))
|
||||
@@ -775,16 +780,21 @@ class _CaptionPropertiesState extends State<CaptionProperties> {
|
||||
},
|
||||
),
|
||||
]
|
||||
.where(
|
||||
(item) =>
|
||||
!AppTheme.isDesktop(context) ||
|
||||
(item is! SizedBox && item is! Divider),
|
||||
)
|
||||
.map(
|
||||
(item) =>
|
||||
item is SizedBox ||
|
||||
identical(item, widget.transformProperties)
|
||||
? item
|
||||
: AppTheme.isDesktop(context)
|
||||
? AppPropertySection(child: item)
|
||||
: Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: AppTheme.isDesktop(context)
|
||||
? AppInspectorMetrics.padding
|
||||
: AppSpacing.panelContentHorizontal,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: AppSpacing.panelContentHorizontal,
|
||||
),
|
||||
child: item,
|
||||
),
|
||||
@@ -804,11 +814,13 @@ class _CaptionTextInput extends StatefulWidget {
|
||||
required this.editContext,
|
||||
required this.onSubmit,
|
||||
this.label,
|
||||
this.leading,
|
||||
this.maxLines = 1,
|
||||
});
|
||||
final String value;
|
||||
final Object editContext;
|
||||
final String? label;
|
||||
final Widget? leading;
|
||||
final int maxLines;
|
||||
final bool Function(String) onSubmit;
|
||||
|
||||
@@ -870,6 +882,7 @@ class _CaptionTextInputState extends State<_CaptionTextInput> {
|
||||
controller: _controller,
|
||||
focusNode: _focus,
|
||||
label: widget.label,
|
||||
leading: widget.leading,
|
||||
minLines: widget.maxLines,
|
||||
maxLines: widget.maxLines,
|
||||
textInputAction: TextInputAction.done,
|
||||
@@ -901,17 +914,39 @@ class _CaptionColorInput extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final desktop = AppTheme.isDesktop(context);
|
||||
final swatch = Container(
|
||||
width: desktop ? 14 : 20,
|
||||
height: desktop ? 14 : 20,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(int.parse('FF${value.substring(1)}', radix: 16)),
|
||||
border: Border.all(
|
||||
color: desktop
|
||||
? Theme.of(context).colorScheme.outlineVariant
|
||||
: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(AppRadius.extraSmall),
|
||||
),
|
||||
);
|
||||
if (desktop) {
|
||||
return AppPropertyGroup(
|
||||
label: label,
|
||||
padChild: false,
|
||||
child: AppPropertyRow(
|
||||
reserveTrailing: false,
|
||||
children: [
|
||||
_CaptionTextInput(
|
||||
value: value,
|
||||
editContext: editContext,
|
||||
leading: SizedBox(width: 24, child: Center(child: swatch)),
|
||||
onSubmit: onSubmit,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
final controls = Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 20,
|
||||
height: 20,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(int.parse('FF${value.substring(1)}', radix: 16)),
|
||||
border: Border.all(color: Theme.of(context).colorScheme.outline),
|
||||
borderRadius: BorderRadius.circular(AppRadius.extraSmall),
|
||||
),
|
||||
),
|
||||
swatch,
|
||||
const SizedBox(width: AppSpacing.small),
|
||||
Expanded(
|
||||
child: _CaptionTextInput(
|
||||
@@ -923,11 +958,6 @@ class _CaptionColorInput extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
);
|
||||
return desktop
|
||||
? AppPropertyGroup(
|
||||
label: label,
|
||||
child: Semantics(label: label, child: controls),
|
||||
)
|
||||
: controls;
|
||||
return controls;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
import 'package:cutdex/l10n/l10n.dart';
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
import 'package:cutdex_ui/widgets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ColorInterpretationControls extends StatelessWidget {
|
||||
const ColorInterpretationControls({
|
||||
super.key,
|
||||
required this.value,
|
||||
this.notice,
|
||||
required this.options,
|
||||
this.onChanged,
|
||||
});
|
||||
|
||||
final String value;
|
||||
final String? notice;
|
||||
final List<AppSelectOption<String>> options;
|
||||
final ValueChanged<String>? onChanged;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final secondary = Theme.of(context).colorScheme.onSurfaceVariant;
|
||||
final desktop = AppTheme.isDesktop(context);
|
||||
return AppPropertySection(
|
||||
bottomSpacing: desktop ? AppSpacing.small : null,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Tooltip(
|
||||
message: context.l10n.mediaColorInterpretationScope,
|
||||
child: Text(
|
||||
context.l10n.mediaInputColorSpace,
|
||||
style: AppTheme.propertySectionTitleStyle(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 6,
|
||||
child: AppSelect<String>(
|
||||
key: const Key('media-color-menu'),
|
||||
emptyLabel: context.l10n.noMatchingOptions,
|
||||
outlined: false,
|
||||
controlHeight: desktop ? AppInspectorMetrics.input : 32,
|
||||
label: context.l10n.mediaInputColorSpace,
|
||||
value: value,
|
||||
onChanged: onChanged,
|
||||
options: options,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
key: const Key('media-color-reset'),
|
||||
tooltip: context.l10n.resetMediaColorInterpretation,
|
||||
icon: const Icon(AppIcons.reset, size: 16),
|
||||
style: IconButton.styleFrom(
|
||||
minimumSize: Size.square(
|
||||
desktop ? AppInspectorMetrics.action : 40,
|
||||
),
|
||||
padding: EdgeInsets.zero,
|
||||
tapTargetSize: desktop
|
||||
? MaterialTapTargetSize.shrinkWrap
|
||||
: MaterialTapTargetSize.padded,
|
||||
),
|
||||
onPressed: value == 'auto' || onChanged == null
|
||||
? null
|
||||
: () => onChanged!('auto'),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (notice != null) ...[
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
notice!,
|
||||
key: const Key('media-color-status'),
|
||||
style: Theme.of(context).textTheme.bodySmall
|
||||
?.copyWith(color: secondary),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import 'package:cutdex/l10n/app_localizations.dart';
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
import 'package:cutdex_ui/widgets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widget_previews.dart';
|
||||
|
||||
import 'color_interpretation_controls.dart';
|
||||
|
||||
@Preview(
|
||||
name: 'Color — narrow automatic',
|
||||
group: 'Properties',
|
||||
size: Size(220, 220),
|
||||
)
|
||||
Widget narrowColorControlsPreview() => _host(desktop: true);
|
||||
|
||||
@Preview(
|
||||
name: 'Color — manual light',
|
||||
group: 'Properties',
|
||||
size: Size(280, 220),
|
||||
)
|
||||
Widget manualColorControlsPreview() =>
|
||||
_host(desktop: true, brightness: Brightness.light, value: 'rec2020HLG');
|
||||
|
||||
@Preview(name: 'Color — loading', group: 'Properties', size: Size(260, 220))
|
||||
Widget loadingColorControlsPreview() => _host(desktop: true, loading: true);
|
||||
|
||||
@Preview(name: 'Color — mobile', group: 'Properties', size: Size(400, 260))
|
||||
Widget mobileColorControlsPreview() => _host(desktop: false);
|
||||
|
||||
Widget _host({
|
||||
required bool desktop,
|
||||
Brightness brightness = Brightness.dark,
|
||||
String value = 'auto',
|
||||
bool loading = false,
|
||||
}) {
|
||||
final theme = AppTheme.forPalette(AppPalette.graphite, brightness);
|
||||
return MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
locale: const Locale('zh'),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
theme: AppTheme.propertiesPanelTheme(
|
||||
desktop ? AppTheme.desktopWorkspaceTheme(theme) : theme,
|
||||
),
|
||||
home: Scaffold(
|
||||
body: _ColorControlsPreview(initialValue: value, loading: loading),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class _ColorControlsPreview extends StatefulWidget {
|
||||
const _ColorControlsPreview({
|
||||
required this.initialValue,
|
||||
required this.loading,
|
||||
});
|
||||
final String initialValue;
|
||||
final bool loading;
|
||||
|
||||
@override
|
||||
State<_ColorControlsPreview> createState() => _ColorControlsPreviewState();
|
||||
}
|
||||
|
||||
class _ColorControlsPreviewState extends State<_ColorControlsPreview> {
|
||||
late String _value = widget.initialValue;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => ColorInterpretationControls(
|
||||
value: _value,
|
||||
notice: widget.loading ? '色彩信息未读取' : null,
|
||||
onChanged: widget.loading
|
||||
? null
|
||||
: (value) => setState(() => _value = value),
|
||||
options: [
|
||||
AppSelectOption('auto', widget.loading ? '自动' : '自动 · Rec.709'),
|
||||
const AppSelectOption('rec709', 'Rec.709'),
|
||||
const AppSelectOption('rec2020HLG', 'Rec.2020 HLG'),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
import 'package:cutdex/l10n/l10n.dart';
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
import 'package:cutdex_ui/widgets.dart';
|
||||
|
||||
import '../../workspace/media_color_interpretation.dart';
|
||||
import 'color_interpretation_controls.dart';
|
||||
import '../../shared/widgets/listenable_selector.dart';
|
||||
import '../../workspace/timeline_session.dart';
|
||||
import '../preview/preview_panel.dart';
|
||||
@@ -40,20 +40,15 @@ class ColorInterpretationProperties extends ConsumerWidget {
|
||||
final detected = colors?.elementAtOrNull(trackIndex);
|
||||
final reported =
|
||||
colors != null && trackIndex >= 0 && trackIndex < colors.length;
|
||||
final status = selected != null
|
||||
? context.l10n.manualColorSpace(selected.label(context.l10n))
|
||||
: detected != null
|
||||
? context.l10n.detectedColorSpace(detected.label(context.l10n))
|
||||
: reported
|
||||
final notice = !reported
|
||||
? context.l10n.colorInfoNotLoaded
|
||||
: selected == null && detected == null
|
||||
? context.l10n.unknownColorSpace
|
||||
: context.l10n.colorInfoNotLoaded;
|
||||
final selector = AppSelect<String>(
|
||||
emptyLabel: context.l10n.noMatchingOptions,
|
||||
key: const Key('media-color-menu'),
|
||||
outlined: false,
|
||||
label: context.l10n.mediaColorInterpretation,
|
||||
: null;
|
||||
return ColorInterpretationControls(
|
||||
value: selected?.name ?? 'auto',
|
||||
onChanged: !reported
|
||||
notice: notice,
|
||||
onChanged: !reported || !session.acceptsEdits
|
||||
? null
|
||||
: (value) => session.commands.setMediaColor(
|
||||
assetId,
|
||||
@@ -61,66 +56,16 @@ class ColorInterpretationProperties extends ConsumerWidget {
|
||||
value == 'auto' ? null : MediaColorSpace.values.byName(value),
|
||||
),
|
||||
options: [
|
||||
AppSelectOption('auto', context.l10n.auto),
|
||||
AppSelectOption(
|
||||
'auto',
|
||||
detected == null
|
||||
? context.l10n.auto
|
||||
: '${context.l10n.auto} · ${detected.label(context.l10n)}',
|
||||
),
|
||||
for (final color in RenderColorSpace.values)
|
||||
AppSelectOption(color.name, color.label(context.l10n)),
|
||||
],
|
||||
);
|
||||
final controls = Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
spacing: AppSpacing.gap,
|
||||
children: [
|
||||
if (AppTheme.isDesktop(context)) ...[
|
||||
AppPropertyGroup(
|
||||
label: context.l10n.mediaColorSpace,
|
||||
child: selector,
|
||||
),
|
||||
] else
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
context.l10n.mediaColorSpace,
|
||||
style: AppTheme.propertySectionTitleStyle(context),
|
||||
),
|
||||
),
|
||||
Flexible(child: selector),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
status,
|
||||
key: const Key('media-color-status'),
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
],
|
||||
);
|
||||
return Padding(
|
||||
padding: AppTheme.propertySectionPadding(context),
|
||||
child: AppTheme.isDesktop(context)
|
||||
? ExpansionTile(
|
||||
key: PageStorageKey((
|
||||
'media-color-section',
|
||||
assetId,
|
||||
trackIndex,
|
||||
)),
|
||||
title: Text(
|
||||
context.l10n.mediaColorInterpretation,
|
||||
style: AppTheme.propertySectionTitleStyle(context),
|
||||
),
|
||||
tilePadding: EdgeInsets.zero,
|
||||
childrenPadding: const EdgeInsets.only(
|
||||
top: AppInspectorMetrics.rowGap,
|
||||
),
|
||||
minTileHeight: AppInspectorMetrics.input,
|
||||
dense: true,
|
||||
maintainState: true,
|
||||
initiallyExpanded: selected != null,
|
||||
shape: const Border(),
|
||||
collapsedShape: const Border(),
|
||||
children: [controls],
|
||||
)
|
||||
: controls,
|
||||
);
|
||||
}
|
||||
|
||||
return ListenableSelector(
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
import 'package:cutdex/l10n/l10n.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:cutdex_core/timeline/engine.dart';
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
import 'package:cutdex_ui/widgets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widget_previews.dart';
|
||||
|
||||
import 'property_keyframe_controls.dart';
|
||||
import 'property_number_input.dart';
|
||||
|
||||
/// Presentation of four position channels; editing and native lifetime live in the host.
|
||||
class DistortionParameterEditor extends StatelessWidget {
|
||||
const DistortionParameterEditor({
|
||||
super.key,
|
||||
required this.value,
|
||||
required this.extent,
|
||||
required this.enabled,
|
||||
required this.editing,
|
||||
required this.perspective,
|
||||
required this.keyframes,
|
||||
required this.editContext,
|
||||
required this.onSubmit,
|
||||
required this.onReset,
|
||||
required this.onPerspective,
|
||||
this.onToggle,
|
||||
this.error,
|
||||
});
|
||||
final ClipDistortion value;
|
||||
final Size extent;
|
||||
final bool enabled, editing, perspective;
|
||||
final PropertyKeyframeControls keyframes;
|
||||
final Object editContext;
|
||||
final Future<bool> Function(int corner, int axis, double value) onSubmit;
|
||||
final VoidCallback? onToggle;
|
||||
final VoidCallback onReset;
|
||||
final ValueChanged<bool> onPerspective;
|
||||
final String? error;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final keys = keyframes, l = context.l10n;
|
||||
final labels = [
|
||||
l.distortionTopLeft,
|
||||
l.distortionTopRight,
|
||||
l.distortionBottomRight,
|
||||
l.distortionBottomLeft,
|
||||
];
|
||||
return AppPropertySection(
|
||||
child: AppPropertyGroup(
|
||||
label: l.distortion,
|
||||
padChild: false,
|
||||
actions: [
|
||||
keys.button(
|
||||
context,
|
||||
ClipDistortion.ids,
|
||||
l.distortion,
|
||||
'distortion-key',
|
||||
),
|
||||
keys.menu(context, ClipDistortion.ids, l.distortion, 'distortion'),
|
||||
],
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
AppPropertyRow(
|
||||
children: [
|
||||
TextButton(
|
||||
key: const ValueKey('distortion-edit'),
|
||||
onPressed: enabled ? onToggle : null,
|
||||
child: Text(editing ? l.finishDistortion : l.editDistortion),
|
||||
),
|
||||
IconButton(
|
||||
key: const ValueKey('distortion-reset'),
|
||||
tooltip: l.resetDistortion,
|
||||
icon: const Icon(AppIcons.reset, size: 16),
|
||||
onPressed: enabled ? onReset : null,
|
||||
),
|
||||
],
|
||||
),
|
||||
AppPropertyRow(
|
||||
children: [
|
||||
AppSelect<bool>(
|
||||
value: perspective,
|
||||
label: l.distortion,
|
||||
emptyLabel: l.freeDistortion,
|
||||
options: [
|
||||
AppSelectOption(false, l.freeDistortion),
|
||||
AppSelectOption(true, l.perspectiveDistortion),
|
||||
],
|
||||
onChanged: enabled ? onPerspective : null,
|
||||
),
|
||||
],
|
||||
),
|
||||
for (var i = 0; i < 4; i++) ...[
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
labels[i],
|
||||
style: Theme.of(context).textTheme.labelSmall,
|
||||
),
|
||||
),
|
||||
keys.menu(
|
||||
context,
|
||||
ClipDistortion.ids.sublist(i * 2, i * 2 + 2),
|
||||
labels[i],
|
||||
'distortion-${ClipDistortion.names[i]}',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
AppPropertyRow(
|
||||
trailing: keys.button(
|
||||
context,
|
||||
ClipDistortion.ids.sublist(i * 2, i * 2 + 2),
|
||||
labels[i],
|
||||
'distortion-${ClipDistortion.names[i]}-key',
|
||||
),
|
||||
children: [
|
||||
for (var axis = 0; axis < 2; axis++)
|
||||
PropertyNumberInput(
|
||||
key: ValueKey(
|
||||
'distortion-${ClipDistortion.names[i]}-${axis == 0 ? 'x' : 'y'}',
|
||||
),
|
||||
label: axis == 0 ? 'X' : 'Y',
|
||||
inlineLabel: true,
|
||||
prefix: axis == 0 ? 'X' : 'Y',
|
||||
value:
|
||||
value.values[i * 2 + axis] *
|
||||
(axis == 0 ? extent.width : extent.height),
|
||||
enabled: enabled,
|
||||
readOnly: false,
|
||||
editContext: editContext,
|
||||
submit: (v) => onSubmit(i, axis, v),
|
||||
onScrubUpdate: (_) {},
|
||||
onScrubEnd: () {},
|
||||
onScrubCancel: () {},
|
||||
scrubbing: false,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
if (error != null)
|
||||
Padding(padding: const EdgeInsets.all(16), child: Text(error!)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(name: 'Distortion / desktop', size: Size(240, 400))
|
||||
Widget distortionEditorPreview() {
|
||||
var value = const ClipDistortion(topLeft: (.05, .1));
|
||||
var perspective = false, editing = false;
|
||||
final stack = ClipParameterAnimation(
|
||||
ElementRecord(
|
||||
id: ElementId('preview'),
|
||||
structure: ElementStructure.content,
|
||||
duration: 1,
|
||||
sourceStart: 0,
|
||||
sourceDuration: 1,
|
||||
enabled: true,
|
||||
),
|
||||
0,
|
||||
);
|
||||
return MaterialApp(
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
theme: AppTheme.propertiesPanelTheme(
|
||||
AppTheme.desktopWorkspaceTheme(AppTheme.penDark),
|
||||
),
|
||||
home: Scaffold(
|
||||
body: StatefulBuilder(
|
||||
builder: (context, update) => SingleChildScrollView(
|
||||
child: DistortionParameterEditor(
|
||||
value: value,
|
||||
extent: const Size(300, 200),
|
||||
enabled: true,
|
||||
editing: editing,
|
||||
perspective: perspective,
|
||||
editContext: 'preview',
|
||||
keyframes: PropertyKeyframeControls(
|
||||
stack: stack,
|
||||
enabled: true,
|
||||
onEdit: (ids, {action, interpolation}) async => true,
|
||||
onSeek: (_) async => true,
|
||||
),
|
||||
onSubmit: (corner, axis, input) async {
|
||||
final p = value.corners[corner];
|
||||
final next = value.withCorner(
|
||||
corner,
|
||||
axis == 0 ? input / 300 : p.$1,
|
||||
axis == 1 ? input / 200 : p.$2,
|
||||
);
|
||||
if (!next.isValid) return false;
|
||||
update(() => value = next);
|
||||
return true;
|
||||
},
|
||||
onReset: () => update(() => value = const ClipDistortion()),
|
||||
onToggle: () => update(() => editing = !editing),
|
||||
onPerspective: (v) => update(() => perspective = v),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:cutdex/l10n/l10n.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../workspace/timeline_session.dart';
|
||||
import '../preview/preview_panel.dart';
|
||||
import 'property_edit_controller.dart';
|
||||
import 'property_keyframe_controls.dart';
|
||||
import 'distortion_parameter_editor.dart';
|
||||
|
||||
class DistortionProperties extends ConsumerStatefulWidget {
|
||||
const DistortionProperties({
|
||||
super.key,
|
||||
required this.projectId,
|
||||
required this.timelineId,
|
||||
required this.session,
|
||||
required this.sequence,
|
||||
required this.clip,
|
||||
});
|
||||
final String projectId, timelineId;
|
||||
final EditorTimelineSession session;
|
||||
final SequenceId sequence;
|
||||
final ElementId clip;
|
||||
@override
|
||||
ConsumerState<DistortionProperties> createState() =>
|
||||
_DistortionPropertiesState();
|
||||
}
|
||||
|
||||
class _DistortionPropertiesState extends ConsumerState<DistortionProperties> {
|
||||
PropertyEditController _create() => PropertyEditController(
|
||||
session: widget.session,
|
||||
sequence: widget.sequence,
|
||||
clip: widget.clip,
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
operation: 'setTransform',
|
||||
);
|
||||
late PropertyEditController _controller = _create();
|
||||
PreviewController? _preview;
|
||||
bool _perspective = false;
|
||||
void _release() {
|
||||
final previous = _preview;
|
||||
_preview = null;
|
||||
if (previous != null) {
|
||||
scheduleMicrotask(() => previous.releaseDistortionEditing(this));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant DistortionProperties oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (_controller.identity !=
|
||||
(
|
||||
widget.session,
|
||||
widget.sequence,
|
||||
widget.clip,
|
||||
widget.projectId,
|
||||
widget.timelineId,
|
||||
)) {
|
||||
_release();
|
||||
_controller.dispose();
|
||||
_controller = _create();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_release();
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final preview = ref
|
||||
.watch(editorPreviewProvider(widget.projectId, widget.timelineId))
|
||||
.asData
|
||||
?.value;
|
||||
if (!identical(_preview, preview)) {
|
||||
_release();
|
||||
_preview = preview;
|
||||
}
|
||||
final view = widget.session.view(widget.sequence);
|
||||
return ListenableBuilder(
|
||||
listenable: Listenable.merge([
|
||||
_controller,
|
||||
view,
|
||||
if (preview != null) preview.transforms,
|
||||
if (preview != null) preview.positionChanges,
|
||||
]),
|
||||
builder: (context, _) {
|
||||
final stack = _controller.animation;
|
||||
if (stack == null) return const SizedBox.shrink();
|
||||
final visual = preview?.visualForProperties(widget.clip);
|
||||
final value = preview?.transforms.hasPending == true && visual != null
|
||||
? visual.transform
|
||||
: ClipTransform.fromRecord(
|
||||
stack.record,
|
||||
sourceTick: stack.sourceTick,
|
||||
);
|
||||
final extent =
|
||||
visual?.geometry.distortionSize ??
|
||||
Size(widget.session.canvas.width, widget.session.canvas.height);
|
||||
final enabled =
|
||||
!_controller.saving &&
|
||||
stack.containsPlayhead &&
|
||||
preview?.transforms.hasPending != true;
|
||||
Future<bool> edit(void Function(EditorCommandService, int) action) =>
|
||||
_controller.run(preview, action);
|
||||
final keys = PropertyKeyframeControls(
|
||||
stack: stack,
|
||||
enabled: enabled,
|
||||
onEdit: (ids, {action, interpolation}) => edit(
|
||||
(c, t) => c.editKeyframeChannel(
|
||||
sequence: widget.sequence,
|
||||
clip: widget.clip,
|
||||
tick: t,
|
||||
parameterIds: ids,
|
||||
action: action,
|
||||
interpolation: interpolation,
|
||||
),
|
||||
),
|
||||
onSeek: (offset) => _controller.run(
|
||||
preview,
|
||||
(_, t) => view.seekTo(t - stack.localTick + offset),
|
||||
seek: true,
|
||||
),
|
||||
);
|
||||
final editing = preview?.distortionEditingElement == widget.clip;
|
||||
final l = context.l10n;
|
||||
Future<bool> submit(int corner, int axis, double input) => edit(
|
||||
(c, t) => c.setTransform(
|
||||
sequence: widget.sequence,
|
||||
clip: widget.clip,
|
||||
tick: t,
|
||||
change: (current) {
|
||||
final p = current.distortion.corners[corner];
|
||||
return current.copyWith(
|
||||
distortion: current.distortion.withCorner(
|
||||
corner,
|
||||
axis == 0 ? input / extent.width : p.$1,
|
||||
axis == 1 ? input / extent.height : p.$2,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
return DistortionParameterEditor(
|
||||
value: value.distortion,
|
||||
extent: extent,
|
||||
enabled: enabled,
|
||||
editing: editing,
|
||||
perspective: _perspective,
|
||||
keyframes: keys,
|
||||
editContext: _controller.identity,
|
||||
error: _controller.failed ? l.updateOperationFailed : null,
|
||||
onSubmit: submit,
|
||||
onToggle: preview == null
|
||||
? null
|
||||
: () => _controller.run(
|
||||
preview,
|
||||
(_, t) => preview.setDistortionEditing(
|
||||
editing ? null : widget.clip,
|
||||
owner: this,
|
||||
perspective: _perspective,
|
||||
),
|
||||
seek: true,
|
||||
),
|
||||
onReset: () => edit(
|
||||
(c, t) => c.setTransform(
|
||||
sequence: widget.sequence,
|
||||
clip: widget.clip,
|
||||
tick: t,
|
||||
change: (v) => v.copyWith(distortion: const ClipDistortion()),
|
||||
),
|
||||
),
|
||||
onPerspective: (v) {
|
||||
setState(() => _perspective = v);
|
||||
if (editing) {
|
||||
preview!.setDistortionEditing(
|
||||
widget.clip,
|
||||
owner: this,
|
||||
perspective: v,
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import 'package:cutdex/l10n/l10n.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
extension EffectTypeLabel on ClipEffectType {
|
||||
String label(BuildContext context) => switch (this) {
|
||||
ClipEffectType.dropShadow => context.l10n.dropShadow,
|
||||
ClipEffectType.innerShadow => context.l10n.innerShadow,
|
||||
ClipEffectType.layerBlur => context.l10n.layerBlur,
|
||||
ClipEffectType.backgroundBlur => context.l10n.backgroundBlur,
|
||||
ClipEffectType.glass => context.l10n.glassEffect,
|
||||
ClipEffectType.noise => context.l10n.noiseEffect,
|
||||
ClipEffectType.texture => context.l10n.textureEffect,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
import 'package:cutdex/l10n/l10n.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
import 'package:cutdex_ui/widgets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'property_keyframe_controls.dart';
|
||||
import 'effect_labels.dart';
|
||||
import 'property_layer_row.dart';
|
||||
|
||||
class EffectList extends StatelessWidget {
|
||||
const EffectList({
|
||||
super.key,
|
||||
required this.stack,
|
||||
required this.enabled,
|
||||
required this.keyframes,
|
||||
required this.onAdd,
|
||||
required this.onReorder,
|
||||
required this.onToggle,
|
||||
required this.onRemove,
|
||||
required this.editorBuilder,
|
||||
this.error,
|
||||
});
|
||||
final ClipEffectStack stack;
|
||||
final bool enabled;
|
||||
final PropertyKeyframeControls keyframes;
|
||||
final void Function(ClipEffectType) onAdd;
|
||||
final void Function(List<String>) onReorder;
|
||||
final void Function(ClipEffectLayer) onToggle, onRemove;
|
||||
final Widget Function(ClipEffectLayer) editorBuilder;
|
||||
final String? error;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final layers = stack.layers;
|
||||
return AppPropertySection(
|
||||
bottomSpacing: layers.isEmpty ? 0 : null,
|
||||
child: AppPropertyGroup(
|
||||
label: context.l10n.effects,
|
||||
padChild: false,
|
||||
actions: [
|
||||
keyframes.button(
|
||||
context,
|
||||
stack.parameterIds,
|
||||
context.l10n.effects,
|
||||
'effects-key',
|
||||
),
|
||||
AppDropdownMenu(
|
||||
enabled: enabled,
|
||||
builder: (context, toggle, focus) => IconButton(
|
||||
key: const ValueKey('effect-add'),
|
||||
focusNode: focus,
|
||||
tooltip: context.l10n.addEffect,
|
||||
onPressed: enabled ? toggle : null,
|
||||
icon: const Icon(AppIcons.add, size: 16),
|
||||
),
|
||||
items: [
|
||||
for (final type in ClipEffectType.values)
|
||||
AppMenuItem(
|
||||
label: type.label(context),
|
||||
onPressed: enabled && stack.canAdd(type)
|
||||
? () => onAdd(type)
|
||||
: null,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
ReorderableListView(
|
||||
shrinkWrap: true,
|
||||
primary: false,
|
||||
padding: EdgeInsets.zero,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
buildDefaultDragHandles: false,
|
||||
onReorderItem: (from, to) {
|
||||
if (!enabled) return;
|
||||
final order = layers.map((l) => l.id).toList();
|
||||
order.insert(to, order.removeAt(from));
|
||||
onReorder(order);
|
||||
},
|
||||
children: [
|
||||
for (var i = 0; i < layers.length; i++)
|
||||
PropertyLayerRow(
|
||||
key: ValueKey('effect-layer-${layers[i].id}'),
|
||||
id: layers[i].id,
|
||||
prefix: 'effect',
|
||||
index: i,
|
||||
enabled: enabled,
|
||||
visible: layers[i].enabled,
|
||||
label: layers[i].type.label(context),
|
||||
tooltip: context.l10n.effects,
|
||||
onVisibility: () => onToggle(layers[i]),
|
||||
onRemove: () => onRemove(layers[i]),
|
||||
menuItems: [
|
||||
for (final (delta, label) in [
|
||||
(-1, context.l10n.effectMoveUp),
|
||||
(1, context.l10n.effectMoveDown),
|
||||
])
|
||||
AppMenuItem(
|
||||
label: label,
|
||||
closeAncestors: false,
|
||||
onPressed:
|
||||
!enabled ||
|
||||
i + delta < 0 ||
|
||||
i + delta >= layers.length
|
||||
? null
|
||||
: () {
|
||||
final order = layers
|
||||
.map((l) => l.id)
|
||||
.toList();
|
||||
order.insert(i + delta, order.removeAt(i));
|
||||
onReorder(order);
|
||||
},
|
||||
),
|
||||
],
|
||||
editor: editorBuilder(layers[i]),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (error != null)
|
||||
Text(
|
||||
error!,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,245 @@
|
||||
import 'package:cutdex/l10n/l10n.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
import 'package:cutdex_ui/widgets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'property_keyframe_controls.dart';
|
||||
import 'effect_labels.dart';
|
||||
import 'property_color_input.dart';
|
||||
import 'property_number_input.dart';
|
||||
|
||||
class EffectParameterEditor extends StatelessWidget {
|
||||
const EffectParameterEditor({
|
||||
super.key,
|
||||
required this.layer,
|
||||
required this.stack,
|
||||
required this.enabled,
|
||||
required this.editContext,
|
||||
required this.keyframes,
|
||||
required this.onChange,
|
||||
required this.onTypeChange,
|
||||
});
|
||||
final ClipEffectLayer layer;
|
||||
final ClipEffectStack stack;
|
||||
final bool enabled;
|
||||
final Object editContext;
|
||||
final PropertyKeyframeControls keyframes;
|
||||
final Future<bool> Function(Map<String, double>) onChange;
|
||||
final void Function(ClipEffectType) onTypeChange;
|
||||
|
||||
String _fieldLabel(BuildContext context, String field) => switch (field) {
|
||||
'x' => 'X',
|
||||
'y' => 'Y',
|
||||
'blur' => context.l10n.shadowBlur,
|
||||
'spread' => context.l10n.shadowSpread,
|
||||
'opacity' => context.l10n.shadowOpacity,
|
||||
'blurEnd' => context.l10n.effectBlurEnd,
|
||||
'start.x' => context.l10n.effectStartX,
|
||||
'start.y' => context.l10n.effectStartY,
|
||||
'end.x' => context.l10n.effectEndX,
|
||||
'end.y' => context.l10n.effectEndY,
|
||||
'lightAngle' => context.l10n.effectLightAngle,
|
||||
'lightIntensity' => context.l10n.effectLightIntensity,
|
||||
'refraction' => context.l10n.effectRefraction,
|
||||
'depth' => context.l10n.effectDepth,
|
||||
'dispersion' => context.l10n.effectDispersion,
|
||||
'frost' => context.l10n.effectFrost,
|
||||
'splay' => context.l10n.effectSplay,
|
||||
'size' => context.l10n.effectNoiseSize,
|
||||
'density' => context.l10n.effectDensity,
|
||||
'radius' => context.l10n.effectTextureRadius,
|
||||
'seed' => context.l10n.effectSeed,
|
||||
_ => field,
|
||||
};
|
||||
Widget _number(BuildContext context, String field) {
|
||||
final label = _fieldLabel(context, field);
|
||||
final structural = EffectParameterTarget.structural.contains(field);
|
||||
final percentage = {
|
||||
'opacity',
|
||||
'density',
|
||||
'lightIntensity',
|
||||
'splay',
|
||||
}.contains(field);
|
||||
final factor = percentage ? 100.0 : 1.0;
|
||||
final definition = EffectParameterTarget.definition(field);
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 4),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: PropertyNumberInput(
|
||||
key: ValueKey('effect-${layer.id}-$field'),
|
||||
label: label,
|
||||
value: layer.values[field]! * factor,
|
||||
unit: percentage ? '%' : null,
|
||||
enabled: enabled && layer.enabled,
|
||||
readOnly: false,
|
||||
scrubbing: false,
|
||||
editContext: (editContext, layer.id, layer.type),
|
||||
onScrubUpdate: (_) {},
|
||||
onScrubEnd: () {},
|
||||
onScrubCancel: () {},
|
||||
submit: (v) => !definition.accepts(v / factor)
|
||||
? Future.value(false)
|
||||
: onChange({field: v / factor}),
|
||||
),
|
||||
),
|
||||
if (!structural) ...[
|
||||
keyframes.button(
|
||||
context,
|
||||
[layer.target(field)],
|
||||
label,
|
||||
'effect-${layer.id}-$field-key',
|
||||
),
|
||||
keyframes.menu(
|
||||
context,
|
||||
[layer.target(field)],
|
||||
label,
|
||||
'effect-${layer.id}-$field',
|
||||
),
|
||||
] else
|
||||
const SizedBox(width: 48),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _color(BuildContext context, String prefix, String label) {
|
||||
final fields = ['${prefix}r', '${prefix}g', '${prefix}b'];
|
||||
final values = fields.map((f) => layer.values[f]!).toList();
|
||||
final hex = values
|
||||
.map((v) => (v * 255).round().toRadixString(16).padLeft(2, '0'))
|
||||
.join()
|
||||
.toUpperCase();
|
||||
final ids = fields.map(layer.target).toList();
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(label, style: AppTheme.propertyLabelStyle(context)),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: PropertyColorInput(
|
||||
key: ValueKey('effect-${layer.id}-$prefix'),
|
||||
value: hex,
|
||||
color: Color.from(
|
||||
alpha: 1,
|
||||
red: values[0],
|
||||
green: values[1],
|
||||
blue: values[2],
|
||||
),
|
||||
enabled: enabled && layer.enabled,
|
||||
editContext: (editContext, layer.id, layer.type),
|
||||
submit: (rgb) => onChange({
|
||||
fields[0]: ((rgb >> 16) & 255) / 255,
|
||||
fields[1]: ((rgb >> 8) & 255) / 255,
|
||||
fields[2]: (rgb & 255) / 255,
|
||||
}),
|
||||
),
|
||||
),
|
||||
keyframes.button(
|
||||
context,
|
||||
ids,
|
||||
label,
|
||||
'effect-${layer.id}-$prefix-key',
|
||||
),
|
||||
keyframes.menu(context, ids, label, 'effect-${layer.id}-$prefix'),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _mode(BuildContext context, String field, List<String> labels) =>
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
child: SizedBox(
|
||||
height: 24,
|
||||
child: AppSelect<int>(
|
||||
closeAncestors: false,
|
||||
key: ValueKey('effect-${layer.id}-$field'),
|
||||
value: layer.values[field]!.round(),
|
||||
label: field == 'noiseMode'
|
||||
? context.l10n.effectNoiseMode
|
||||
: context.l10n.shadowBlur,
|
||||
emptyLabel: context.l10n.effects,
|
||||
options: [
|
||||
for (var i = 0; i < labels.length; i++)
|
||||
AppSelectOption(i, labels[i]),
|
||||
],
|
||||
onChanged: enabled && layer.enabled
|
||||
? (v) => onChange({field: v.toDouble()})
|
||||
: null,
|
||||
),
|
||||
),
|
||||
);
|
||||
@override
|
||||
Widget build(BuildContext context) => Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 24,
|
||||
child: AppSelect<ClipEffectType>(
|
||||
closeAncestors: false,
|
||||
key: ValueKey('effect-${layer.id}-type'),
|
||||
value: layer.type,
|
||||
label: context.l10n.effects,
|
||||
emptyLabel: context.l10n.effects,
|
||||
options: [
|
||||
for (final type in ClipEffectType.values)
|
||||
if (stack.canAdd(type, excludingId: layer.id))
|
||||
AppSelectOption(type, type.label(context)),
|
||||
],
|
||||
onChanged: enabled ? onTypeChange : null,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
if (layer.values.containsKey('progressive'))
|
||||
_mode(context, 'progressive', [
|
||||
context.l10n.effectUniform,
|
||||
context.l10n.effectProgressive,
|
||||
]),
|
||||
if (layer.values.containsKey('noiseMode'))
|
||||
_mode(context, 'noiseMode', [
|
||||
context.l10n.effectMono,
|
||||
context.l10n.effectDuo,
|
||||
context.l10n.effectMulti,
|
||||
]),
|
||||
for (final field in layer.values.keys)
|
||||
if (!field.startsWith('color') &&
|
||||
!{'progressive', 'noiseMode', 'clipToShape'}.contains(field) &&
|
||||
!(layer.values['progressive'] == 0 &&
|
||||
{
|
||||
'blurEnd',
|
||||
'start.x',
|
||||
'start.y',
|
||||
'end.x',
|
||||
'end.y',
|
||||
}.contains(field)))
|
||||
_number(context, field),
|
||||
if (layer.values.containsKey('color.r') && layer.values['noiseMode'] != 2)
|
||||
_color(context, 'color.', context.l10n.color),
|
||||
if (layer.values['noiseMode'] == 1)
|
||||
_color(context, 'color2.', context.l10n.effectSecondColor),
|
||||
if (layer.values.containsKey('clipToShape'))
|
||||
CheckboxListTile(
|
||||
key: ValueKey('effect-${layer.id}-clipToShape'),
|
||||
dense: true,
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: Text(
|
||||
context.l10n.effectClipToShape,
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
value: layer.values['clipToShape'] == 1,
|
||||
onChanged: enabled && layer.enabled
|
||||
? (v) => onChange({'clipToShape': v == true ? 1 : 0})
|
||||
: null,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
import 'package:cutdex/l10n/l10n.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../workspace/timeline_session.dart';
|
||||
import '../preview/preview_panel.dart';
|
||||
import 'property_edit_controller.dart';
|
||||
import 'property_keyframe_controls.dart';
|
||||
import 'effect_list.dart';
|
||||
import 'effect_parameter_editor.dart';
|
||||
|
||||
class EffectProperties extends ConsumerStatefulWidget {
|
||||
const EffectProperties({
|
||||
super.key,
|
||||
required this.projectId,
|
||||
required this.timelineId,
|
||||
required this.session,
|
||||
required this.sequence,
|
||||
required this.clip,
|
||||
});
|
||||
final String projectId, timelineId;
|
||||
final EditorTimelineSession session;
|
||||
final SequenceId sequence;
|
||||
final ElementId clip;
|
||||
|
||||
@override
|
||||
ConsumerState<EffectProperties> createState() => _EffectPropertiesState();
|
||||
}
|
||||
|
||||
class _EffectPropertiesState extends ConsumerState<EffectProperties> {
|
||||
Object get _identity => (
|
||||
widget.session,
|
||||
widget.sequence,
|
||||
widget.clip,
|
||||
widget.projectId,
|
||||
widget.timelineId,
|
||||
);
|
||||
PropertyEditController _createController() => PropertyEditController(
|
||||
session: widget.session,
|
||||
sequence: widget.sequence,
|
||||
clip: widget.clip,
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
operation: 'editEffect',
|
||||
);
|
||||
late PropertyEditController _controller = _createController();
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant EffectProperties oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (_controller.identity != _identity) {
|
||||
_controller.dispose();
|
||||
_controller = _createController();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final preview = ref
|
||||
.watch(editorPreviewProvider(widget.projectId, widget.timelineId))
|
||||
.asData
|
||||
?.value;
|
||||
final controller = _controller;
|
||||
final view = widget.session.view(widget.sequence);
|
||||
return ListenableBuilder(
|
||||
listenable: Listenable.merge([controller, view]),
|
||||
builder: (context, _) {
|
||||
final animation = controller.animation;
|
||||
if (animation == null) return const SizedBox.shrink();
|
||||
final stack = ClipEffectStack(animation.record, animation.localTick);
|
||||
final enabled =
|
||||
!controller.saving &&
|
||||
stack.containsPlayhead &&
|
||||
preview?.transforms.hasPending != true;
|
||||
Future<bool> edit(void Function(EditorCommandService, int) action) =>
|
||||
controller.run(preview, action);
|
||||
final keyframes = PropertyKeyframeControls(
|
||||
stack: stack,
|
||||
enabled: enabled,
|
||||
onEdit: (ids, {action, interpolation}) => edit(
|
||||
(c, t) => c.editKeyframeChannel(
|
||||
sequence: widget.sequence,
|
||||
clip: widget.clip,
|
||||
tick: t,
|
||||
parameterIds: ids,
|
||||
action: action,
|
||||
interpolation: interpolation,
|
||||
),
|
||||
),
|
||||
onSeek: (offset) => controller.run(
|
||||
preview,
|
||||
(_, tick) => view.seekTo(tick - stack.localTick + offset),
|
||||
seek: true,
|
||||
),
|
||||
);
|
||||
return EffectList(
|
||||
stack: stack,
|
||||
enabled: enabled,
|
||||
keyframes: keyframes,
|
||||
error: controller.failed ? context.l10n.updateEffectFailed : null,
|
||||
onAdd: (type) => edit(
|
||||
(c, t) => c.addEffect(
|
||||
sequence: widget.sequence,
|
||||
clip: widget.clip,
|
||||
tick: t,
|
||||
effectId: c.newEffectId(),
|
||||
type: type,
|
||||
),
|
||||
),
|
||||
onReorder: (order) => edit(
|
||||
(c, t) => c.configureEffects(
|
||||
sequence: widget.sequence,
|
||||
clip: widget.clip,
|
||||
tick: t,
|
||||
order: order,
|
||||
),
|
||||
),
|
||||
onToggle: (layer) => edit(
|
||||
(c, t) => c.configureEffects(
|
||||
sequence: widget.sequence,
|
||||
clip: widget.clip,
|
||||
tick: t,
|
||||
effectId: layer.id,
|
||||
enabled: !layer.enabled,
|
||||
),
|
||||
),
|
||||
onRemove: (layer) => edit(
|
||||
(c, t) => c.removeEffect(
|
||||
sequence: widget.sequence,
|
||||
clip: widget.clip,
|
||||
tick: t,
|
||||
effectId: layer.id,
|
||||
),
|
||||
),
|
||||
editorBuilder: (layer) => EffectParameterEditor(
|
||||
layer: layer,
|
||||
stack: stack,
|
||||
enabled: enabled,
|
||||
editContext: controller.identity,
|
||||
keyframes: keyframes,
|
||||
onChange: (values) => edit(
|
||||
(c, t) => c.setEffect(
|
||||
sequence: widget.sequence,
|
||||
clip: widget.clip,
|
||||
tick: t,
|
||||
effectId: layer.id,
|
||||
values: values,
|
||||
),
|
||||
),
|
||||
onTypeChange: (type) => edit(
|
||||
(c, t) => c.changeEffectType(
|
||||
sequence: widget.sequence,
|
||||
clip: widget.clip,
|
||||
tick: t,
|
||||
effectId: layer.id,
|
||||
type: type,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -9,9 +9,9 @@ import 'package:cutdex/l10n/l10n.dart';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:cutdex/features/properties/animation_labels.dart';
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/preview.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
@@ -180,7 +180,7 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
|
||||
}
|
||||
},
|
||||
child: ListenableSelector<Object>(
|
||||
listenable: preview,
|
||||
listenable: Listenable.merge([preview, preview.positionChanges]),
|
||||
select: () {
|
||||
final mask = preview.maskFor(widget.element);
|
||||
final animation = preview.maskAnimation(widget.element);
|
||||
@@ -264,10 +264,11 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
|
||||
}) => PropertyNumberInput(
|
||||
key: ValueKey((selectedId, label)),
|
||||
label: label,
|
||||
inlineLabel: inlineLabel,
|
||||
labelActions: AppTheme.isDesktop(context) && !inlineLabel
|
||||
? [key(label)]
|
||||
: const [],
|
||||
inlineLabel: inlineLabel || AppTheme.isDesktop(context),
|
||||
prefix: AppTheme.isDesktop(context) && !inlineLabel ? '' : null,
|
||||
prefixIcon: AppTheme.isDesktop(context) && wrapRotation
|
||||
? AppIcons.angle
|
||||
: null,
|
||||
unit: unit,
|
||||
value: value,
|
||||
enabled: enabled,
|
||||
@@ -338,45 +339,65 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
|
||||
if (mounted) setState(() => _scrubField = null);
|
||||
},
|
||||
);
|
||||
Widget axes(String label, Widget first, Widget second) =>
|
||||
LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final desktop = AppTheme.isDesktop(context);
|
||||
final gap = AppTheme.propertyRowGap(context);
|
||||
final pair = constraints.maxWidth < (desktop ? 180 : 240)
|
||||
? Column(
|
||||
children: [
|
||||
first,
|
||||
SizedBox(height: gap),
|
||||
second,
|
||||
],
|
||||
)
|
||||
: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(child: first),
|
||||
SizedBox(width: gap),
|
||||
Expanded(child: second),
|
||||
],
|
||||
);
|
||||
return desktop
|
||||
? AppPropertyGroup(
|
||||
label: label,
|
||||
actions: [key(label)],
|
||||
child: pair,
|
||||
)
|
||||
: Row(
|
||||
children: [
|
||||
Expanded(child: pair),
|
||||
SizedBox(width: gap),
|
||||
key(label),
|
||||
],
|
||||
);
|
||||
},
|
||||
Widget axes(
|
||||
String label,
|
||||
Widget first,
|
||||
Widget second, {
|
||||
Widget? additional,
|
||||
}) => LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final desktop = AppTheme.isDesktop(context);
|
||||
final gap = AppTheme.propertyRowGap(context);
|
||||
if (desktop) {
|
||||
return AppPropertyGroup(
|
||||
label: label,
|
||||
padChild: false,
|
||||
child: Column(
|
||||
children: [
|
||||
AppPropertyRow(
|
||||
trailing: key(label),
|
||||
children: [first, second],
|
||||
),
|
||||
?additional,
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
final pair = constraints.maxWidth < 240
|
||||
? Column(
|
||||
children: [
|
||||
first,
|
||||
SizedBox(height: gap),
|
||||
second,
|
||||
],
|
||||
)
|
||||
: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(child: first),
|
||||
SizedBox(width: gap),
|
||||
Expanded(child: second),
|
||||
],
|
||||
);
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(child: pair),
|
||||
SizedBox(width: gap),
|
||||
key(label),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
Widget singleField(String label, Widget input) =>
|
||||
AppTheme.isDesktop(context)
|
||||
? input
|
||||
? AppPropertyGroup(
|
||||
label: label,
|
||||
padChild: false,
|
||||
child: AppPropertyRow(
|
||||
trailing: key(label),
|
||||
children: [input],
|
||||
),
|
||||
)
|
||||
: Row(
|
||||
children: [
|
||||
Expanded(child: input),
|
||||
@@ -395,8 +416,7 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
|
||||
style: AppTheme.propertySectionTitleStyle(context),
|
||||
),
|
||||
);
|
||||
Widget section(List<Widget> children) => Padding(
|
||||
padding: AppTheme.propertySectionPadding(context),
|
||||
Widget section(List<Widget> children) => AppPropertySection(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: children,
|
||||
@@ -586,8 +606,11 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
|
||||
if (AppTheme.isDesktop(context))
|
||||
AppPropertyGroup(
|
||||
label: context.l10n.type,
|
||||
actions: [shapeReset()],
|
||||
child: shapeSelector(),
|
||||
padChild: false,
|
||||
child: AppPropertyRow(
|
||||
trailing: shapeReset(),
|
||||
children: [shapeSelector()],
|
||||
),
|
||||
)
|
||||
else
|
||||
Row(
|
||||
@@ -620,22 +643,40 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
|
||||
unit: '%',
|
||||
inlineLabel: true,
|
||||
),
|
||||
additional: AppTheme.isDesktop(context)
|
||||
? AppPropertyRow(
|
||||
trailing: key(context.l10n.rotation),
|
||||
children: [
|
||||
field(
|
||||
context.l10n.rotation,
|
||||
mask.rotation,
|
||||
-180,
|
||||
180,
|
||||
(v) => mask.copyWith(rotation: v),
|
||||
unit: '°',
|
||||
wrapRotation: true,
|
||||
),
|
||||
const SizedBox.shrink(),
|
||||
],
|
||||
)
|
||||
: null,
|
||||
),
|
||||
]),
|
||||
section([
|
||||
singleField(
|
||||
context.l10n.rotation,
|
||||
field(
|
||||
if (!AppTheme.isDesktop(context))
|
||||
section([
|
||||
singleField(
|
||||
context.l10n.rotation,
|
||||
mask.rotation,
|
||||
-180,
|
||||
180,
|
||||
(v) => mask.copyWith(rotation: v),
|
||||
unit: '°',
|
||||
wrapRotation: true,
|
||||
field(
|
||||
context.l10n.rotation,
|
||||
mask.rotation,
|
||||
-180,
|
||||
180,
|
||||
(v) => mask.copyWith(rotation: v),
|
||||
unit: '°',
|
||||
wrapRotation: true,
|
||||
),
|
||||
),
|
||||
),
|
||||
]),
|
||||
]),
|
||||
section([
|
||||
heading(context.l10n.size),
|
||||
axes(
|
||||
|
||||
@@ -1,25 +1,19 @@
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/preview.dart';
|
||||
import 'package:cutdex_sdk/timeline/engine.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
import '../../workspace/timeline_session.dart';
|
||||
import 'property_edit_boundary.dart';
|
||||
|
||||
part 'picture_edits.g.dart';
|
||||
part 'picture_edits.freezed.dart';
|
||||
|
||||
enum PictureEditFailure { keyframes, alignment, invalidTransform, transform }
|
||||
|
||||
@freezed
|
||||
abstract class PictureEditTarget with _$PictureEditTarget {
|
||||
const factory PictureEditTarget({
|
||||
required TimelineVersion version,
|
||||
required int tick,
|
||||
}) = _PictureEditTarget;
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class PictureEditException
|
||||
with _$PictureEditException
|
||||
@@ -31,35 +25,16 @@ abstract class PictureEditException
|
||||
@riverpod
|
||||
class PictureEdits extends _$PictureEdits {
|
||||
Future<bool>? _pending;
|
||||
late PropertyEditBoundary _boundary;
|
||||
@override
|
||||
AsyncValue<void> build(
|
||||
EditorTimelineSession session,
|
||||
SequenceId sequence,
|
||||
ElementId clip,
|
||||
) => const AsyncData(null);
|
||||
|
||||
PictureEditTarget _capture() {
|
||||
final view = session.view(sequence);
|
||||
return PictureEditTarget(
|
||||
version: view.version.kernelVersion,
|
||||
tick: view.playheadTick,
|
||||
);
|
||||
}
|
||||
|
||||
bool _valid(
|
||||
PictureEditTarget target,
|
||||
bool Function() isCurrent,
|
||||
PreviewController? preview,
|
||||
) {
|
||||
if (!ref.mounted ||
|
||||
!isCurrent() ||
|
||||
session.activeSequenceId != sequence ||
|
||||
preview?.transforms.hasPending == true) {
|
||||
return false;
|
||||
}
|
||||
final view = session.view(sequence);
|
||||
return target.tick == view.playheadTick &&
|
||||
identical(target.version, view.version.kernelVersion);
|
||||
_boundary = PropertyEditBoundary(session, sequence, clip);
|
||||
ref.onDispose(_boundary.dispose);
|
||||
return const AsyncData(null);
|
||||
}
|
||||
|
||||
ClipAnimation? animation() {
|
||||
@@ -86,10 +61,9 @@ class PictureEdits extends _$PictureEdits {
|
||||
if (state.isLoading || preview?.transforms.hasPending == true) {
|
||||
return Future.value(false);
|
||||
}
|
||||
final target = _capture();
|
||||
final work = _run(PictureEditFailure.transform, () async {
|
||||
await preview?.pauseForCanvasInteraction();
|
||||
if (!_valid(target, isCurrent, preview)) return false;
|
||||
final work = _run(PictureEditFailure.transform, preview, isCurrent, (
|
||||
target,
|
||||
) {
|
||||
final current = animation()?.value;
|
||||
if (current == null) return false;
|
||||
final value = change(current);
|
||||
@@ -100,7 +74,9 @@ class PictureEdits extends _$PictureEdits {
|
||||
value.y == current.y &&
|
||||
value.scale == current.scale &&
|
||||
value.scaleY == current.scaleY &&
|
||||
value.rotation == current.rotation) {
|
||||
value.rotation == current.rotation &&
|
||||
value.sameCorners(current) &&
|
||||
value.distortion.same(current.distortion)) {
|
||||
return true;
|
||||
}
|
||||
session.commands.setTransform(
|
||||
@@ -132,10 +108,7 @@ class PictureEdits extends _$PictureEdits {
|
||||
preview?.transforms.hasPending == true) {
|
||||
return;
|
||||
}
|
||||
final target = _capture();
|
||||
await _run(PictureEditFailure.keyframes, () async {
|
||||
await preview?.pauseForCanvasInteraction();
|
||||
if (!_valid(target, isCurrent, preview)) return false;
|
||||
await _run(PictureEditFailure.keyframes, preview, isCurrent, (target) {
|
||||
session.commands.editKeyframeChannel(
|
||||
sequence: sequence,
|
||||
clip: clip,
|
||||
@@ -154,7 +127,6 @@ class PictureEdits extends _$PictureEdits {
|
||||
required bool Function() isCurrent,
|
||||
}) async {
|
||||
if (state.isLoading || preview.transforms.hasPending) return;
|
||||
final target = _capture();
|
||||
final current = animation();
|
||||
if (current == null) return;
|
||||
final command = AlignClip(
|
||||
@@ -166,12 +138,13 @@ class PictureEdits extends _$PictureEdits {
|
||||
alignment: alignment,
|
||||
expectedVersion: session.version,
|
||||
);
|
||||
await _run(PictureEditFailure.alignment, () async {
|
||||
await preview.pauseForCanvasInteraction();
|
||||
await _run(PictureEditFailure.alignment, preview, isCurrent, (
|
||||
target,
|
||||
) async {
|
||||
await session.alignClip(
|
||||
sequence,
|
||||
command,
|
||||
isCancelled: () => !_valid(target, isCurrent, preview),
|
||||
isCancelled: () => !target.isCurrent,
|
||||
);
|
||||
return true;
|
||||
});
|
||||
@@ -179,24 +152,22 @@ class PictureEdits extends _$PictureEdits {
|
||||
|
||||
Future<bool> _run(
|
||||
PictureEditFailure failure,
|
||||
Future<bool> Function() action,
|
||||
PreviewController? preview,
|
||||
bool Function() isCurrent,
|
||||
FutureOr<bool> Function(PropertyEditContext) action,
|
||||
) async {
|
||||
final lease = ref.keepAlive();
|
||||
state = const AsyncLoading();
|
||||
try {
|
||||
final applied = await session.runEditAsync(
|
||||
switch (failure) {
|
||||
final applied = await _boundary.run(
|
||||
preview,
|
||||
action,
|
||||
isCurrent: () => ref.mounted && isCurrent(),
|
||||
started: () => state = const AsyncLoading(),
|
||||
operation: switch (failure) {
|
||||
PictureEditFailure.keyframes => 'editKeyframes',
|
||||
PictureEditFailure.alignment => 'alignClip',
|
||||
_ => 'setTransform',
|
||||
},
|
||||
sequence,
|
||||
action,
|
||||
context: {
|
||||
'clipIds': [clip.value],
|
||||
'entryPoint': 'property',
|
||||
'playheadTick': session.view(sequence).playheadTick,
|
||||
},
|
||||
);
|
||||
if (ref.mounted) state = const AsyncData(null);
|
||||
return applied;
|
||||
|
||||
@@ -12,318 +12,6 @@ part of 'picture_edits.dart';
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$PictureEditTarget {
|
||||
TimelineVersion get version;
|
||||
int get tick;
|
||||
|
||||
/// Create a copy of PictureEditTarget
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$PictureEditTargetCopyWith<PictureEditTarget> get copyWith =>
|
||||
_$PictureEditTargetCopyWithImpl<PictureEditTarget>(
|
||||
this as PictureEditTarget,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
final _this = this as PictureEditTarget;
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is PictureEditTarget &&
|
||||
(identical(other.version, _this.version) ||
|
||||
other.version == _this.version) &&
|
||||
(identical(other.tick, _this.tick) || other.tick == _this.tick));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
final _this = this as PictureEditTarget;
|
||||
return Object.hash(runtimeType, _this.version, _this.tick);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
final _this = this as PictureEditTarget;
|
||||
return 'PictureEditTarget(version: ${_this.version}, tick: ${_this.tick})';
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $PictureEditTargetCopyWith<$Res> {
|
||||
factory $PictureEditTargetCopyWith(
|
||||
PictureEditTarget value,
|
||||
$Res Function(PictureEditTarget) _then,
|
||||
) = _$PictureEditTargetCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({TimelineVersion version, int tick});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$PictureEditTargetCopyWithImpl<$Res>
|
||||
implements $PictureEditTargetCopyWith<$Res> {
|
||||
_$PictureEditTargetCopyWithImpl(this._self, this._then);
|
||||
|
||||
final PictureEditTarget _self;
|
||||
final $Res Function(PictureEditTarget) _then;
|
||||
|
||||
/// Create a copy of PictureEditTarget
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? version = null, Object? tick = null}) {
|
||||
return _then(
|
||||
PictureEditTarget(
|
||||
version: null == version
|
||||
? _self.version
|
||||
: version // ignore: cast_nullable_to_non_nullable
|
||||
as TimelineVersion,
|
||||
tick: null == tick
|
||||
? _self.tick
|
||||
: tick // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Adds pattern-matching-related methods to [PictureEditTarget].
|
||||
extension PictureEditTargetPatterns on PictureEditTarget {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_PictureEditTarget value)? $default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PictureEditTarget() when $default != null:
|
||||
return $default(_that);
|
||||
case _:
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_PictureEditTarget value) $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PictureEditTarget():
|
||||
return $default(_that);
|
||||
case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_PictureEditTarget value)? $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PictureEditTarget() when $default != null:
|
||||
return $default(_that);
|
||||
case _:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function(TimelineVersion version, int tick)? $default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PictureEditTarget() when $default != null:
|
||||
return $default(_that.version, _that.tick);
|
||||
case _:
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function(TimelineVersion version, int tick) $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PictureEditTarget():
|
||||
return $default(_that.version, _that.tick);
|
||||
case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function(TimelineVersion version, int tick)? $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PictureEditTarget() when $default != null:
|
||||
return $default(_that.version, _that.tick);
|
||||
case _:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _PictureEditTarget implements PictureEditTarget {
|
||||
const _PictureEditTarget({required this.version, required this.tick});
|
||||
|
||||
@override
|
||||
final TimelineVersion version;
|
||||
@override
|
||||
final int tick;
|
||||
|
||||
/// Create a copy of PictureEditTarget
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$PictureEditTargetCopyWith<_PictureEditTarget> get copyWith =>
|
||||
__$PictureEditTargetCopyWithImpl<_PictureEditTarget>(this, _$identity);
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _PictureEditTarget &&
|
||||
(identical(other.version, version) || other.version == version) &&
|
||||
(identical(other.tick, tick) || other.tick == tick));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return Object.hash(runtimeType, version, tick);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PictureEditTarget(version: $version, tick: $tick)';
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$PictureEditTargetCopyWith<$Res>
|
||||
implements $PictureEditTargetCopyWith<$Res> {
|
||||
factory _$PictureEditTargetCopyWith(
|
||||
_PictureEditTarget value,
|
||||
$Res Function(_PictureEditTarget) _then,
|
||||
) = __$PictureEditTargetCopyWithImpl;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({TimelineVersion version, int tick});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$PictureEditTargetCopyWithImpl<$Res>
|
||||
implements _$PictureEditTargetCopyWith<$Res> {
|
||||
__$PictureEditTargetCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _PictureEditTarget _self;
|
||||
final $Res Function(_PictureEditTarget) _then;
|
||||
|
||||
/// Create a copy of PictureEditTarget
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$Res call({Object? version = null, Object? tick = null}) {
|
||||
return _then(
|
||||
_PictureEditTarget(
|
||||
version: null == version
|
||||
? _self.version
|
||||
: version // ignore: cast_nullable_to_non_nullable
|
||||
as TimelineVersion,
|
||||
tick: null == tick
|
||||
? _self.tick
|
||||
: tick // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$PictureEditException {
|
||||
PictureEditFailure get failure;
|
||||
|
||||
@@ -58,7 +58,7 @@ final class PictureEditsProvider
|
||||
}
|
||||
}
|
||||
|
||||
String _$pictureEditsHash() => r'6385f3bd53094d57ed054681d142591e059e8b08';
|
||||
String _$pictureEditsHash() => r'b3166b6e97f6a711e6e92b67dfc44341a3fec4e2';
|
||||
|
||||
final class PictureEditsFamily extends $Family
|
||||
with
|
||||
|
||||
@@ -5,10 +5,10 @@ import 'package:cutdex/l10n/l10n.dart';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:cutdex/features/properties/animation_labels.dart';
|
||||
import 'package:cutdex_sdk/editor.dart';
|
||||
import 'package:cutdex_sdk/preview.dart';
|
||||
import 'package:cutdex_sdk/timeline/engine.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_core/editor.dart';
|
||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||
import 'package:cutdex_core/timeline/engine.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
@@ -22,6 +22,10 @@ import '../../shared/state/operation_scope.dart';
|
||||
import '../preview/preview_panel.dart';
|
||||
import 'property_number_input.dart';
|
||||
import 'picture_edits.dart';
|
||||
import 'effect_properties.dart';
|
||||
import 'stroke_properties.dart';
|
||||
import 'distortion_properties.dart';
|
||||
import 'effect_labels.dart';
|
||||
|
||||
class PictureProperties extends ConsumerStatefulWidget {
|
||||
const PictureProperties({
|
||||
@@ -57,6 +61,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
late final _operations = OperationScope<Object>(_operationContext);
|
||||
late final _seeks = OperationScope<Object>(_operationContext);
|
||||
bool _locked = true;
|
||||
bool? _independentCorners;
|
||||
bool _hasFocusedControl = false;
|
||||
PictureEditsProvider get _editProvider =>
|
||||
pictureEditsProvider(widget.session, widget.sequence, widget.clip.id);
|
||||
@@ -87,6 +92,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
oldWidget.clip.id,
|
||||
);
|
||||
if (previousIdentity != _editIdentity) {
|
||||
_independentCorners = null;
|
||||
final edit = _clearScrub();
|
||||
if (edit != null) scheduleMicrotask(edit.cancel);
|
||||
}
|
||||
@@ -204,7 +210,9 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
value.y == _scrubBase!.y &&
|
||||
value.rotation == _scrubBase!.rotation &&
|
||||
value.scale == _scrubBase!.scale &&
|
||||
value.scaleY == _scrubBase!.scaleY)) {
|
||||
value.scaleY == _scrubBase!.scaleY &&
|
||||
value.sameCorners(_scrubBase!) &&
|
||||
value.distortion.same(_scrubBase!.distortion))) {
|
||||
_cancelScrub();
|
||||
return;
|
||||
}
|
||||
@@ -267,6 +275,16 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
value.scale,
|
||||
value.scaleY,
|
||||
value.rotation,
|
||||
value.distortion.topLeft,
|
||||
value.distortion.topRight,
|
||||
value.distortion.bottomRight,
|
||||
value.distortion.bottomLeft,
|
||||
value.cornerRadius,
|
||||
value.topLeftRadius,
|
||||
value.topRightRadius,
|
||||
value.bottomRightRadius,
|
||||
value.bottomLeftRadius,
|
||||
_independentCorners,
|
||||
_scrubValid,
|
||||
_scrubBase != null,
|
||||
_saving,
|
||||
@@ -359,36 +377,46 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
|
||||
final desktop = AppTheme.isDesktop(context);
|
||||
final gap = AppTheme.propertyRowGap(context);
|
||||
Widget axes(TransformChannel channel, Widget first, Widget second) =>
|
||||
LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final pair = constraints.maxWidth < (desktop ? 180 : 240)
|
||||
? Column(
|
||||
children: [
|
||||
first,
|
||||
SizedBox(height: gap),
|
||||
second,
|
||||
],
|
||||
)
|
||||
: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(child: first),
|
||||
SizedBox(width: gap),
|
||||
Expanded(child: second),
|
||||
],
|
||||
);
|
||||
return desktop
|
||||
? pair
|
||||
: Row(
|
||||
children: [
|
||||
Expanded(child: pair),
|
||||
SizedBox(width: gap),
|
||||
keyButton(channel),
|
||||
],
|
||||
);
|
||||
},
|
||||
Widget axes(
|
||||
TransformChannel channel,
|
||||
Widget first,
|
||||
Widget second, {
|
||||
Widget? trailing,
|
||||
}) => LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
if (desktop) {
|
||||
return AppPropertyRow(
|
||||
trailing: channel == TransformChannel.position
|
||||
? keyButton(channel)
|
||||
: trailing,
|
||||
children: [first, second],
|
||||
);
|
||||
}
|
||||
final pair = constraints.maxWidth < 240
|
||||
? Column(
|
||||
children: [
|
||||
first,
|
||||
SizedBox(height: gap),
|
||||
second,
|
||||
],
|
||||
)
|
||||
: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(child: first),
|
||||
SizedBox(width: gap),
|
||||
Expanded(child: second),
|
||||
],
|
||||
);
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(child: pair),
|
||||
SizedBox(width: gap),
|
||||
keyButton(channel),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
Widget keyTools(TransformChannel channel) {
|
||||
if (animation == null || !animation.animated(channel)) {
|
||||
@@ -488,17 +516,23 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
bool inlineLabel = false,
|
||||
String? prefix,
|
||||
IconData? prefixIcon,
|
||||
int prefixQuarterTurns = 0,
|
||||
String? valueText,
|
||||
}) => PropertyNumberInput(
|
||||
key: ValueKey(id),
|
||||
label: label,
|
||||
inlineLabel: inlineLabel,
|
||||
prefix: prefix,
|
||||
prefixIcon: prefixIcon,
|
||||
prefixQuarterTurns: prefixQuarterTurns,
|
||||
valueText: valueText,
|
||||
unit: unit,
|
||||
value: value,
|
||||
enabled: !_saving,
|
||||
readOnly: _scrubBase != null || preview?.transforms.hasPending == true,
|
||||
submit: (v) => _commit(preview, (current) => change(current, v)),
|
||||
submit: (v) => v < min || v > max
|
||||
? Future.value(false)
|
||||
: _commit(preview, (current) => change(current, v)),
|
||||
onScrubStart: () => _startScrub(
|
||||
preview,
|
||||
id,
|
||||
@@ -520,8 +554,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
widget.session.view(widget.sequence).playheadTick,
|
||||
),
|
||||
);
|
||||
Widget section(List<Widget> children) => Padding(
|
||||
padding: AppTheme.propertySectionPadding(context),
|
||||
Widget section(List<Widget> children) => AppPropertySection(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: children,
|
||||
@@ -555,7 +588,10 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
prefixIcon: desktop ? AppIcons.angle : null,
|
||||
);
|
||||
final rotation = desktop
|
||||
? rotationInput
|
||||
? AppPropertyRow(
|
||||
trailing: keyButton(TransformChannel.rotation),
|
||||
children: [rotationInput, const SizedBox.shrink()],
|
||||
)
|
||||
: Row(
|
||||
children: [
|
||||
Expanded(child: rotationInput),
|
||||
@@ -563,7 +599,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
keyButton(TransformChannel.rotation),
|
||||
],
|
||||
);
|
||||
final scale = axes(
|
||||
Widget scaleControls({Widget? trailing}) => axes(
|
||||
TransformChannel.scale,
|
||||
number(
|
||||
'picture-scale-x',
|
||||
@@ -595,6 +631,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
: 10000,
|
||||
inlineLabel: true,
|
||||
),
|
||||
trailing: trailing,
|
||||
);
|
||||
final lock = IconButton(
|
||||
key: const Key('picture-lock'),
|
||||
@@ -610,11 +647,10 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
}
|
||||
: null,
|
||||
);
|
||||
final scale = scaleControls();
|
||||
final alignmentControls = LayoutBuilder(
|
||||
builder: (context, constraints) => Wrap(
|
||||
spacing: AppSpacing.small,
|
||||
runSpacing: AppSpacing.small,
|
||||
children: [
|
||||
builder: (context, constraints) {
|
||||
final groups = <Widget>[
|
||||
for (final group in [
|
||||
[
|
||||
(
|
||||
@@ -648,7 +684,9 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
],
|
||||
])
|
||||
SizedBox(
|
||||
width: constraints.maxWidth < 200
|
||||
width: desktop
|
||||
? null
|
||||
: constraints.maxWidth < 200
|
||||
? constraints.maxWidth
|
||||
: (constraints.maxWidth - AppSpacing.small) / 2,
|
||||
child: AppButtonGroup(
|
||||
@@ -675,9 +713,89 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
];
|
||||
if (desktop) return AppPropertyRow(children: groups);
|
||||
return Wrap(
|
||||
spacing: AppSpacing.small,
|
||||
runSpacing: AppSpacing.small,
|
||||
children: groups,
|
||||
);
|
||||
},
|
||||
);
|
||||
final radiusInput = number(
|
||||
'picture-corner-radius',
|
||||
context.l10n.cornerRadius,
|
||||
value.topLeftRadius,
|
||||
(c, v) => c.copyWith(cornerRadius: v),
|
||||
min: 0,
|
||||
max: 1000000,
|
||||
inlineLabel: desktop,
|
||||
prefix: desktop ? '' : null,
|
||||
prefixIcon: desktop ? AppIcons.cornerRadius : null,
|
||||
valueText: value.hasMixedCorners ? '—' : null,
|
||||
);
|
||||
final independent = _independentCorners ?? value.hasMixedCorners;
|
||||
final cornerToggle = IconButton(
|
||||
key: const ValueKey('picture-independent-corners'),
|
||||
tooltip: context.l10n.independentCorners,
|
||||
icon: const Icon(AppIcons.independentCorners),
|
||||
isSelected: independent,
|
||||
onPressed:
|
||||
enabled &&
|
||||
_scrubBase == null &&
|
||||
preview?.transforms.hasPending != true
|
||||
? () => setState(() => _independentCorners = !independent)
|
||||
: null,
|
||||
);
|
||||
final cornerInputs = [
|
||||
number(
|
||||
'picture-corner-top-left',
|
||||
context.l10n.cornerTopLeft,
|
||||
value.topLeftRadius,
|
||||
(c, v) => c.copyWith(topLeftRadius: v),
|
||||
min: 0,
|
||||
max: 1000000,
|
||||
inlineLabel: true,
|
||||
prefix: '',
|
||||
prefixIcon: Icons.rounded_corner,
|
||||
prefixQuarterTurns: 3,
|
||||
),
|
||||
number(
|
||||
'picture-corner-top-right',
|
||||
context.l10n.cornerTopRight,
|
||||
value.topRightRadius,
|
||||
(c, v) => c.copyWith(topRightRadius: v),
|
||||
min: 0,
|
||||
max: 1000000,
|
||||
inlineLabel: true,
|
||||
prefix: '',
|
||||
prefixIcon: Icons.rounded_corner,
|
||||
),
|
||||
number(
|
||||
'picture-corner-bottom-left',
|
||||
context.l10n.cornerBottomLeft,
|
||||
value.bottomLeftRadius,
|
||||
(c, v) => c.copyWith(bottomLeftRadius: v),
|
||||
min: 0,
|
||||
max: 1000000,
|
||||
inlineLabel: true,
|
||||
prefix: '',
|
||||
prefixIcon: Icons.rounded_corner,
|
||||
prefixQuarterTurns: 2,
|
||||
),
|
||||
number(
|
||||
'picture-corner-bottom-right',
|
||||
context.l10n.cornerBottomRight,
|
||||
value.bottomRightRadius,
|
||||
(c, v) => c.copyWith(bottomRightRadius: v),
|
||||
min: 0,
|
||||
max: 1000000,
|
||||
inlineLabel: true,
|
||||
prefix: '',
|
||||
prefixIcon: Icons.rounded_corner,
|
||||
prefixQuarterTurns: 1,
|
||||
),
|
||||
];
|
||||
final content = Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
@@ -690,46 +808,43 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
),
|
||||
]),
|
||||
],
|
||||
if (!widget.animationView)
|
||||
if (!widget.animationView && !desktop)
|
||||
section([
|
||||
if (desktop)
|
||||
AppPropertyGroup(
|
||||
label: context.l10n.alignment,
|
||||
child: alignmentControls,
|
||||
)
|
||||
else ...[
|
||||
Text(
|
||||
context.l10n.alignment,
|
||||
style: AppTheme.propertySectionTitleStyle(context),
|
||||
),
|
||||
SizedBox(height: gap),
|
||||
alignmentControls,
|
||||
],
|
||||
Text(
|
||||
context.l10n.alignment,
|
||||
style: AppTheme.propertySectionTitleStyle(context),
|
||||
),
|
||||
SizedBox(height: gap),
|
||||
alignmentControls,
|
||||
]),
|
||||
if (desktop) ...[
|
||||
section([
|
||||
AppPropertyGroup(
|
||||
label: context.l10n.position,
|
||||
actions: [keyButton(TransformChannel.position)],
|
||||
child: position,
|
||||
padChild: false,
|
||||
child: Column(
|
||||
children: [
|
||||
if (!widget.animationView) alignmentControls,
|
||||
position,
|
||||
keyTools(TransformChannel.position),
|
||||
rotation,
|
||||
keyTools(TransformChannel.rotation),
|
||||
],
|
||||
),
|
||||
),
|
||||
keyTools(TransformChannel.position),
|
||||
]),
|
||||
section([
|
||||
AppPropertyGroup(
|
||||
label: context.l10n.scale,
|
||||
actions: [lock, keyButton(TransformChannel.scale)],
|
||||
child: scale,
|
||||
actions: [keyButton(TransformChannel.scale)],
|
||||
padChild: false,
|
||||
child: Column(
|
||||
children: [
|
||||
scaleControls(trailing: lock),
|
||||
keyTools(TransformChannel.scale),
|
||||
],
|
||||
),
|
||||
),
|
||||
keyTools(TransformChannel.scale),
|
||||
]),
|
||||
section([
|
||||
AppPropertyGroup(
|
||||
label: context.l10n.rotation,
|
||||
actions: [keyButton(TransformChannel.rotation)],
|
||||
child: rotation,
|
||||
),
|
||||
keyTools(TransformChannel.rotation),
|
||||
]),
|
||||
] else ...[
|
||||
section([
|
||||
@@ -759,6 +874,82 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
||||
keyTools(TransformChannel.scale),
|
||||
]),
|
||||
],
|
||||
DistortionProperties(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
session: widget.session,
|
||||
sequence: widget.sequence,
|
||||
clip: widget.clip.id,
|
||||
),
|
||||
section([
|
||||
if (desktop)
|
||||
AppPropertyGroup(
|
||||
label: context.l10n.cornerRadius,
|
||||
padChild: false,
|
||||
child: Column(
|
||||
children: [
|
||||
AppPropertyRow(
|
||||
trailing: keyButton(TransformChannel.cornerRadius),
|
||||
children: [
|
||||
radiusInput,
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: cornerToggle,
|
||||
),
|
||||
],
|
||||
),
|
||||
if (independent) ...[
|
||||
AppPropertyRow(children: cornerInputs.sublist(0, 2)),
|
||||
AppPropertyRow(children: cornerInputs.sublist(2, 4)),
|
||||
],
|
||||
keyTools(TransformChannel.cornerRadius),
|
||||
],
|
||||
),
|
||||
)
|
||||
else ...[
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: radiusInput),
|
||||
SizedBox(width: gap),
|
||||
cornerToggle,
|
||||
keyButton(TransformChannel.cornerRadius),
|
||||
],
|
||||
),
|
||||
if (independent) ...[
|
||||
SizedBox(height: gap),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: cornerInputs[0]),
|
||||
SizedBox(width: gap),
|
||||
Expanded(child: cornerInputs[1]),
|
||||
],
|
||||
),
|
||||
SizedBox(height: gap),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: cornerInputs[2]),
|
||||
SizedBox(width: gap),
|
||||
Expanded(child: cornerInputs[3]),
|
||||
],
|
||||
),
|
||||
],
|
||||
keyTools(TransformChannel.cornerRadius),
|
||||
],
|
||||
]),
|
||||
StrokeProperties(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
session: widget.session,
|
||||
sequence: widget.sequence,
|
||||
clip: widget.clip.id,
|
||||
),
|
||||
EffectProperties(
|
||||
projectId: widget.projectId,
|
||||
timelineId: widget.timelineId,
|
||||
session: widget.session,
|
||||
sequence: widget.sequence,
|
||||
clip: widget.clip.id,
|
||||
),
|
||||
if (_error != null)
|
||||
section([
|
||||
Text(
|
||||
@@ -824,7 +1015,34 @@ class _KeyframeTimeline extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
const SizedBox(height: AppSpacing.small),
|
||||
for (final channel in TransformChannel.values)
|
||||
for (final (id, label, times) in [
|
||||
for (final channel in TransformChannel.values)
|
||||
(channel.name, channel.label(context), animation.keyTimes(channel)),
|
||||
for (final layer in ClipStrokeStack(
|
||||
animation.record,
|
||||
animation.localTick,
|
||||
).layers)
|
||||
(
|
||||
'stroke-${layer.id}',
|
||||
context.l10n.stroke,
|
||||
ClipStrokeStack(animation.record, animation.localTick)
|
||||
.keyOffsets(layer.parameterIds)
|
||||
.map((t) => animation.start + t)
|
||||
.toList(),
|
||||
),
|
||||
for (final layer in ClipEffectStack(
|
||||
animation.record,
|
||||
animation.localTick,
|
||||
).layers)
|
||||
(
|
||||
layer.id,
|
||||
layer.type.label(context),
|
||||
ClipEffectStack(animation.record, animation.localTick)
|
||||
.keyOffsets(layer.parameterIds)
|
||||
.map((t) => animation.start + t)
|
||||
.toList(),
|
||||
),
|
||||
])
|
||||
SizedBox(
|
||||
height: 32,
|
||||
child: Row(
|
||||
@@ -832,7 +1050,7 @@ class _KeyframeTimeline extends StatelessWidget {
|
||||
SizedBox(
|
||||
width: 36,
|
||||
child: Text(
|
||||
channel.label(context),
|
||||
label,
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
),
|
||||
@@ -851,7 +1069,7 @@ class _KeyframeTimeline extends StatelessWidget {
|
||||
) *
|
||||
extent;
|
||||
return GestureDetector(
|
||||
key: ValueKey('picture-key-track-${channel.name}'),
|
||||
key: ValueKey('picture-key-track-$id'),
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTapDown: !enabled
|
||||
? null
|
||||
@@ -883,18 +1101,16 @@ class _KeyframeTimeline extends StatelessWidget {
|
||||
width: 1,
|
||||
child: ColoredBox(color: colors.primary),
|
||||
),
|
||||
for (final tick in animation.keyTimes(channel))
|
||||
for (final tick in times)
|
||||
Positioned(
|
||||
left: x(tick) - AppControlSize.compact / 2,
|
||||
top: 4,
|
||||
width: AppControlSize.compact,
|
||||
height: AppControlSize.compact,
|
||||
child: IconButton(
|
||||
key: ValueKey(
|
||||
'picture-key-marker-${channel.name}-$tick',
|
||||
),
|
||||
key: ValueKey('picture-key-marker-$id-$tick'),
|
||||
tooltip:
|
||||
'${channel.label(context)} ${((tick - animation.start) / TimelineClock.ticksPerSecond).toStringAsFixed(2)} s',
|
||||
'$label ${((tick - animation.start) / TimelineClock.ticksPerSecond).toStringAsFixed(2)} s',
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: enabled
|
||||
? () => onSeek(tick)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:cutdex/l10n/l10n.dart';
|
||||
import 'package:cutdex_sdk/runtime/contracts.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:cutdex_sdk/timeline/engine.dart';
|
||||
import 'package:cutdex_native_flutter/contracts.dart';
|
||||
import 'package:cutdex_core/timeline/model.dart';
|
||||
import 'package:cutdex_core/timeline/engine.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
@@ -39,7 +39,9 @@ class ProjectProperties extends StatelessWidget {
|
||||
height: AppTheme.isDesktop(context) ? AppInspectorMetrics.input : null,
|
||||
child: TextButton(
|
||||
key: const ValueKey('project-settings-edit'),
|
||||
style: AppTheme.isDesktop(context)
|
||||
style:
|
||||
AppTheme.isDesktop(context) &&
|
||||
!AppTheme.isCompactInspector(context)
|
||||
? AppTheme.toolbarButtonStyle(context)
|
||||
: null,
|
||||
onPressed: () => showAppDialog<void>(
|
||||
@@ -50,14 +52,17 @@ class ProjectProperties extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
headerHeight: AppTheme.isDesktop(context)
|
||||
? AppDesktopMetrics.panelHeader
|
||||
? AppInspectorMetrics.sectionHeader
|
||||
: AppControlSize.panelToolbar,
|
||||
headerPadding: EdgeInsets.symmetric(
|
||||
horizontal: AppTheme.isDesktop(context)
|
||||
? AppInspectorMetrics.padding
|
||||
: AppSpacing.panelContentHorizontal,
|
||||
),
|
||||
showHeaderDivider: false,
|
||||
headerPadding: AppTheme.isDesktop(context)
|
||||
? const EdgeInsets.only(
|
||||
left: AppInspectorMetrics.padding,
|
||||
right: AppInspectorMetrics.trailingPadding,
|
||||
)
|
||||
: const EdgeInsets.symmetric(
|
||||
horizontal: AppSpacing.panelContentHorizontal,
|
||||
),
|
||||
showHeaderDivider: AppTheme.isCompactInspector(context),
|
||||
child: ScrollEdgeFadeBuilder(
|
||||
builder: (controller) => SingleChildScrollView(
|
||||
controller: controller,
|
||||
@@ -75,8 +80,8 @@ class ProjectProperties extends StatelessWidget {
|
||||
() => session.canvas.label(context),
|
||||
),
|
||||
info(
|
||||
context.l10n.projectColorSpace,
|
||||
() => switch (session.projectColorSpace) {
|
||||
context.l10n.projectOutputColorSpace,
|
||||
() => switch (session.projectOutputColorSpace) {
|
||||
RenderColorSpace.rec2020HLG => 'HDR · Rec.2020 HLG',
|
||||
RenderColorSpace.rec2020PQ => 'HDR · Rec.2020 PQ',
|
||||
_ => 'SDR · Rec.709',
|
||||
@@ -133,8 +138,7 @@ class _Info extends StatelessWidget {
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
);
|
||||
return Padding(
|
||||
padding: AppTheme.propertySectionPadding(context),
|
||||
return AppPropertySection(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: AppSpacing.small,
|
||||
|
||||
@@ -14,9 +14,11 @@ class ProjectPropertyRow extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: AppInspectorMetrics.padding,
|
||||
vertical: AppInspectorMetrics.rowGap,
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
AppInspectorMetrics.padding,
|
||||
AppInspectorMetrics.rowPadding,
|
||||
AppInspectorMetrics.trailingPadding,
|
||||
AppInspectorMetrics.rowPadding,
|
||||
),
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(minHeight: AppInspectorMetrics.input),
|
||||
@@ -35,13 +37,11 @@ class ProjectPropertyRow extends StatelessWidget {
|
||||
label,
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: AppTheme.toolbarTextStyle(context).copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
style: AppTheme.propertyLabelStyle(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: AppInspectorMetrics.rowGap * 2),
|
||||
const SizedBox(width: AppInspectorMetrics.rowGap),
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Tooltip(
|
||||
@@ -51,7 +51,7 @@ class ProjectPropertyRow extends StatelessWidget {
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.right,
|
||||
style: AppTheme.toolbarTextStyle(context),
|
||||
style: AppTheme.inputTextStyle(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Loaded 100 of 452 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user