Move editor UI into the app and release verified Core dependencies #14
No files matched your search
+11
-5
@@ -3,18 +3,24 @@
|
|||||||
# Values are literal: no shell commands, interpolation or escape expansion.
|
# Values are literal: no shell commands, interpolation or escape expansion.
|
||||||
# Use quotes for spaces; Windows paths may use / or literal backslashes.
|
# Use quotes for spaces; Windows paths may use / or literal backslashes.
|
||||||
|
|
||||||
# Windows native source development (requires Rust and FFMPEG_DIR).
|
# Default: consume exact platform releases from cutdex_native_flutter/native-dependencies.json.
|
||||||
# CUTDEX_WINDOWS_PATH=D:/workspace/cutdex_windows
|
# 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
|
# 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_PATH=D:/packages/cutdex-windows
|
||||||
|
# CUTDEX_WINDOWS_PACKAGE_SHA256=<verified Windows release ZIP digest>
|
||||||
|
|
||||||
# macOS / iOS native source development.
|
# 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).
|
# 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.
|
# Optional processing workers directory.
|
||||||
# CUTDEX_PROCESSING_ROOT=D:/packages/cutdex-processing
|
# CUTDEX_PROCESSING_ROOT=D:/packages/cutdex-processing
|
||||||
|
|||||||
@@ -1,9 +1,28 @@
|
|||||||
# Gitea Windows and Android builds
|
# Gitea Windows and Android builds
|
||||||
|
|
||||||
The Windows x64 host runner needs the Flutter version pinned in `.fvmrc`, Python, Node, Visual Studio C++,
|
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
|
JDK 21 and Android SDK 36. `dependencies.json` fixes the Core release version,
|
||||||
Maven packages must be published before building this app. The SDK Git dependency
|
source commit and source ZIP SHA256, together with its bundled native Flutter
|
||||||
is pinned to Gitea; the runner account needs SSH access to that private repository.
|
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
|
Set CUTDEX_GITEA_TOKEN in repository Actions Secrets with repository read and
|
||||||
package read access. It authenticates private Gitea native package downloads.
|
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
|
uses the project's debug signing configuration. Configure formal signing before
|
||||||
shipping a production signed Android release. The Windows ZIP includes the whole
|
shipping a production signed Android release. The Windows ZIP includes the whole
|
||||||
Flutter Release directory and passes the PE dependency audit. Processing workers
|
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
|
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
|
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
|
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.
|
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,
|
Compare warm CI runs after the first cache fill. Measure checks, Android compile,
|
||||||
Windows compile, packaging and artifact transfer separately. Total duration follows
|
Windows compile, packaging and artifact transfer separately. Total duration follows
|
||||||
the slower platform branch, plus checks and final assembly; no fixed speedup is
|
the slower platform branch, plus checks and final assembly; no fixed speedup is
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ inputs:
|
|||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
|
- name: Prepare verified Core source release
|
||||||
|
shell: pwsh
|
||||||
|
run: python tool/gitea/prepare_dependencies.py
|
||||||
- name: Configure persistent build caches
|
- name: Configure persistent build caches
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: ./tool/gitea/prepare-build-cache.ps1
|
run: ./tool/gitea/prepare-build-cache.ps1
|
||||||
|
|||||||
+16
-1
@@ -14,7 +14,9 @@ concurrency:
|
|||||||
env:
|
env:
|
||||||
CI: 'true'
|
CI: 'true'
|
||||||
PYTHONUTF8: '1'
|
PYTHONUTF8: '1'
|
||||||
|
CUTDEX_NATIVE_SOURCE_TOKEN: ${{ secrets.CUTDEX_NATIVE_SOURCE_TOKEN }}
|
||||||
CUTDEX_GITEA_INTERNAL_URL: http://127.0.0.1:3000
|
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_COUNT: '2'
|
||||||
GIT_CONFIG_KEY_0: core.autocrlf
|
GIT_CONFIG_KEY_0: core.autocrlf
|
||||||
GIT_CONFIG_VALUE_0: 'false'
|
GIT_CONFIG_VALUE_0: 'false'
|
||||||
@@ -78,10 +80,13 @@ jobs:
|
|||||||
$file = 'android/gradle.properties'
|
$file = 'android/gradle.properties'
|
||||||
$properties = [IO.File]::ReadAllText($file).Replace('-Xmx8G', '-Xmx3G').Replace('MaxMetaspaceSize=4G', 'MaxMetaspaceSize=768m')
|
$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")
|
[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
|
- name: Build production Android APK
|
||||||
env:
|
env:
|
||||||
GITEA_ACTOR: lingjhf
|
GITEA_ACTOR: lingjhf
|
||||||
run: |
|
run: |
|
||||||
|
$env:CUTDEX_NATIVE_BUILD_MODE = '${{ vars.CUTDEX_NATIVE_BUILD_MODE || 'artifacts' }}'
|
||||||
Remove-Item Env:CUTDEX_ANDROID_PATH -ErrorAction SilentlyContinue
|
Remove-Item Env:CUTDEX_ANDROID_PATH -ErrorAction SilentlyContinue
|
||||||
python tool/build.py android
|
python tool/build.py android
|
||||||
if ($LASTEXITCODE -ne 0) { throw 'Android build failed.' }
|
if ($LASTEXITCODE -ne 0) { throw 'Android build failed.' }
|
||||||
@@ -109,13 +114,23 @@ jobs:
|
|||||||
github-server-url: ${{ env.CUTDEX_GITEA_INTERNAL_URL }}
|
github-server-url: ${{ env.CUTDEX_GITEA_INTERNAL_URL }}
|
||||||
- name: Prepare Flutter environment
|
- name: Prepare Flutter environment
|
||||||
uses: ./.gitea/actions/prepare-flutter
|
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
|
- name: Reuse verified Velopack native archive
|
||||||
run: |
|
run: |
|
||||||
python tool/windows/native_cache.py
|
python tool/windows/native_cache.py
|
||||||
if ($LASTEXITCODE -ne 0) { throw 'Windows native archive cache preparation failed.' }
|
if ($LASTEXITCODE -ne 0) { throw 'Windows native archive cache preparation failed.' }
|
||||||
- name: Build production Windows app
|
- name: Build production Windows app
|
||||||
run: |
|
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
|
python tool/build.py windows
|
||||||
if ($LASTEXITCODE -ne 0) { throw 'Windows build failed.' }
|
if ($LASTEXITCODE -ne 0) { throw 'Windows build failed.' }
|
||||||
- name: Verify native SDK matches pinned packaging tools
|
- name: Verify native SDK matches pinned packaging tools
|
||||||
|
|||||||
@@ -105,3 +105,6 @@ pubspec_overrides.yaml
|
|||||||
|
|
||||||
# FVM Version Cache
|
# FVM Version Cache
|
||||||
.fvm/
|
.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 许可替代。
|
应用发行包捆绑的媒体处理库、推理工具和模型遵循各自的许可与再分发要求。打包时保留随附的许可证和通知文件;不能用本仓库的 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/**
|
- windows/**
|
||||||
- macos/**
|
- macos/**
|
||||||
- linux/**
|
- linux/**
|
||||||
- packages/*/example/**
|
|
||||||
|
|
||||||
plugins:
|
plugins:
|
||||||
riverpod_lint: ^3.1.9
|
riverpod_lint: ^3.1.9
|
||||||
|
|||||||
@@ -25,14 +25,5 @@ plugins {
|
|||||||
|
|
||||||
include(":app")
|
include(":app")
|
||||||
|
|
||||||
// Native source development is opt-in; default resolution uses Gitea Maven packages.
|
// Register native source dependencies before Gradle creates the projects.
|
||||||
val nativeAndroidPath = providers.gradleProperty("cutdex.android.path")
|
apply(from = project(":cutdex_native_flutter").projectDir.resolve("native-settings.gradle"))
|
||||||
.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"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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` 创建覆盖配置。覆盖文件只用于本机开发,不提交。
|
本地联调其他包时,可参考 `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`。复制
|
Core 远端为 `lingjhf/cutdex_core`,Flutter 集成远端为 `cutdex-native/cutdex_native_flutter`。
|
||||||
[配置示例](../.env.example),按需取消注释并填写本机路径;文件已忽略,不提交、
|
本地源码联调使用 `pubspec_overrides.yaml.example` 指向同级 checkout,覆盖文件不提交。
|
||||||
不作为应用资源打包。没有配置时,SDK 使用固定版本的已发布原生包。
|
发布 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 认证可填写
|
`CUTDEX_PROCESSING_ROOT` 指定处理 worker 目录;Android 私有 Maven 认证可填写
|
||||||
`GITEA_ACTOR` 和 `CUTDEX_GITEA_TOKEN`。这里的 `GITEA_ACTOR` 是令牌所属的认证
|
`GITEA_ACTOR` 和 `CUTDEX_GITEA_TOKEN`,账号应属于令牌的认证用户。
|
||||||
账号,CI 中也按令牌账号设置,与触发工作流的用户无关。
|
|
||||||
|
|
||||||
VS Code 的 Debug、Profile、Release 启动项与下述命令共用
|
VS Code 的 Debug、Profile、Release 启动项与下述命令共用
|
||||||
`tool/flutter_local.dart` 加载规则。VS Code 的项目 SDK 设置由 `fvm use` 自动同步,
|
`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/features/settings/` |
|
||||||
| 桌面、平板与手机布局 | `lib/app/shells/` |
|
| 桌面、平板与手机布局 | `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
|
额外 Flutter 参数放在 `--` 后。仅构建 macOS 应用时使用此入口;完整 ZIP/DMG
|
||||||
打包、processing 嵌入、签名和公证使用 `build_macos_release.py`。
|
打包、processing 嵌入、签名和公证使用 `build_macos_release.py`。
|
||||||
|
|
||||||
环境文件合并时进程变量优先,包括空值。原生构建仍遵循所属 SDK 的覆盖规则:
|
环境文件合并时进程变量优先,包括空值。原生构建仍遵循 `cutdex_native_flutter` 的覆盖规则:
|
||||||
Android Gradle 属性先于环境变量;Windows CMake 已缓存的非空路径先于环境变量,
|
Android Gradle 属性先于环境变量;Windows CMake 已缓存的非空路径先于环境变量,
|
||||||
修改后需 clean;processing 的非空 Dart define 先于进程环境,再使用随包默认路径。
|
修改后需 clean;processing 的非空 Dart define 先于进程环境,再使用随包默认路径。
|
||||||
`CUTDEX_GITEA_TOKEN` 用于依赖访问,Release 的 `GITEA_TOKEN` 用于发布和 CI 产物读取。
|
`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` 指定语音素材。配置字段以测试读取代码为准,素材、模型及凭据放在仓库外。
|
普通测试中的可选真实模型回归使用环境变量:`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
|
--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
|
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
|
||||||
and Android source overrides only when comparing unpublished changes. Calibration
|
|
||||||
requires a `--debug` build; profile/production hosts do not register its channel.
|
requires a `--debug` build; profile/production hosts do not register its channel.
|
||||||
UI timing ends at the
|
UI timing ends at the
|
||||||
target workspace's post-frame callback. Native diagnostics record queued output
|
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/project_state.dart';
|
||||||
import 'package:cutdex/workspace/projects.dart';
|
import 'package:cutdex/workspace/projects.dart';
|
||||||
import 'package:cutdex/workspace/timeline_provider.dart';
|
import 'package:cutdex/workspace/timeline_provider.dart';
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
import 'package:cutdex_sdk/preview.dart';
|
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||||
import 'package:cutdex_sdk/project.dart';
|
import 'package:cutdex_core/project.dart';
|
||||||
import 'package:cutdex_sdk/runtime.dart';
|
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||||
import 'package:cutdex_sdk/timeline/layout.dart';
|
import 'package:cutdex_core/timeline/layout.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:cutdex_sdk/timeline_ui.dart';
|
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
||||||
import 'package:drift/native.dart';
|
import 'package:drift/native.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.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/media_import.dart';
|
||||||
import 'package:cutdex/workspace/persistence/project_workspace.dart';
|
import 'package:cutdex/workspace/persistence/project_workspace.dart';
|
||||||
import 'package:cutdex/workspace/persistence/timeline_creation_names.dart';
|
import 'package:cutdex/workspace/persistence/timeline_creation_names.dart';
|
||||||
import 'package:cutdex_sdk/project.dart';
|
import 'package:cutdex_core/project.dart';
|
||||||
import 'package:cutdex_sdk/runtime.dart';
|
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:integration_test/integration_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/project_state.dart';
|
||||||
import 'package:cutdex/workspace/projects.dart';
|
import 'package:cutdex/workspace/projects.dart';
|
||||||
import 'package:cutdex/workspace/timeline_provider.dart';
|
import 'package:cutdex/workspace/timeline_provider.dart';
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
import 'package:cutdex_sdk/preview.dart';
|
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||||
import 'package:cutdex_sdk/project.dart';
|
import 'package:cutdex_core/project.dart';
|
||||||
import 'package:cutdex_sdk/runtime.dart';
|
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||||
import 'package:cutdex_sdk/timeline/layout.dart';
|
import 'package:cutdex_core/timeline/layout.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:cutdex_sdk/timeline_ui.dart';
|
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
||||||
import 'package:drift/native.dart';
|
import 'package:drift/native.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.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/preview_controller_registry.dart';
|
||||||
import 'package:cutdex/workspace/timeline_provider.dart';
|
import 'package:cutdex/workspace/timeline_provider.dart';
|
||||||
import 'package:cutdex_native/cutdex_native.dart';
|
import 'package:cutdex_native/cutdex_native.dart';
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
import 'package:cutdex_sdk/runtime.dart';
|
import 'package:cutdex_core/execution.dart';
|
||||||
import 'package:cutdex_sdk/timeline/engine.dart';
|
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/engine.dart';
|
||||||
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:drift/native.dart';
|
import 'package:drift/native.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:integration_test/integration_test.dart';
|
import 'package:integration_test/integration_test.dart';
|
||||||
@@ -215,7 +217,12 @@ void main() {
|
|||||||
try {
|
try {
|
||||||
info = await runtime.probe(media);
|
info = await runtime.probe(media);
|
||||||
} catch (_) {
|
} 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;
|
result['rawProbeMetadata'] = raw;
|
||||||
// Preserve the actual wire-contract failure in the device report.
|
// Preserve the actual wire-contract failure in the device report.
|
||||||
MediaInfo.fromMap(raw! as Map);
|
MediaInfo.fromMap(raw! as Map);
|
||||||
|
|||||||
@@ -8,10 +8,11 @@ import 'package:cutdex/workspace/timeline_provider.dart';
|
|||||||
import 'dart:ui' as ui;
|
import 'dart:ui' as ui;
|
||||||
|
|
||||||
import 'package:cutdex/features/preview/preview_panel.dart';
|
import 'package:cutdex/features/preview/preview_panel.dart';
|
||||||
import 'package:cutdex_sdk/preview.dart';
|
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
import 'package:cutdex_sdk/runtime.dart';
|
import 'package:cutdex_core/execution.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/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_test/flutter_test.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/media_file_extensions.dart';
|
||||||
import 'package:cutdex/workspace/preview_target.dart';
|
import 'package:cutdex/workspace/preview_target.dart';
|
||||||
import 'package:cutdex/workspace/projects.dart';
|
import 'package:cutdex/workspace/projects.dart';
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:drift/native.dart';
|
import 'package:drift/native.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.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/preview_target.dart';
|
||||||
import 'package:cutdex/workspace/projects.dart';
|
import 'package:cutdex/workspace/projects.dart';
|
||||||
import 'package:cutdex/workspace/timeline_provider.dart';
|
import 'package:cutdex/workspace/timeline_provider.dart';
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
import 'package:cutdex_sdk/runtime.dart';
|
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||||
import 'package:cutdex_sdk/timeline/layout.dart';
|
import 'package:cutdex_core/timeline/layout.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:drift/native.dart';
|
import 'package:drift/native.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.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/persistence/app_database.dart';
|
||||||
import 'package:cutdex/workspace/timeline_provider.dart';
|
import 'package:cutdex/workspace/timeline_provider.dart';
|
||||||
import 'package:cutdex/workspace/timeline_session.dart';
|
import 'package:cutdex/workspace/timeline_session.dart';
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
import 'package:cutdex_sdk/preview.dart';
|
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||||
import 'package:cutdex_sdk/project.dart';
|
import 'package:cutdex_core/project.dart';
|
||||||
import 'package:cutdex_sdk/runtime.dart';
|
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:drift/native.dart';
|
import 'package:drift/native.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.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/project_state.dart';
|
||||||
import 'package:cutdex/workspace/projects.dart';
|
import 'package:cutdex/workspace/projects.dart';
|
||||||
import 'package:cutdex/workspace/timeline_session.dart';
|
import 'package:cutdex/workspace/timeline_session.dart';
|
||||||
import 'package:cutdex_sdk/project.dart';
|
import 'package:cutdex_core/project.dart';
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
import 'package:cutdex_sdk/preview.dart';
|
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||||
import 'package:cutdex_sdk/runtime.dart';
|
import 'package:cutdex_core/execution.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/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|||||||
@@ -4,12 +4,13 @@ import 'package:cutdex/l10n/app_localizations.dart';
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:ui' as ui;
|
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/preview/preview_panel.dart';
|
||||||
import 'package:cutdex/features/properties/picture_properties.dart';
|
import 'package:cutdex/features/properties/picture_properties.dart';
|
||||||
import 'package:cutdex_sdk/preview.dart';
|
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||||
import 'package:cutdex_sdk/runtime.dart';
|
import 'package:cutdex_core/execution.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/material.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.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/persistence/app_database.dart';
|
||||||
import 'package:cutdex/workspace/projects.dart';
|
import 'package:cutdex/workspace/projects.dart';
|
||||||
import 'package:cutdex/workspace/timeline_provider.dart';
|
import 'package:cutdex/workspace/timeline_provider.dart';
|
||||||
import 'package:cutdex_sdk/preview.dart';
|
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||||
import 'package:cutdex_sdk/runtime.dart';
|
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:cutdex_sdk/timeline_ui.dart';
|
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
||||||
import 'package:drift/native.dart';
|
import 'package:drift/native.dart';
|
||||||
import 'package:cutdex_ui/icons.dart';
|
import 'package:cutdex_ui/icons.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ import 'package:cutdex/workspace/timeline_provider.dart';
|
|||||||
|
|
||||||
import 'dart:math' as math;
|
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/preview/preview_panel.dart';
|
||||||
import 'package:cutdex/features/properties/properties_panel.dart';
|
import 'package:cutdex/features/properties/properties_panel.dart';
|
||||||
import 'package:cutdex_sdk/runtime.dart';
|
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ import '../test/support/creation_names.dart';
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:cutdex/workspace/persistence/project_workspace.dart';
|
import 'package:cutdex/workspace/persistence/project_workspace.dart';
|
||||||
import 'package:cutdex_sdk/project.dart';
|
import 'package:cutdex_core/project.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
|
|
||||||
import '../test/support/processing_fixture.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/preview/preview_panel.dart';
|
||||||
import 'package:cutdex/features/timeline/timeline_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/integrations/runtime/timeline_thumbnails.dart';
|
||||||
import 'package:cutdex_sdk/runtime.dart';
|
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:cutdex_sdk/timeline_ui.dart';
|
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.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/integrations/runtime/processing_configuration.dart';
|
||||||
import 'package:cutdex/workspace/persistence/project_workspace.dart';
|
import 'package:cutdex/workspace/persistence/project_workspace.dart';
|
||||||
import 'package:cutdex/workspace/timeline_session.dart';
|
import 'package:cutdex/workspace/timeline_session.dart';
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
import 'package:cutdex_sdk/preview.dart';
|
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||||
import 'package:cutdex_sdk/runtime.dart';
|
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:integration_test/integration_test.dart';
|
import 'package:integration_test/integration_test.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:math' as math;
|
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/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'dart:math' as math;
|
import 'dart:math' as math;
|
||||||
import 'dart:ui' as ui;
|
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/painting.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
import 'package:cutdex_sdk/project.dart';
|
import 'package:cutdex_core/project.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
class SavedEditValidation {
|
class SavedEditValidation {
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import 'dart:convert';
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:cutdex/integrations/runtime/timeline_thumbnails.dart';
|
import 'package:cutdex/integrations/runtime/timeline_thumbnails.dart';
|
||||||
import 'package:cutdex_sdk/runtime.dart';
|
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||||
import 'package:cutdex_sdk/timeline/engine.dart';
|
import 'package:cutdex_core/timeline/engine.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_test/flutter_test.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/preview_controller_registry.dart';
|
||||||
import 'package:cutdex/workspace/projects.dart';
|
import 'package:cutdex/workspace/projects.dart';
|
||||||
import 'package:cutdex/workspace/timeline_provider.dart';
|
import 'package:cutdex/workspace/timeline_provider.dart';
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
import 'package:cutdex_sdk/preview.dart';
|
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||||
import 'package:cutdex_sdk/runtime.dart';
|
import 'package:cutdex_core/execution.dart';
|
||||||
import 'package:cutdex_sdk/timeline/engine.dart';
|
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/engine.dart';
|
||||||
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:drift/native.dart';
|
import 'package:drift/native.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.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/projects.dart';
|
||||||
import 'package:cutdex/workspace/preview_controller_registry.dart';
|
import 'package:cutdex/workspace/preview_controller_registry.dart';
|
||||||
import 'package:cutdex/workspace/timeline_provider.dart';
|
import 'package:cutdex/workspace/timeline_provider.dart';
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
import 'package:cutdex_sdk/runtime.dart';
|
import 'package:cutdex_core/execution.dart';
|
||||||
import 'package:cutdex_sdk/timeline/engine.dart';
|
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/engine.dart';
|
||||||
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:drift/native.dart';
|
import 'package:drift/native.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.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/features/preview/preview_panel.dart';
|
||||||
import 'package:cutdex/l10n/app_localizations.dart';
|
import 'package:cutdex/l10n/app_localizations.dart';
|
||||||
import 'package:cutdex/workspace/timeline_provider.dart';
|
import 'package:cutdex/workspace/timeline_provider.dart';
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
import 'package:cutdex_sdk/preview.dart';
|
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||||
import 'package:cutdex_sdk/runtime.dart';
|
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.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';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
enum DesktopContent { workspace, library, resourceLibrary, settings }
|
enum DesktopContent { workspace, library, resourceLibrary, workflow, settings }
|
||||||
|
|
||||||
typedef DesktopContentSelection = ({
|
typedef DesktopContentSelection = ({
|
||||||
DesktopContent surface,
|
DesktopContent surface,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import 'package:cutdex_ui/theme.dart';
|
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';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
/// Connects the application palette to the SDK timeline presentation.
|
/// Connects the application palette to the SDK timeline presentation.
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ class DesktopWindowFrame extends StatelessWidget {
|
|||||||
this.projectTabs,
|
this.projectTabs,
|
||||||
this.headerTrailing = const SizedBox.shrink(),
|
this.headerTrailing = const SizedBox.shrink(),
|
||||||
this.settingsSelected = false,
|
this.settingsSelected = false,
|
||||||
this.resourceLibrarySelected = false,
|
this.workflowSelected = false,
|
||||||
this.onResourceLibraryPressed,
|
|
||||||
required this.onHomePressed,
|
required this.onHomePressed,
|
||||||
|
required this.onWorkflowPressed,
|
||||||
required this.onSettingsPressed,
|
required this.onSettingsPressed,
|
||||||
required this.child,
|
required this.child,
|
||||||
});
|
});
|
||||||
@@ -35,9 +35,9 @@ class DesktopWindowFrame extends StatelessWidget {
|
|||||||
final Widget? projectTabs;
|
final Widget? projectTabs;
|
||||||
final Widget headerTrailing;
|
final Widget headerTrailing;
|
||||||
final bool settingsSelected;
|
final bool settingsSelected;
|
||||||
final bool resourceLibrarySelected;
|
final bool workflowSelected;
|
||||||
final VoidCallback? onResourceLibraryPressed;
|
|
||||||
final VoidCallback onHomePressed;
|
final VoidCallback onHomePressed;
|
||||||
|
final VoidCallback onWorkflowPressed;
|
||||||
final VoidCallback onSettingsPressed;
|
final VoidCallback onSettingsPressed;
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
||||||
@@ -119,69 +119,87 @@ class DesktopWindowFrame extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
if (projectTabs == null)
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
key: const Key('desktop-navigation-rail'),
|
key: const Key('desktop-navigation-rail'),
|
||||||
width: railWidth,
|
width: railWidth,
|
||||||
|
child: LayoutBuilder(
|
||||||
|
builder: (context, constraints) => SingleChildScrollView(
|
||||||
|
child: ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
minHeight: constraints.maxHeight,
|
||||||
|
),
|
||||||
|
child: IntrinsicHeight(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
for (final section in [0, 2])
|
IconButton.filledTonal(
|
||||||
Padding(
|
key: const ValueKey('desktop-rail-home'),
|
||||||
padding: const EdgeInsets.only(bottom: 8),
|
tooltip: context.l10n.navigationHome,
|
||||||
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:
|
isSelected:
|
||||||
!settingsSelected &&
|
!settingsSelected && !workflowSelected,
|
||||||
(section == 2
|
|
||||||
? resourceLibrarySelected
|
|
||||||
: !resourceLibrarySelected),
|
|
||||||
style: IconButton.styleFrom(
|
style: IconButton.styleFrom(
|
||||||
fixedSize: const Size.square(railButtonSize),
|
fixedSize: const Size.square(railButtonSize),
|
||||||
minimumSize: const Size.square(railButtonSize),
|
minimumSize: const Size.square(
|
||||||
maximumSize: const Size.square(railButtonSize),
|
railButtonSize,
|
||||||
|
),
|
||||||
|
maximumSize: const Size.square(
|
||||||
|
railButtonSize,
|
||||||
|
),
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
iconSize: railIconSize,
|
iconSize: railIconSize,
|
||||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
tapTargetSize:
|
||||||
|
MaterialTapTargetSize.shrinkWrap,
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
!settingsSelected &&
|
settingsSelected || workflowSelected
|
||||||
(section == 2
|
? Colors.transparent
|
||||||
? resourceLibrarySelected
|
: null,
|
||||||
: !resourceLibrarySelected)
|
),
|
||||||
|
onPressed: onHomePressed,
|
||||||
|
icon: const Icon(AppIcons.home),
|
||||||
|
),
|
||||||
|
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
|
? null
|
||||||
: Colors.transparent,
|
: Colors.transparent,
|
||||||
),
|
),
|
||||||
onPressed: switch (section) {
|
onPressed: onWorkflowPressed,
|
||||||
0 => onHomePressed,
|
icon: const Icon(AppIcons.timeline),
|
||||||
_ => onResourceLibraryPressed,
|
|
||||||
},
|
|
||||||
icon: Icon(switch (section) {
|
|
||||||
0 => AppIcons.home,
|
|
||||||
_ => AppIcons.folder,
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
IconButton(
|
IconButton(
|
||||||
key: const Key('project-settings-button'),
|
key: const Key('desktop-rail-settings'),
|
||||||
tooltip: context.l10n.settings,
|
tooltip: context.l10n.settings,
|
||||||
isSelected: settingsSelected,
|
isSelected: settingsSelected,
|
||||||
onPressed: onSettingsPressed,
|
onPressed: onSettingsPressed,
|
||||||
style: IconButton.styleFrom(
|
style: IconButton.styleFrom(
|
||||||
fixedSize: const Size.square(railButtonSize),
|
fixedSize: const Size.square(railButtonSize),
|
||||||
minimumSize: const Size.square(railButtonSize),
|
minimumSize: const Size.square(
|
||||||
maximumSize: const Size.square(railButtonSize),
|
railButtonSize,
|
||||||
|
),
|
||||||
|
maximumSize: const Size.square(
|
||||||
|
railButtonSize,
|
||||||
|
),
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
iconSize: railIconSize,
|
iconSize: railIconSize,
|
||||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
tapTargetSize:
|
||||||
|
MaterialTapTargetSize.shrinkWrap,
|
||||||
),
|
),
|
||||||
icon: const Icon(AppIcons.settings),
|
icon: const Icon(AppIcons.settings),
|
||||||
),
|
),
|
||||||
@@ -189,18 +207,22 @@ class DesktopWindowFrame extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: projectTabs == null ? 0 : contentInset,
|
left: contentInset,
|
||||||
right: contentInset,
|
right: contentInset,
|
||||||
bottom: contentInset,
|
bottom: contentInset,
|
||||||
),
|
),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
key: const Key('desktop-content-container'),
|
key: const Key('desktop-content-container'),
|
||||||
child: WindowHeaderPane(
|
child: WindowHeaderPane(
|
||||||
offset: Offset(
|
offset: const Offset(
|
||||||
projectTabs == null ? railWidth : contentInset,
|
railWidth + contentInset,
|
||||||
headerHeight,
|
headerHeight,
|
||||||
),
|
),
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
|
|||||||
@@ -32,6 +32,11 @@ class DesktopWorkspaceShell extends StatefulWidget {
|
|||||||
required this.scaffoldKey,
|
required this.scaffoldKey,
|
||||||
required this.navigationDrawer,
|
required this.navigationDrawer,
|
||||||
this.projectTabsLayout = false,
|
this.projectTabsLayout = false,
|
||||||
|
this.timelineHeight,
|
||||||
|
this.onTimelineHeightChanged,
|
||||||
|
this.onJunctionResizeEnd,
|
||||||
|
this.onSidebarResizeEnd,
|
||||||
|
this.sidebarCanExpand = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
static const gutterWidth = WorkspaceLayoutMetrics.desktopSpacing;
|
static const gutterWidth = WorkspaceLayoutMetrics.desktopSpacing;
|
||||||
@@ -47,12 +52,53 @@ class DesktopWorkspaceShell extends StatefulWidget {
|
|||||||
final GlobalKey<ScaffoldState> scaffoldKey;
|
final GlobalKey<ScaffoldState> scaffoldKey;
|
||||||
final Widget navigationDrawer;
|
final Widget navigationDrawer;
|
||||||
final bool projectTabsLayout;
|
final bool projectTabsLayout;
|
||||||
|
final double? timelineHeight;
|
||||||
|
final ValueChanged<double>? onTimelineHeightChanged;
|
||||||
|
final VoidCallback? onJunctionResizeEnd;
|
||||||
|
final VoidCallback? onSidebarResizeEnd;
|
||||||
|
final bool sidebarCanExpand;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<DesktopWorkspaceShell> createState() => _DesktopWorkspaceShellState();
|
State<DesktopWorkspaceShell> createState() => _DesktopWorkspaceShellState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _DesktopWorkspaceShellState extends State<DesktopWorkspaceShell> {
|
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
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@@ -64,6 +110,11 @@ class _DesktopWorkspaceShellState extends State<DesktopWorkspaceShell> {
|
|||||||
@override
|
@override
|
||||||
void didUpdateWidget(covariant DesktopWorkspaceShell oldWidget) {
|
void didUpdateWidget(covariant DesktopWorkspaceShell oldWidget) {
|
||||||
super.didUpdateWidget(oldWidget);
|
super.didUpdateWidget(oldWidget);
|
||||||
|
if (widget.controller.agentFloating ||
|
||||||
|
!widget.sidebarCanExpand ||
|
||||||
|
widget.onTimelineHeightChanged == null) {
|
||||||
|
_sidebarJunctionDragging = false;
|
||||||
|
}
|
||||||
if (oldWidget.controller != widget.controller) {
|
if (oldWidget.controller != widget.controller) {
|
||||||
oldWidget.controller.removeListener(_changed);
|
oldWidget.controller.removeListener(_changed);
|
||||||
widget.controller.addListener(_changed);
|
widget.controller.addListener(_changed);
|
||||||
@@ -85,6 +136,9 @@ class _DesktopWorkspaceShellState extends State<DesktopWorkspaceShell> {
|
|||||||
required ValueChanged<double> onResize,
|
required ValueChanged<double> onResize,
|
||||||
double direction = 1,
|
double direction = 1,
|
||||||
VoidCallback? onEnd,
|
VoidCallback? onEnd,
|
||||||
|
VoidCallback? onStart,
|
||||||
|
Set<WorkspaceResizeBoundary> highlightTargets = const {},
|
||||||
|
Offset highlightOffset = Offset.zero,
|
||||||
}) => SizedBox(
|
}) => SizedBox(
|
||||||
width: WorkspaceLayoutMetrics.desktopResizeHitExtent,
|
width: WorkspaceLayoutMetrics.desktopResizeHitExtent,
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
@@ -95,11 +149,17 @@ class _DesktopWorkspaceShellState extends State<DesktopWorkspaceShell> {
|
|||||||
direction: direction,
|
direction: direction,
|
||||||
onResize: onResize,
|
onResize: onResize,
|
||||||
onEnd: onEnd,
|
onEnd: onEnd,
|
||||||
|
onStart: onStart,
|
||||||
|
highlightTargets: highlightTargets,
|
||||||
|
highlightOffset: highlightOffset,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => widget.projectTabsLayout
|
Widget build(BuildContext context) =>
|
||||||
|
WorkspaceResizeHighlightScope(child: _workspace(context));
|
||||||
|
|
||||||
|
Widget _workspace(BuildContext context) => widget.projectTabsLayout
|
||||||
? _projectWorkspace(context)
|
? _projectWorkspace(context)
|
||||||
: LayoutBuilder(
|
: LayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
@@ -164,6 +224,7 @@ class _DesktopWorkspaceShellState extends State<DesktopWorkspaceShell> {
|
|||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
key: widget.scaffoldKey,
|
key: widget.scaffoldKey,
|
||||||
|
drawerEnableOpenDragGesture: false,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
drawer: Drawer(
|
drawer: Drawer(
|
||||||
width: 320,
|
width: 320,
|
||||||
@@ -317,6 +378,12 @@ class _DesktopWorkspaceShellState extends State<DesktopWorkspaceShell> {
|
|||||||
.toDouble();
|
.toDouble();
|
||||||
final floating = widget.controller.agentFloating;
|
final floating = widget.controller.agentFloating;
|
||||||
final collapsed = widget.sidebarCollapsed || floating;
|
final collapsed = widget.sidebarCollapsed || floating;
|
||||||
|
double resolveTimelineHeight(double? height) =>
|
||||||
|
WorkspaceLayoutMetrics.resolveTimelineHeight(
|
||||||
|
constraints.maxHeight,
|
||||||
|
height,
|
||||||
|
);
|
||||||
|
final timelineHeight = resolveTimelineHeight(widget.timelineHeight);
|
||||||
final geometry = DesktopWorkspaceGeometry(
|
final geometry = DesktopWorkspaceGeometry(
|
||||||
sidebarWidth: sidebarWidth,
|
sidebarWidth: sidebarWidth,
|
||||||
agentWidth: 0,
|
agentWidth: 0,
|
||||||
@@ -324,6 +391,7 @@ class _DesktopWorkspaceShellState extends State<DesktopWorkspaceShell> {
|
|||||||
);
|
);
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
key: widget.scaffoldKey,
|
key: widget.scaffoldKey,
|
||||||
|
drawerEnableOpenDragGesture: false,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
drawer: Drawer(
|
drawer: Drawer(
|
||||||
width: 320,
|
width: 320,
|
||||||
@@ -356,20 +424,64 @@ class _DesktopWorkspaceShellState extends State<DesktopWorkspaceShell> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (!collapsed)
|
if (!floating &&
|
||||||
|
widget.sidebarCanExpand &&
|
||||||
|
WorkspaceLayoutPolicy.desktopNavigationFits(width))
|
||||||
Positioned(
|
Positioned(
|
||||||
left: sidebarWidth - WorkspaceLayoutMetrics.desktopResizeSlop,
|
left: collapsed
|
||||||
|
? 0
|
||||||
|
: sidebarWidth - WorkspaceLayoutMetrics.desktopResizeSlop,
|
||||||
top: 0,
|
top: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
child: _gutter(
|
child: _gutter(
|
||||||
name: 'project-sidebar',
|
name: 'project-sidebar',
|
||||||
initialWidth: sidebarWidth,
|
highlightTargets: const {WorkspaceResizeBoundary.sidebar},
|
||||||
onResize: (value) => widget.onSidebarWidthChanged(
|
highlightOffset: collapsed
|
||||||
value.clamp(
|
? const Offset(
|
||||||
WorkspaceLayoutMetrics.sidebarMinimumWidth,
|
-WorkspaceLayoutMetrics.desktopResizeHitExtent / 2,
|
||||||
maximum,
|
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)
|
if (floating)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
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:cutdex_native/cutdex_native.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:path/path.dart' as p;
|
import 'package:path/path.dart' as p;
|
||||||
|
|||||||
@@ -2,24 +2,20 @@ import 'dart:async';
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
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.
|
/// Native QPC clock calibration and bounded asynchronous diagnostics sampling.
|
||||||
class BenchDiagnostics {
|
class BenchDiagnostics {
|
||||||
BenchDiagnostics(this.sessionId, this.clock);
|
BenchDiagnostics(this.session, this.clock);
|
||||||
final String sessionId;
|
final RuntimeSession session;
|
||||||
final Stopwatch clock;
|
final Stopwatch clock;
|
||||||
static const _channel = MethodChannel('cutdex_runtime');
|
|
||||||
double uncertaintyMs = double.infinity, _offset = 0;
|
double uncertaintyMs = double.infinity, _offset = 0;
|
||||||
Timer? _timer;
|
Timer? _timer;
|
||||||
Future<void>? _pending;
|
Future<void>? _pending;
|
||||||
Object? _sampleError;
|
Object? _sampleError;
|
||||||
|
|
||||||
double now() => _offset + clock.elapsedMicroseconds / 1000;
|
double now() => _offset + clock.elapsedMicroseconds / 1000;
|
||||||
Future<Map<String, dynamic>> read() async =>
|
Future<Map<String, Object?>> read() => session.previewDiagnostics();
|
||||||
(await _channel.invokeMapMethod<String, dynamic>('previewDiagnostics', {
|
|
||||||
'sessionId': sessionId,
|
|
||||||
}))!;
|
|
||||||
|
|
||||||
Future<void> calibrate() async {
|
Future<void> calibrate() async {
|
||||||
for (var i = 0; i < 20; i++) {
|
for (var i = 0; i < 20; i++) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:cutdex_sdk/timeline/layout.dart';
|
import 'package:cutdex_core/timeline/layout.dart';
|
||||||
import 'package:cutdex_sdk/timeline_ui.dart';
|
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ import 'dart:async';
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:cutdex/features/preview/preview_panel.dart';
|
import 'package:cutdex/features/preview/preview_panel.dart';
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
import 'package:cutdex_sdk/runtime.dart';
|
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:cutdex_sdk/timeline/layout.dart';
|
import 'package:cutdex_core/timeline/layout.dart';
|
||||||
import 'package:cutdex_sdk/timeline_ui.dart';
|
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ Future<void> runFullAppViewportBench(ViewportBenchConfig config) async {
|
|||||||
if (clipStart < 0 || clipEnd > viewport.width) {
|
if (clipStart < 0 || clipEnd > viewport.width) {
|
||||||
throw StateError('Clip outside viewport');
|
throw StateError('Clip outside viewport');
|
||||||
}
|
}
|
||||||
final native = diagnostics = BenchDiagnostics(preview.session!.id, clock);
|
final native = diagnostics = BenchDiagnostics(preview.session!, clock);
|
||||||
await native.calibrate();
|
await native.calibrate();
|
||||||
capture = await BenchCapture.start(config, output);
|
capture = await BenchCapture.start(config, output);
|
||||||
final record = records = BenchRecords(output);
|
final record = records = BenchRecords(output);
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import 'dart:async';
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:cutdex_sdk/timeline/layout.dart';
|
import 'package:cutdex_core/timeline/layout.dart';
|
||||||
import 'package:cutdex_sdk/timeline_ui.dart';
|
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ Future<void> _run(String output) async {
|
|||||||
.cached((projectId, id));
|
.cached((projectId, id));
|
||||||
if (preview?.session != null && uiMs != null && dataMs != null) {
|
if (preview?.session != null && uiMs != null && dataMs != null) {
|
||||||
final diagnostic = await BenchDiagnostics(
|
final diagnostic = await BenchDiagnostics(
|
||||||
preview!.session!.id,
|
preview!.session!,
|
||||||
clock,
|
clock,
|
||||||
).read().timeout(const Duration(seconds: 2));
|
).read().timeout(const Duration(seconds: 2));
|
||||||
if ((diagnostic['sourceSubmitted'] as num?) != null &&
|
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 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../media/media_asset_cover.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/l10n/l10n.dart';
|
||||||
|
|
||||||
import 'package:cutdex_sdk/project.dart';
|
import 'package:cutdex_core/project.dart';
|
||||||
|
|
||||||
import '../../integrations/platform/platform_capabilities.dart';
|
import '../../integrations/platform/platform_capabilities.dart';
|
||||||
import 'agent_composer_controller.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 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
import '../../workspace/external_media_import.dart';
|
import '../../workspace/external_media_import.dart';
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import 'dart:convert';
|
|||||||
import 'package:cutdex_agent/cutdex_agent.dart';
|
import 'package:cutdex_agent/cutdex_agent.dart';
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_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 'package:uuid/uuid.dart';
|
||||||
|
|
||||||
import '../../diagnostics/agent_request_diagnostics.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';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
part 'agent_media_attachments.freezed.dart';
|
part 'agent_media_attachments.freezed.dart';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
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/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
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:cutdex_ui/icons.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
|||||||
ProjectViewSettings get _viewController =>
|
ProjectViewSettings get _viewController =>
|
||||||
ref.read(projectViewSettingsProvider(widget.projectId).notifier);
|
ref.read(projectViewSettingsProvider(widget.projectId).notifier);
|
||||||
bool get _propertiesOpen => _viewSettings.propertiesOpen;
|
bool get _propertiesOpen => _viewSettings.propertiesOpen;
|
||||||
double? get _timelineHeight => _viewSettings.timelineHeight;
|
|
||||||
|
|
||||||
void _saveViewSettings() {
|
void _saveViewSettings() {
|
||||||
if (widget.projectId.isEmpty ||
|
if (widget.projectId.isEmpty ||
|
||||||
@@ -93,7 +92,8 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final viewSettings = ref.watch(
|
final viewSettings = ref.watch(
|
||||||
projectViewSettingsProvider(widget.projectId),
|
projectViewSettingsProvider(widget.projectId)
|
||||||
|
.select((value) => (value.hasValue, value.value?.propertiesOpen)),
|
||||||
);
|
);
|
||||||
final preview = KeyedSubtree(
|
final preview = KeyedSubtree(
|
||||||
key: _previewKey,
|
key: _previewKey,
|
||||||
@@ -205,10 +205,15 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
|||||||
if (desktop) mediaButton,
|
if (desktop) mediaButton,
|
||||||
Expanded(
|
Expanded(
|
||||||
child: desktop
|
child: desktop
|
||||||
? _PreviewHeaderTitle(
|
? Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: AppSpacing.small,
|
||||||
|
),
|
||||||
|
child: _PreviewHeaderTitle(
|
||||||
projectId: widget.projectId,
|
projectId: widget.projectId,
|
||||||
timelineId: widget.timelineId,
|
timelineId: widget.timelineId,
|
||||||
pending: _timelinePending,
|
pending: _timelinePending,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
: widget.showProjectName
|
: widget.showProjectName
|
||||||
? Row(
|
? Row(
|
||||||
@@ -249,7 +254,7 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
|||||||
? context.l10n.collapseProperties
|
? context.l10n.collapseProperties
|
||||||
: context.l10n.expandProperties,
|
: context.l10n.expandProperties,
|
||||||
isSelected: propertiesOpen,
|
isSelected: propertiesOpen,
|
||||||
onPressed: !viewSettings.hasValue
|
onPressed: !viewSettings.$1
|
||||||
? null
|
? null
|
||||||
: () {
|
: () {
|
||||||
if (desktop) {
|
if (desktop) {
|
||||||
@@ -285,23 +290,40 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
Widget dockedEditing({required bool showTools}) =>
|
Widget dockedEditing({required bool showTools}) => Consumer(
|
||||||
ExpandedEditorLayout(
|
builder: (context, ref, _) {
|
||||||
|
final dimensions = ref.watch(
|
||||||
|
projectViewSettingsProvider(widget.projectId).select(
|
||||||
|
(value) =>
|
||||||
|
(value.value?.mediaWidth, value.value?.timelineHeight),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return ExpandedEditorLayout(
|
||||||
preview: preview,
|
preview: preview,
|
||||||
header: header,
|
header: header,
|
||||||
properties: properties,
|
properties: properties,
|
||||||
media: media,
|
media: media,
|
||||||
showMedia: dockMedia,
|
showMedia: dockMedia,
|
||||||
showProperties: showTools && dockProperties,
|
showProperties: showTools && dockProperties,
|
||||||
timelineHeight: _timelineHeight,
|
mediaWidth: dimensions.$1,
|
||||||
|
onMediaWidthChanged: (width) {
|
||||||
|
if (viewSettings.$1) {
|
||||||
|
_viewController.setMediaWidth(width);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onMediaWidthChangeEnd: _saveViewSettings,
|
||||||
|
timelineHeight: dimensions.$2,
|
||||||
onTimelineHeightChanged: (height) {
|
onTimelineHeightChanged: (height) {
|
||||||
if (viewSettings.hasValue) {
|
if (viewSettings.$1) {
|
||||||
_viewController.setTimelineHeight(height);
|
_viewController.setTimelineHeight(height);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onTimelineHeightChangeEnd: _saveViewSettings,
|
onTimelineHeightChangeEnd: _saveViewSettings,
|
||||||
|
onJunctionResizeEnd: _saveViewSettings,
|
||||||
timeline: timeline,
|
timeline: timeline,
|
||||||
);
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
return Stack(
|
return Stack(
|
||||||
fit: StackFit.expand,
|
fit: StackFit.expand,
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class EditorTimelineDefaults extends StatelessWidget {
|
|||||||
: 26,
|
: 26,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.symmetric(
|
padding: EdgeInsets.symmetric(
|
||||||
horizontal: AppTheme.isDesktop(context) ? AppSpacing.tiny : 0,
|
horizontal: AppTheme.isDesktop(context) ? AppSpacing.small : 0,
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
@@ -90,7 +90,9 @@ class EditorTimelineDefaults extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Padding(
|
: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: AppSpacing.medium,
|
||||||
|
),
|
||||||
child: AppCommandToolbar(
|
child: AppCommandToolbar(
|
||||||
groups: [
|
groups: [
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
|||||||
|
|
||||||
import '../../../integrations/platform/device_experience.dart';
|
import '../../../integrations/platform/device_experience.dart';
|
||||||
import '../../../l10n/l10n.dart';
|
import '../../../l10n/l10n.dart';
|
||||||
|
import '../../../shared/layout/workspace_layout_metrics.dart';
|
||||||
|
|
||||||
import 'package:cutdex_ui/icons.dart';
|
import 'package:cutdex_ui/icons.dart';
|
||||||
import 'package:cutdex_ui/theme.dart';
|
import 'package:cutdex_ui/theme.dart';
|
||||||
@@ -61,6 +62,11 @@ class BoundedEditorLayout extends StatelessWidget {
|
|||||||
: context.l10n.expandProperties,
|
: context.l10n.expandProperties,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
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,
|
right: 0,
|
||||||
width: page
|
width: page
|
||||||
? constraints.maxWidth
|
? constraints.maxWidth
|
||||||
: math.min(320, constraints.maxWidth),
|
: math.min(
|
||||||
|
desktop && tool == EditorTool.properties
|
||||||
|
? WorkspaceLayoutMetrics.propertiesPanelWidth
|
||||||
|
: 320,
|
||||||
|
constraints.maxWidth,
|
||||||
|
),
|
||||||
child: Material(
|
child: Material(
|
||||||
key: const Key('editor-tool-surface'),
|
key: const Key('editor-tool-surface'),
|
||||||
elevation: page ? 0 : 8,
|
elevation: page ? 0 : 8,
|
||||||
|
|||||||
@@ -15,9 +15,13 @@ class ExpandedEditorLayout extends StatefulWidget {
|
|||||||
required this.media,
|
required this.media,
|
||||||
required this.showMedia,
|
required this.showMedia,
|
||||||
required this.showProperties,
|
required this.showProperties,
|
||||||
|
required this.mediaWidth,
|
||||||
|
required this.onMediaWidthChanged,
|
||||||
|
required this.onMediaWidthChangeEnd,
|
||||||
required this.timelineHeight,
|
required this.timelineHeight,
|
||||||
required this.onTimelineHeightChanged,
|
required this.onTimelineHeightChanged,
|
||||||
required this.onTimelineHeightChangeEnd,
|
required this.onTimelineHeightChangeEnd,
|
||||||
|
required this.onJunctionResizeEnd,
|
||||||
required this.timeline,
|
required this.timeline,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -27,9 +31,13 @@ class ExpandedEditorLayout extends StatefulWidget {
|
|||||||
final Widget media;
|
final Widget media;
|
||||||
final bool showMedia;
|
final bool showMedia;
|
||||||
final bool showProperties;
|
final bool showProperties;
|
||||||
|
final double? mediaWidth;
|
||||||
|
final ValueChanged<double> onMediaWidthChanged;
|
||||||
|
final VoidCallback onMediaWidthChangeEnd;
|
||||||
final double? timelineHeight;
|
final double? timelineHeight;
|
||||||
final ValueChanged<double> onTimelineHeightChanged;
|
final ValueChanged<double> onTimelineHeightChanged;
|
||||||
final VoidCallback onTimelineHeightChangeEnd;
|
final VoidCallback onTimelineHeightChangeEnd;
|
||||||
|
final VoidCallback onJunctionResizeEnd;
|
||||||
final Widget timeline;
|
final Widget timeline;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -50,28 +58,35 @@ class _ExpandedEditorLayoutState extends State<ExpandedEditorLayout> {
|
|||||||
WorkspaceCard(key: Key('editor-$name-card'), child: child);
|
WorkspaceCard(key: Key('editor-$name-card'), child: child);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => LayoutBuilder(
|
Widget build(BuildContext context) =>
|
||||||
|
WorkspaceResizeHighlightScope(child: _layout());
|
||||||
|
|
||||||
|
Widget _layout() => LayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
final maximum = math.max(
|
double resolveTimelineHeight(double? height) =>
|
||||||
0.0,
|
WorkspaceLayoutMetrics.resolveTimelineHeight(
|
||||||
constraints.maxHeight -
|
constraints.maxHeight,
|
||||||
gap -
|
height,
|
||||||
WorkspaceLayoutMetrics.previewMinimumHeight,
|
|
||||||
);
|
);
|
||||||
final minimum = math.min(
|
final timelineHeight = resolveTimelineHeight(widget.timelineHeight);
|
||||||
WorkspaceLayoutMetrics.timelineMinimumHeight,
|
|
||||||
maximum,
|
|
||||||
);
|
|
||||||
final timelineHeight =
|
|
||||||
(widget.timelineHeight ??
|
|
||||||
constraints.maxHeight *
|
|
||||||
WorkspaceLayoutMetrics.timelineDefaultHeightFraction)
|
|
||||||
.clamp(minimum, maximum)
|
|
||||||
.toDouble();
|
|
||||||
const mediaWidth = WorkspaceLayoutMetrics.mediaPanelWidth;
|
|
||||||
final propertiesWidth = widget.showProperties
|
final propertiesWidth = widget.showProperties
|
||||||
? WorkspaceLayoutMetrics.propertiesPanelWidth
|
? WorkspaceLayoutMetrics.propertiesPanelWidth
|
||||||
: 0.0;
|
: 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(
|
return Stack(
|
||||||
fit: StackFit.expand,
|
fit: StackFit.expand,
|
||||||
children: [
|
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(
|
Positioned(
|
||||||
key: const Key('editor-timeline-divider'),
|
key: const Key('editor-timeline-divider'),
|
||||||
left: 0,
|
left: 0,
|
||||||
@@ -138,15 +171,39 @@ class _ExpandedEditorLayoutState extends State<ExpandedEditorLayout> {
|
|||||||
height: WorkspaceLayoutMetrics.desktopResizeHitExtent,
|
height: WorkspaceLayoutMetrics.desktopResizeHitExtent,
|
||||||
child: WorkspaceResizeHandle(
|
child: WorkspaceResizeHandle(
|
||||||
key: const Key('editor-timeline-resize'),
|
key: const Key('editor-timeline-resize'),
|
||||||
|
highlightTargets: const {WorkspaceResizeBoundary.timeline},
|
||||||
axis: Axis.vertical,
|
axis: Axis.vertical,
|
||||||
initialValue: timelineHeight,
|
initialValue: timelineHeight,
|
||||||
direction: -1,
|
direction: -1,
|
||||||
onResize: (height) => widget.onTimelineHeightChanged(
|
onResize: (height) =>
|
||||||
height.clamp(minimum, maximum).toDouble(),
|
widget.onTimelineHeightChanged(resolveTimelineHeight(height)),
|
||||||
),
|
|
||||||
onEnd: widget.onTimelineHeightChangeEnd,
|
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 'dart:math' as math;
|
||||||
|
|
||||||
import 'package:cutdex_sdk/project.dart';
|
import 'package:cutdex_core/project.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:cutdex_sdk/timeline_ui.dart';
|
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'package:cutdex/diagnostics/app_diagnostics.dart';
|
import 'package:cutdex/diagnostics/app_diagnostics.dart';
|
||||||
import 'package:cutdex/errors/app_failure.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:freezed_annotation/freezed_annotation.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import 'subtitle_download.dart';
|
|||||||
import 'subtitle_task_actions.dart';
|
import 'subtitle_task_actions.dart';
|
||||||
|
|
||||||
import 'package:cutdex/l10n/l10n.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 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../integrations/runtime/processing_resource_repository.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/icons.dart';
|
||||||
import 'package:cutdex_ui/theme.dart';
|
import 'package:cutdex_ui/theme.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -24,12 +24,23 @@ class DesktopMediaAssetTile extends StatelessWidget {
|
|||||||
final MediaAvailability? availability;
|
final MediaAvailability? availability;
|
||||||
|
|
||||||
static TextStyle? _nameStyle(BuildContext context) =>
|
static TextStyle? _nameStyle(BuildContext context) =>
|
||||||
Theme.of(context).textTheme.bodyMedium
|
Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
?.copyWith(fontSize: 13, height: 20 / 13);
|
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) =>
|
static TextStyle? _metadataStyle(BuildContext context) =>
|
||||||
Theme.of(context).textTheme.bodySmall
|
Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||||
?.copyWith(fontSize: 12, height: 16 / 12);
|
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.
|
/// Font fallback and fractional scaling can round a line above size × height.
|
||||||
static double gridLabelHeight(BuildContext context) {
|
static double gridLabelHeight(BuildContext context) {
|
||||||
@@ -106,7 +117,7 @@ class DesktopMediaAssetTile extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
final cover = ClipRRect(
|
final cover = ClipRRect(
|
||||||
key: ValueKey('desktop-media-cover-${asset.id}'),
|
key: ValueKey('desktop-media-cover-${asset.id}'),
|
||||||
borderRadius: BorderRadius.circular(4),
|
borderRadius: BorderRadius.circular(AppInspectorMetrics.radius),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
if (unavailable)
|
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/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import 'dart:math' as math;
|
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/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.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 'dart:math' as math;
|
||||||
|
|
||||||
import 'package:cutdex/l10n/l10n.dart';
|
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/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
@@ -298,6 +298,95 @@ class _MediaBrowserBodyState extends ConsumerState<MediaBrowserBody>
|
|||||||
_anchorOwner = null;
|
_anchorOwner = null;
|
||||||
_anchorAssets = const [];
|
_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
|
final content = assets.isEmpty
|
||||||
? Center(
|
? Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
@@ -382,105 +471,6 @@ class _MediaBrowserBodyState extends ConsumerState<MediaBrowserBody>
|
|||||||
height: constraints.maxHeight,
|
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 scrollView(ScrollController controller) => !_isGrid
|
||||||
? widget.desktop
|
? widget.desktop
|
||||||
? ListView.builder(
|
? ListView.builder(
|
||||||
@@ -509,9 +499,10 @@ class _MediaBrowserBodyState extends ConsumerState<MediaBrowserBody>
|
|||||||
separatorBuilder: (_, _) =>
|
separatorBuilder: (_, _) =>
|
||||||
SizedBox(height: spacing),
|
SizedBox(height: spacing),
|
||||||
)
|
)
|
||||||
: GridView.builder(
|
: GridView.custom(
|
||||||
key: PageStorageKey(('media-grid', widget.projectId)),
|
key: PageStorageKey(('media-grid', widget.projectId)),
|
||||||
controller: controller,
|
controller: controller,
|
||||||
|
semanticChildCount: assets.length,
|
||||||
padding: EdgeInsets.all(padding),
|
padding: EdgeInsets.all(padding),
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
crossAxisCount: columns,
|
crossAxisCount: columns,
|
||||||
@@ -528,8 +519,10 @@ class _MediaBrowserBodyState extends ConsumerState<MediaBrowserBody>
|
|||||||
labelHeight +
|
labelHeight +
|
||||||
2,
|
2,
|
||||||
),
|
),
|
||||||
itemCount: assets.length,
|
childrenDelegate: _MediaChildrenDelegate(
|
||||||
itemBuilder: item,
|
item,
|
||||||
|
childCount: assets.length,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
if (widget.desktop) {
|
if (widget.desktop) {
|
||||||
return ScrollEdgeFade(
|
return ScrollEdgeFade(
|
||||||
@@ -546,8 +539,6 @@ class _MediaBrowserBodyState extends ConsumerState<MediaBrowserBody>
|
|||||||
if (!widget.desktop) return content;
|
if (!widget.desktop) return content;
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
if (!_isGrid)
|
|
||||||
const DesktopMediaListHeader(key: Key('media-list-header')),
|
|
||||||
Expanded(child: content),
|
Expanded(child: content),
|
||||||
const Divider(height: 1),
|
const Divider(height: 1),
|
||||||
SizedBox(
|
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 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
import '../../integrations/platform/file_picker.dart';
|
import '../../integrations/platform/file_picker.dart';
|
||||||
@@ -30,9 +30,9 @@ enum MediaSort { importOrder, nameAscending, nameDescending }
|
|||||||
|
|
||||||
/// Desktop thumbnail density, independent of touch-page presentation.
|
/// Desktop thumbnail density, independent of touch-page presentation.
|
||||||
enum MediaGridSize {
|
enum MediaGridSize {
|
||||||
small(120),
|
small(96),
|
||||||
medium(160),
|
medium(120),
|
||||||
large(200);
|
large(160);
|
||||||
|
|
||||||
const MediaGridSize(this.targetWidth);
|
const MediaGridSize(this.targetWidth);
|
||||||
final double targetWidth;
|
final double targetWidth;
|
||||||
|
|||||||
@@ -2,15 +2,14 @@ import 'dart:math' as math;
|
|||||||
|
|
||||||
/// Shared desktop geometry for cards, rows, headers and browse anchoring.
|
/// Shared desktop geometry for cards, rows, headers and browse anchoring.
|
||||||
abstract final class DesktopMediaMetrics {
|
abstract final class DesktopMediaMetrics {
|
||||||
static const padding = 12.0;
|
static const padding = 16.0;
|
||||||
static const gap = 8.0;
|
static const gap = 8.0;
|
||||||
static const tilePadding = 5.0;
|
static const tilePadding = 8.0;
|
||||||
static const listCover = 56.0;
|
static const listCover = 56.0;
|
||||||
static const listRow = 48.0;
|
static const listRow = 48.0;
|
||||||
static const listHeader = 28.0;
|
|
||||||
|
|
||||||
static int columns(double width, double targetWidth) =>
|
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) =>
|
static double gridExtent(double tileWidth, double labelHeight) =>
|
||||||
(tileWidth - tilePadding * 2) * 9 / 16 +
|
(tileWidth - tilePadding * 2) * 9 / 16 +
|
||||||
@@ -19,7 +18,7 @@ abstract final class DesktopMediaMetrics {
|
|||||||
tilePadding * 2;
|
tilePadding * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Matching list-column visibility for a header and its asset rows.
|
/// List-column visibility within asset rows.
|
||||||
final class DesktopMediaListColumns {
|
final class DesktopMediaListColumns {
|
||||||
const DesktopMediaListColumns(double width)
|
const DesktopMediaListColumns(double width)
|
||||||
: duration = width >= 240,
|
: duration = width >= 240,
|
||||||
|
|||||||
@@ -292,6 +292,34 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _desktopToolbar(BuildContext context, RecentProject? selected) {
|
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(
|
Widget category() => Semantics(
|
||||||
label: context.l10n.mediaCategory,
|
label: context.l10n.mediaCategory,
|
||||||
child: AppDropdownMenu(
|
child: AppDropdownMenu(
|
||||||
@@ -309,6 +337,7 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
|||||||
buttonKey: const Key('media-category-button'),
|
buttonKey: const Key('media-category-button'),
|
||||||
focusNode: focus,
|
focusNode: focus,
|
||||||
onPressed: toggle,
|
onPressed: toggle,
|
||||||
|
style: desktopButtonStyle,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -341,9 +370,14 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
|||||||
else
|
else
|
||||||
SizedBox(
|
SizedBox(
|
||||||
key: const Key('media-project-row'),
|
key: const Key('media-project-row'),
|
||||||
height: 36,
|
height: AppInspectorMetrics.row,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||||
|
AppInspectorMetrics.padding,
|
||||||
|
AppInspectorMetrics.rowPadding,
|
||||||
|
AppInspectorMetrics.trailingPadding,
|
||||||
|
AppInspectorMetrics.rowPadding,
|
||||||
|
),
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (context, constraints) => Row(
|
builder: (context, constraints) => Row(
|
||||||
children: [
|
children: [
|
||||||
@@ -369,6 +403,7 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
|||||||
buttonKey: const Key('media-project-button'),
|
buttonKey: const Key('media-project-button'),
|
||||||
focusNode: focusNode,
|
focusNode: focusNode,
|
||||||
onPressed: toggle,
|
onPressed: toggle,
|
||||||
|
style: desktopButtonStyle,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -385,7 +420,7 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: AppSpacing.small),
|
||||||
ConstrainedBox(
|
ConstrainedBox(
|
||||||
constraints: BoxConstraints(
|
constraints: BoxConstraints(
|
||||||
maxWidth: (constraints.maxWidth * .45).clamp(
|
maxWidth: (constraints.maxWidth * .45).clamp(
|
||||||
@@ -394,12 +429,12 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 28,
|
height: AppInspectorMetrics.input,
|
||||||
child: Tooltip(
|
child: Tooltip(
|
||||||
message: context.l10n.importMedia,
|
message: context.l10n.importMedia,
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
key: const Key('media-import-button'),
|
key: const Key('media-import-button'),
|
||||||
style: AppTheme.toolbarButtonStyle(context),
|
style: desktopButtonStyle,
|
||||||
onPressed: canImport ? onImport : null,
|
onPressed: canImport ? onImport : null,
|
||||||
child: Text(
|
child: Text(
|
||||||
context.l10n.importMedia,
|
context.l10n.importMedia,
|
||||||
@@ -427,6 +462,14 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
|||||||
Widget Function() category,
|
Widget Function() category,
|
||||||
String Function(MediaSort) sortLabel,
|
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() => [
|
List<Widget> sortItems() => [
|
||||||
for (final value in MediaSort.values)
|
for (final value in MediaSort.values)
|
||||||
AppMenuItem(
|
AppMenuItem(
|
||||||
@@ -462,7 +505,7 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
|||||||
required IconData icon,
|
required IconData icon,
|
||||||
required List<Widget> items,
|
required List<Widget> items,
|
||||||
}) => SizedBox.square(
|
}) => SizedBox.square(
|
||||||
dimension: 28,
|
dimension: AppInspectorMetrics.action,
|
||||||
child: AppDropdownMenu(
|
child: AppDropdownMenu(
|
||||||
items: items,
|
items: items,
|
||||||
builder: (context, toggle, focus) => IconButton(
|
builder: (context, toggle, focus) => IconButton(
|
||||||
@@ -477,9 +520,14 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
|||||||
);
|
);
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
key: const Key('media-filter-row'),
|
key: const Key('media-filter-row'),
|
||||||
height: 40,
|
height: AppInspectorMetrics.row,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(12, 4, 12, 4),
|
padding: const EdgeInsets.fromLTRB(
|
||||||
|
AppInspectorMetrics.padding,
|
||||||
|
AppInspectorMetrics.rowPadding,
|
||||||
|
AppInspectorMetrics.trailingPadding,
|
||||||
|
AppInspectorMetrics.rowPadding,
|
||||||
|
),
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
final wide = constraints.maxWidth >= 400;
|
final wide = constraints.maxWidth >= 400;
|
||||||
@@ -490,13 +538,10 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
|||||||
key: const Key('media-search'),
|
key: const Key('media-search'),
|
||||||
controller: _search,
|
controller: _search,
|
||||||
enabled: widget.onQueryChanged != null,
|
enabled: widget.onQueryChanged != null,
|
||||||
style: AppTheme.inputTextStyle(
|
style: AppTheme.inputTextStyle(context, style: searchText),
|
||||||
context,
|
|
||||||
style: AppTheme.toolbarTextStyle(context),
|
|
||||||
),
|
|
||||||
cursorHeight: AppTheme.inputCursorHeight(
|
cursorHeight: AppTheme.inputCursorHeight(
|
||||||
context,
|
context,
|
||||||
style: AppTheme.toolbarTextStyle(context),
|
style: searchText,
|
||||||
),
|
),
|
||||||
textAlignVertical: TextAlignVertical.center,
|
textAlignVertical: TextAlignVertical.center,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
@@ -505,36 +550,61 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
|||||||
),
|
),
|
||||||
hintStyle: AppTheme.inputHintStyle(
|
hintStyle: AppTheme.inputHintStyle(
|
||||||
context,
|
context,
|
||||||
style: AppTheme.toolbarTextStyle(context),
|
style: searchText,
|
||||||
),
|
),
|
||||||
|
filled: true,
|
||||||
|
fillColor: colors.surfaceContainer,
|
||||||
isDense: true,
|
isDense: true,
|
||||||
constraints: const BoxConstraints(minHeight: 32),
|
constraints: const BoxConstraints(
|
||||||
|
minHeight: AppInspectorMetrics.input,
|
||||||
|
),
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
horizontal: 8,
|
horizontal: AppSpacing.small,
|
||||||
vertical: 4,
|
),
|
||||||
|
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
|
prefixIcon: constraints.maxWidth < 160
|
||||||
? null
|
? null
|
||||||
: const Icon(AppIcons.search, size: 16),
|
: const Icon(AppIcons.search, size: 16),
|
||||||
prefixIconConstraints: const BoxConstraints(
|
prefixIconConstraints: const BoxConstraints(
|
||||||
minWidth: 28,
|
minWidth: AppInspectorMetrics.input,
|
||||||
minHeight: 28,
|
minHeight: AppInspectorMetrics.input,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onChanged: (value) => widget.onQueryChanged?.call(value),
|
onChanged: (value) => widget.onQueryChanged?.call(value),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: AppSpacing.small),
|
||||||
if (wide) ...[
|
if (wide) ...[
|
||||||
SizedBox(width: 88, height: 28, child: category()),
|
SizedBox(
|
||||||
const SizedBox(width: 4),
|
width: 88,
|
||||||
|
height: AppInspectorMetrics.input,
|
||||||
|
child: category(),
|
||||||
|
),
|
||||||
|
const SizedBox(width: AppSpacing.small),
|
||||||
menuButton(
|
menuButton(
|
||||||
key: const Key('media-sort-button'),
|
key: const Key('media-sort-button'),
|
||||||
tooltip: context.l10n.sortMedia,
|
tooltip: context.l10n.sortMedia,
|
||||||
icon: AppIcons.sort,
|
icon: AppIcons.sort,
|
||||||
items: sortItems(),
|
items: sortItems(),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: AppSpacing.small),
|
||||||
menuButton(
|
menuButton(
|
||||||
key: const Key('media-size-button'),
|
key: const Key('media-size-button'),
|
||||||
tooltip: context.l10n.mediaThumbnailSize,
|
tooltip: context.l10n.mediaThumbnailSize,
|
||||||
@@ -564,9 +634,9 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
|||||||
...sizeItems(),
|
...sizeItems(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: AppSpacing.small),
|
||||||
SizedBox.square(
|
SizedBox.square(
|
||||||
dimension: 28,
|
dimension: AppInspectorMetrics.action,
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
key: const Key('media-layout-toggle'),
|
key: const Key('media-layout-toggle'),
|
||||||
onPressed: onToggleGrid,
|
onPressed: onToggleGrid,
|
||||||
@@ -581,9 +651,9 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (widget.projectScoped) ...[
|
if (widget.projectScoped) ...[
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: AppSpacing.small),
|
||||||
SizedBox.square(
|
SizedBox.square(
|
||||||
dimension: 28,
|
dimension: AppInspectorMetrics.action,
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
key: const Key('media-import-button'),
|
key: const Key('media-import-button'),
|
||||||
onPressed: canImport ? () => onImport() : null,
|
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';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
part 'processing_targets.freezed.dart';
|
part 'processing_targets.freezed.dart';
|
||||||
|
|||||||
@@ -115,9 +115,13 @@ class _ResourceSectionTabsState extends State<ResourceSectionTabs> {
|
|||||||
final l10n = AppLocalizations.of(context)!;
|
final l10n = AppLocalizations.of(context)!;
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
key: const Key('resource-section-tabs'),
|
key: const Key('resource-section-tabs'),
|
||||||
height: 36,
|
height: AppDesktopMetrics.timelineTabs,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
|
padding: const EdgeInsetsDirectional.only(
|
||||||
|
start: AppSpacing.small,
|
||||||
|
top: 4,
|
||||||
|
bottom: 4,
|
||||||
|
),
|
||||||
child: ScrollEdgeFade(
|
child: ScrollEdgeFade(
|
||||||
controller: _scrollController,
|
controller: _scrollController,
|
||||||
axis: Axis.horizontal,
|
axis: Axis.horizontal,
|
||||||
@@ -127,17 +131,13 @@ class _ResourceSectionTabsState extends State<ResourceSectionTabs> {
|
|||||||
key: const Key('resource-tabs-list'),
|
key: const Key('resource-tabs-list'),
|
||||||
controller: _scrollController,
|
controller: _scrollController,
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
for (final section in ResourceSection.values) ...[
|
for (final section in ResourceSection.values) ...[
|
||||||
if (section != ResourceSection.values.first)
|
if (section != ResourceSection.values.first)
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: AppSpacing.tiny),
|
||||||
KeyedSubtree(
|
KeyedSubtree(
|
||||||
key: widget.selected == section
|
key: widget.selected == section ? _selectedTabKey : null,
|
||||||
? _selectedTabKey
|
|
||||||
: null,
|
|
||||||
child: Semantics(
|
child: Semantics(
|
||||||
selected: widget.selected == section,
|
selected: widget.selected == section,
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
@@ -160,7 +160,6 @@ class _ResourceSectionTabsState extends State<ResourceSectionTabs> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import 'package:cutdex/diagnostics/app_diagnostics.dart';
|
import 'package:cutdex/diagnostics/app_diagnostics.dart';
|
||||||
import 'package:cutdex/errors/app_failure.dart';
|
import 'package:cutdex/errors/app_failure.dart';
|
||||||
|
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
import 'package:cutdex_sdk/project.dart';
|
import 'package:cutdex_core/project.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_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/l10n/l10n.dart';
|
||||||
|
|
||||||
import 'package:cutdex_sdk/project.dart';
|
import 'package:cutdex_core/project.dart';
|
||||||
import 'package:cutdex_sdk/runtime/processing_contracts.dart';
|
import 'package:cutdex_native_flutter/processing_contracts.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.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 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'media_asset_cover.dart';
|
import 'media_asset_cover.dart';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../l10n/l10n.dart';
|
import '../../l10n/l10n.dart';
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import 'package:flutter/services.dart';
|
|||||||
|
|
||||||
import 'package:cutdex_ui/theme.dart';
|
import 'package:cutdex_ui/theme.dart';
|
||||||
import 'package:cutdex_native/cutdex_native.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.
|
/// Moves the existing preview into the root overlay, retaining its native view.
|
||||||
class PreviewFullscreenHost extends StatefulWidget {
|
class PreviewFullscreenHost extends StatefulWidget {
|
||||||
|
|||||||
@@ -2,8 +2,9 @@ import 'package:cutdex/l10n/l10n.dart';
|
|||||||
|
|
||||||
import '../../errors/app_failure.dart';
|
import '../../errors/app_failure.dart';
|
||||||
|
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
import 'package:cutdex_sdk/runtime.dart';
|
import 'package:cutdex_core/execution.dart';
|
||||||
|
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||||
|
|
||||||
String previewErrorMessage(Object e, AppLocalizations l10n) => switch (e) {
|
String previewErrorMessage(Object e, AppLocalizations l10n) => switch (e) {
|
||||||
AppException(:final failure) => l10n.failureMessage(failure),
|
AppException(:final failure) => l10n.failureMessage(failure),
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:cutdex/features/properties/canvas_presets.dart';
|
import 'package:cutdex/features/properties/canvas_presets.dart';
|
||||||
import 'package:cutdex/l10n/l10n.dart';
|
import 'package:cutdex/l10n/l10n.dart';
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
import 'package:cutdex_sdk/preview.dart';
|
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||||
import 'package:cutdex_sdk/project.dart';
|
import 'package:cutdex_core/project.dart';
|
||||||
import 'package:cutdex_sdk/runtime.dart';
|
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
@@ -228,6 +228,8 @@ class _EditorPreviewContent extends ConsumerWidget {
|
|||||||
select: () => (
|
select: () => (
|
||||||
activeController.positionTick,
|
activeController.positionTick,
|
||||||
activeController.selectedVisualIds.isNotEmpty,
|
activeController.selectedVisualIds.isNotEmpty,
|
||||||
|
activeController.distortionEditingElement,
|
||||||
|
activeController.distortionPerspective,
|
||||||
activeController.maskEditingElement,
|
activeController.maskEditingElement,
|
||||||
activeController.obscureEditingElement,
|
activeController.obscureEditingElement,
|
||||||
),
|
),
|
||||||
@@ -621,6 +623,22 @@ class _PreviewToolbar extends StatelessWidget {
|
|||||||
final PreviewController? controller;
|
final PreviewController? controller;
|
||||||
final SourcePreviewController? source;
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (PreviewFullscreenScope.of(context)?.fullscreen == true) {
|
if (PreviewFullscreenScope.of(context)?.fullscreen == true) {
|
||||||
@@ -661,7 +679,7 @@ class _PreviewToolbar extends StatelessWidget {
|
|||||||
try {
|
try {
|
||||||
final time = CommandTime(tick, TimelineClock.ticksPerSecond);
|
final time = CommandTime(tick, TimelineClock.ticksPerSecond);
|
||||||
if (source case final source?) {
|
if (source case final source?) {
|
||||||
await source.control(SourcePreviewAction.seek, at: time);
|
await source.seekInteractive(tick);
|
||||||
} else if (preview?.activeSequence() case final sequence?) {
|
} else if (preview?.activeSequence() case final sequence?) {
|
||||||
await preview!.controlPreview(sequence, PreviewAction.seek, at: time);
|
await preview!.controlPreview(sequence, PreviewAction.seek, at: time);
|
||||||
}
|
}
|
||||||
@@ -705,12 +723,25 @@ class _PreviewToolbar extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
icon: Icon(direction < 0 ? AppIcons.previousFrame : AppIcons.nextFrame),
|
icon: Icon(direction < 0 ? AppIcons.previousFrame : AppIcons.nextFrame),
|
||||||
|
style: _compactButtonStyle(context),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
Widget _build(BuildContext context) {
|
Widget _build(BuildContext context) {
|
||||||
final preview = controller;
|
final preview = controller;
|
||||||
final playing = source?.playing ?? preview?.playing ?? false;
|
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 =
|
final frameDuration =
|
||||||
source?.frameDuration ??
|
source?.frameDuration ??
|
||||||
preview?.frameDuration ??
|
preview?.frameDuration ??
|
||||||
@@ -762,7 +793,9 @@ class _PreviewToolbar extends StatelessWidget {
|
|||||||
? AppDesktopMetrics.playbackBar
|
? AppDesktopMetrics.playbackBar
|
||||||
: AppControlSize.panelHeader,
|
: AppControlSize.panelHeader,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: AppSpacing.compact),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: AppInspectorMetrics.padding,
|
||||||
|
),
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
final controls = Row(
|
final controls = Row(
|
||||||
@@ -803,13 +836,14 @@ class _PreviewToolbar extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
style: timeTextStyle,
|
||||||
fontFeatures: [const FontFeature.tabularFigures()],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
if (AppTheme.isDesktop(context)) ...[
|
||||||
if (AppTheme.isDesktop(context)) _frameButton(context, -1),
|
const SizedBox(width: AppSpacing.small),
|
||||||
|
_frameButton(context, -1),
|
||||||
|
],
|
||||||
ListenableSelector(
|
ListenableSelector(
|
||||||
listenable: source ?? preview,
|
listenable: source ?? preview,
|
||||||
select: () => (
|
select: () => (
|
||||||
@@ -826,10 +860,14 @@ class _PreviewToolbar extends StatelessWidget {
|
|||||||
? preview.togglePlayback
|
? preview.togglePlayback
|
||||||
: null,
|
: null,
|
||||||
icon: Icon(playing ? AppIcons.pause : AppIcons.play),
|
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(
|
Expanded(
|
||||||
child: ListenableSelector(
|
child: ListenableSelector(
|
||||||
listenable: source ?? preview,
|
listenable: source ?? preview,
|
||||||
@@ -854,8 +892,9 @@ class _PreviewToolbar extends StatelessWidget {
|
|||||||
tooltip: context.l10n.retryPreview,
|
tooltip: context.l10n.retryPreview,
|
||||||
onPressed: preview.busy ? null : preview.retry,
|
onPressed: preview.busy ? null : preview.retry,
|
||||||
icon: const Icon(AppIcons.refresh),
|
icon: const Icon(AppIcons.refresh),
|
||||||
|
style: _compactButtonStyle(context),
|
||||||
),
|
),
|
||||||
const SizedBox(width: AppSpacing.gap),
|
const SizedBox(width: AppSpacing.small),
|
||||||
],
|
],
|
||||||
if (source == null &&
|
if (source == null &&
|
||||||
PreviewFullscreenScope.of(context)?.fullscreen !=
|
PreviewFullscreenScope.of(context)?.fullscreen !=
|
||||||
@@ -865,6 +904,25 @@ class _PreviewToolbar extends StatelessWidget {
|
|||||||
emptyLabel: context.l10n.noMatchingOptions,
|
emptyLabel: context.l10n.noMatchingOptions,
|
||||||
label: context.l10n.canvasRatio,
|
label: context.l10n.canvasRatio,
|
||||||
outlined: false,
|
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:
|
value:
|
||||||
preview?.canvas ?? ProjectCanvas.widescreen,
|
preview?.canvas ?? ProjectCanvas.widescreen,
|
||||||
onChanged: preview?.setCanvas,
|
onChanged: preview?.setCanvas,
|
||||||
@@ -894,6 +952,7 @@ class _PreviewToolbar extends StatelessWidget {
|
|||||||
? AppIcons.exitFullscreen
|
? AppIcons.exitFullscreen
|
||||||
: AppIcons.fullscreen,
|
: AppIcons.fullscreen,
|
||||||
),
|
),
|
||||||
|
style: _compactButtonStyle(context),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import 'project_switch_region.dart';
|
|||||||
import 'project_sidebar.dart';
|
import 'project_sidebar.dart';
|
||||||
import 'project_tabs_bar.dart';
|
import 'project_tabs_bar.dart';
|
||||||
import 'project_tabs_controller.dart';
|
import 'project_tabs_controller.dart';
|
||||||
|
import 'workflow_page.dart';
|
||||||
import 'widgets/name_dialog.dart';
|
import 'widgets/name_dialog.dart';
|
||||||
|
|
||||||
/// The single application surface: project navigation beside the editor.
|
/// The single application surface: project navigation beside the editor.
|
||||||
@@ -294,6 +295,19 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
|||||||
);
|
);
|
||||||
final projects = ref.read(projectsProvider);
|
final projects = ref.read(projectsProvider);
|
||||||
final state = projects.value ?? const ProjectState();
|
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(
|
return EditorWindowChrome(
|
||||||
headerHeight: desktop ? DesktopWindowFrame.headerHeight : 48,
|
headerHeight: desktop ? DesktopWindowFrame.headerHeight : 48,
|
||||||
builder: (context, integrated) => Scaffold(
|
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(
|
Widget contentSurface(
|
||||||
DesktopContent surface,
|
DesktopContent surface,
|
||||||
Widget child,
|
Widget child,
|
||||||
) => ExcludeFocus(
|
) => ExcludeFocus(
|
||||||
excluding:
|
excluding: !isActiveContent(surface),
|
||||||
(contentSelection.surface ==
|
|
||||||
DesktopContent.settings) !=
|
|
||||||
(surface == DesktopContent.settings),
|
|
||||||
child: TickerMode(
|
child: TickerMode(
|
||||||
enabled:
|
enabled: isActiveContent(surface),
|
||||||
(contentSelection.surface ==
|
|
||||||
DesktopContent.settings) ==
|
|
||||||
(surface == DesktopContent.settings),
|
|
||||||
child: child,
|
child: child,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
Widget desktopContents(
|
Widget desktopContents(
|
||||||
Widget workspace,
|
Widget workspace,
|
||||||
) => IndexedStack(
|
) => IndexedStack(
|
||||||
index:
|
index: switch (contentSelection.surface) {
|
||||||
contentSelection.surface ==
|
DesktopContent.settings => 1,
|
||||||
DesktopContent.settings
|
DesktopContent.workflow => 2,
|
||||||
? 1
|
_ => 0,
|
||||||
: 0,
|
},
|
||||||
children: [
|
children: [
|
||||||
contentSurface(
|
contentSurface(
|
||||||
DesktopContent.workspace,
|
DesktopContent.workspace,
|
||||||
@@ -685,6 +702,10 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
|||||||
)
|
)
|
||||||
: const SizedBox.shrink(),
|
: const SizedBox.shrink(),
|
||||||
),
|
),
|
||||||
|
contentSurface(
|
||||||
|
DesktopContent.workflow,
|
||||||
|
const WorkflowPage(),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
return switch (experience) {
|
return switch (experience) {
|
||||||
@@ -773,17 +794,23 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
resourceLibrarySelected:
|
|
||||||
contentSelection.surface ==
|
|
||||||
DesktopContent.resourceLibrary,
|
|
||||||
onResourceLibraryPressed: () => selectSidebar(
|
|
||||||
DesktopContent.resourceLibrary,
|
|
||||||
),
|
|
||||||
settingsSelected:
|
settingsSelected:
|
||||||
contentSelection.surface ==
|
contentSelection.surface ==
|
||||||
DesktopContent.settings,
|
DesktopContent.settings,
|
||||||
onHomePressed: () =>
|
workflowSelected:
|
||||||
selectSidebar(DesktopContent.workspace),
|
contentSelection.surface ==
|
||||||
|
DesktopContent.workflow,
|
||||||
|
onHomePressed: () {
|
||||||
|
selectSidebar(DesktopContent.workspace);
|
||||||
|
_setMode(WorkspaceMode.agent);
|
||||||
|
},
|
||||||
|
onWorkflowPressed: () {
|
||||||
|
ref
|
||||||
|
.read(desktopContentProvider.notifier)
|
||||||
|
.select(DesktopContent.workflow);
|
||||||
|
_desktopScaffoldKey.currentState
|
||||||
|
?.closeDrawer();
|
||||||
|
},
|
||||||
onSettingsPressed: () =>
|
onSettingsPressed: () =>
|
||||||
showSettingsPage(context),
|
showSettingsPage(context),
|
||||||
child: desktopContents(
|
child: desktopContents(
|
||||||
@@ -794,15 +821,43 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
|||||||
navigationDrawer: navigation(drawer: true),
|
navigationDrawer: navigation(drawer: true),
|
||||||
mode: _mode,
|
mode: _mode,
|
||||||
sidebarCollapsed: navigationCollapsed,
|
sidebarCollapsed: navigationCollapsed,
|
||||||
|
sidebarCanExpand: !navigationHiddenBySpace,
|
||||||
sidebarWidth: _sidebarWidthOverride,
|
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) {
|
onSidebarCollapsedChanged: (value) {
|
||||||
_sidebarCollapsed = value;
|
_sidebarCollapsed = value;
|
||||||
_saveViewState();
|
_saveViewState();
|
||||||
},
|
},
|
||||||
onSidebarWidthChanged: (value) {
|
onSidebarWidthChanged: (value) {
|
||||||
_sidebarWidthOverride = value;
|
_sidebarWidthOverride = value;
|
||||||
_saveViewState();
|
|
||||||
},
|
},
|
||||||
|
onSidebarResizeEnd: _saveViewState,
|
||||||
sidebarBuilder: (geometry, expand) =>
|
sidebarBuilder: (geometry, expand) =>
|
||||||
navigation(
|
navigation(
|
||||||
geometry: geometry,
|
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:flutter/widgets.dart';
|
||||||
import 'package:cutdex/l10n/l10n.dart';
|
import 'package:cutdex/l10n/l10n.dart';
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
|
|
||||||
extension TransformChannelLabel on TransformChannel {
|
extension TransformChannelLabel on TransformChannel {
|
||||||
String label(BuildContext context) => switch (this) {
|
String label(BuildContext context) => switch (this) {
|
||||||
TransformChannel.position => context.l10n.position,
|
TransformChannel.position => context.l10n.position,
|
||||||
TransformChannel.rotation => context.l10n.rotation,
|
TransformChannel.rotation => context.l10n.rotation,
|
||||||
TransformChannel.scale => context.l10n.scale,
|
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/l10n/l10n.dart';
|
||||||
import 'package:cutdex/features/properties/audio_gain_scale.dart';
|
import 'package:cutdex/features/properties/audio_gain_scale.dart';
|
||||||
import 'package:cutdex_sdk/timeline/engine.dart';
|
import 'package:cutdex_core/timeline/engine.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:cutdex_ui/icons.dart';
|
import 'package:cutdex_ui/icons.dart';
|
||||||
@@ -12,9 +12,9 @@ import 'package:cutdex_ui/theme.dart';
|
|||||||
|
|
||||||
import '../../workspace/timeline_session.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 {
|
class AudioProperties extends StatefulWidget {
|
||||||
const AudioProperties({
|
const AudioProperties({
|
||||||
@@ -169,8 +169,7 @@ class _AudioPropertiesState extends State<AudioProperties> {
|
|||||||
if (_text.text != text) _text.text = text;
|
if (_text.text != text) _text.text = text;
|
||||||
}
|
}
|
||||||
if (ClipAudioGain.isDetached(record)) {
|
if (ClipAudioGain.isDetached(record)) {
|
||||||
return Padding(
|
return AppPropertySection(
|
||||||
padding: AppTheme.propertySectionPadding(context),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
@@ -343,15 +342,18 @@ class _AudioPropertiesState extends State<AudioProperties> {
|
|||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
AppPropertySection(
|
||||||
padding: AppTheme.propertySectionPadding(context),
|
|
||||||
child: AppTheme.isDesktop(context)
|
child: AppTheme.isDesktop(context)
|
||||||
? AppPropertyGroup(
|
? AppPropertyGroup(
|
||||||
label: widget.hasAudio
|
label: widget.hasAudio
|
||||||
? context.l10n.volume
|
? context.l10n.volume
|
||||||
: context.l10n.unboundAudio,
|
: context.l10n.unboundAudio,
|
||||||
actions: volumeActions,
|
actions: volumeActions.skip(1).toList(),
|
||||||
child: volumeControls,
|
padChild: false,
|
||||||
|
child: AppPropertyRow(
|
||||||
|
trailing: volumeActions.first,
|
||||||
|
children: [volumeControls],
|
||||||
|
),
|
||||||
)
|
)
|
||||||
: Column(
|
: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:cutdex/l10n/l10n.dart';
|
import 'package:cutdex/l10n/l10n.dart';
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
|
|
||||||
abstract final class ProjectCanvasPresets {
|
abstract final class ProjectCanvasPresets {
|
||||||
static const values = {
|
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/shared/widgets/error_notification_host.dart';
|
||||||
import 'package:cutdex/l10n/l10n.dart';
|
import 'package:cutdex/l10n/l10n.dart';
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:cutdex_ui/icons.dart';
|
import 'package:cutdex_ui/icons.dart';
|
||||||
@@ -196,8 +196,7 @@ class _CaptionPropertiesState extends State<CaptionProperties> {
|
|||||||
: 28.0;
|
: 28.0;
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
AppPropertySection(
|
||||||
padding: AppTheme.propertySectionPadding(context),
|
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: AppTheme.propertyInputHeight(context),
|
height: AppTheme.propertyInputHeight(context),
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -226,9 +225,13 @@ class _CaptionPropertiesState extends State<CaptionProperties> {
|
|||||||
vertical: 0,
|
vertical: 0,
|
||||||
),
|
),
|
||||||
prefixIcon: const Icon(AppIcons.search, size: 14),
|
prefixIcon: const Icon(AppIcons.search, size: 14),
|
||||||
prefixIconConstraints: const BoxConstraints(
|
prefixIconConstraints: BoxConstraints(
|
||||||
minWidth: 28,
|
minWidth: AppTheme.isCompactInspector(context)
|
||||||
minHeight: 28,
|
? 24
|
||||||
|
: 28,
|
||||||
|
minHeight: AppTheme.isCompactInspector(context)
|
||||||
|
? 24
|
||||||
|
: 28,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onChanged: (value) => setState(
|
onChanged: (value) => setState(
|
||||||
@@ -448,7 +451,7 @@ class _CaptionPropertiesState extends State<CaptionProperties> {
|
|||||||
Widget panel(Widget content) => WorkspacePanel(
|
Widget panel(Widget content) => WorkspacePanel(
|
||||||
paintBackground: false,
|
paintBackground: false,
|
||||||
headerHeight: AppTheme.isDesktop(context)
|
headerHeight: AppTheme.isDesktop(context)
|
||||||
? AppDesktopMetrics.panelHeader
|
? AppInspectorMetrics.sectionHeader
|
||||||
: CompactPanelTabs.height,
|
: CompactPanelTabs.height,
|
||||||
headerPadding: EdgeInsets.zero,
|
headerPadding: EdgeInsets.zero,
|
||||||
showHeaderDivider: false,
|
showHeaderDivider: false,
|
||||||
@@ -564,7 +567,9 @@ class _CaptionPropertiesState extends State<CaptionProperties> {
|
|||||||
key: const ValueKey('caption-detail-scroll-fade'),
|
key: const ValueKey('caption-detail-scroll-fade'),
|
||||||
builder: (controller) => ListView(
|
builder: (controller) => ListView(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
padding: const EdgeInsets.symmetric(vertical: AppSpacing.small),
|
padding: AppTheme.isDesktop(context)
|
||||||
|
? EdgeInsets.zero
|
||||||
|
: const EdgeInsets.symmetric(vertical: AppSpacing.small),
|
||||||
children:
|
children:
|
||||||
[
|
[
|
||||||
if (AppTheme.isDesktop(context))
|
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(
|
.map(
|
||||||
(item) =>
|
(item) =>
|
||||||
item is SizedBox ||
|
item is SizedBox ||
|
||||||
identical(item, widget.transformProperties)
|
identical(item, widget.transformProperties)
|
||||||
? item
|
? item
|
||||||
|
: AppTheme.isDesktop(context)
|
||||||
|
? AppPropertySection(child: item)
|
||||||
: Padding(
|
: Padding(
|
||||||
padding: EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: AppTheme.isDesktop(context)
|
horizontal: AppSpacing.panelContentHorizontal,
|
||||||
? AppInspectorMetrics.padding
|
|
||||||
: AppSpacing.panelContentHorizontal,
|
|
||||||
),
|
),
|
||||||
child: item,
|
child: item,
|
||||||
),
|
),
|
||||||
@@ -804,11 +814,13 @@ class _CaptionTextInput extends StatefulWidget {
|
|||||||
required this.editContext,
|
required this.editContext,
|
||||||
required this.onSubmit,
|
required this.onSubmit,
|
||||||
this.label,
|
this.label,
|
||||||
|
this.leading,
|
||||||
this.maxLines = 1,
|
this.maxLines = 1,
|
||||||
});
|
});
|
||||||
final String value;
|
final String value;
|
||||||
final Object editContext;
|
final Object editContext;
|
||||||
final String? label;
|
final String? label;
|
||||||
|
final Widget? leading;
|
||||||
final int maxLines;
|
final int maxLines;
|
||||||
final bool Function(String) onSubmit;
|
final bool Function(String) onSubmit;
|
||||||
|
|
||||||
@@ -870,6 +882,7 @@ class _CaptionTextInputState extends State<_CaptionTextInput> {
|
|||||||
controller: _controller,
|
controller: _controller,
|
||||||
focusNode: _focus,
|
focusNode: _focus,
|
||||||
label: widget.label,
|
label: widget.label,
|
||||||
|
leading: widget.leading,
|
||||||
minLines: widget.maxLines,
|
minLines: widget.maxLines,
|
||||||
maxLines: widget.maxLines,
|
maxLines: widget.maxLines,
|
||||||
textInputAction: TextInputAction.done,
|
textInputAction: TextInputAction.done,
|
||||||
@@ -901,17 +914,39 @@ class _CaptionColorInput extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final desktop = AppTheme.isDesktop(context);
|
final desktop = AppTheme.isDesktop(context);
|
||||||
final controls = Row(
|
final swatch = Container(
|
||||||
children: [
|
width: desktop ? 14 : 20,
|
||||||
Container(
|
height: desktop ? 14 : 20,
|
||||||
width: 20,
|
|
||||||
height: 20,
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Color(int.parse('FF${value.substring(1)}', radix: 16)),
|
color: Color(int.parse('FF${value.substring(1)}', radix: 16)),
|
||||||
border: Border.all(color: Theme.of(context).colorScheme.outline),
|
border: Border.all(
|
||||||
|
color: desktop
|
||||||
|
? Theme.of(context).colorScheme.outlineVariant
|
||||||
|
: Theme.of(context).colorScheme.outline,
|
||||||
|
),
|
||||||
borderRadius: BorderRadius.circular(AppRadius.extraSmall),
|
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: [
|
||||||
|
swatch,
|
||||||
const SizedBox(width: AppSpacing.small),
|
const SizedBox(width: AppSpacing.small),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: _CaptionTextInput(
|
child: _CaptionTextInput(
|
||||||
@@ -923,11 +958,6 @@ class _CaptionColorInput extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
return desktop
|
return controls;
|
||||||
? AppPropertyGroup(
|
|
||||||
label: label,
|
|
||||||
child: Semantics(label: label, child: controls),
|
|
||||||
)
|
|
||||||
: 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/l10n/l10n.dart';
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
import 'package:cutdex_sdk/runtime.dart';
|
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
import 'package:cutdex_ui/theme.dart';
|
|
||||||
import 'package:cutdex_ui/widgets.dart';
|
import 'package:cutdex_ui/widgets.dart';
|
||||||
|
|
||||||
import '../../workspace/media_color_interpretation.dart';
|
import '../../workspace/media_color_interpretation.dart';
|
||||||
|
import 'color_interpretation_controls.dart';
|
||||||
import '../../shared/widgets/listenable_selector.dart';
|
import '../../shared/widgets/listenable_selector.dart';
|
||||||
import '../../workspace/timeline_session.dart';
|
import '../../workspace/timeline_session.dart';
|
||||||
import '../preview/preview_panel.dart';
|
import '../preview/preview_panel.dart';
|
||||||
@@ -40,20 +40,15 @@ class ColorInterpretationProperties extends ConsumerWidget {
|
|||||||
final detected = colors?.elementAtOrNull(trackIndex);
|
final detected = colors?.elementAtOrNull(trackIndex);
|
||||||
final reported =
|
final reported =
|
||||||
colors != null && trackIndex >= 0 && trackIndex < colors.length;
|
colors != null && trackIndex >= 0 && trackIndex < colors.length;
|
||||||
final status = selected != null
|
final notice = !reported
|
||||||
? context.l10n.manualColorSpace(selected.label(context.l10n))
|
? context.l10n.colorInfoNotLoaded
|
||||||
: detected != null
|
: selected == null && detected == null
|
||||||
? context.l10n.detectedColorSpace(detected.label(context.l10n))
|
|
||||||
: reported
|
|
||||||
? context.l10n.unknownColorSpace
|
? context.l10n.unknownColorSpace
|
||||||
: context.l10n.colorInfoNotLoaded;
|
: null;
|
||||||
final selector = AppSelect<String>(
|
return ColorInterpretationControls(
|
||||||
emptyLabel: context.l10n.noMatchingOptions,
|
|
||||||
key: const Key('media-color-menu'),
|
|
||||||
outlined: false,
|
|
||||||
label: context.l10n.mediaColorInterpretation,
|
|
||||||
value: selected?.name ?? 'auto',
|
value: selected?.name ?? 'auto',
|
||||||
onChanged: !reported
|
notice: notice,
|
||||||
|
onChanged: !reported || !session.acceptsEdits
|
||||||
? null
|
? null
|
||||||
: (value) => session.commands.setMediaColor(
|
: (value) => session.commands.setMediaColor(
|
||||||
assetId,
|
assetId,
|
||||||
@@ -61,66 +56,16 @@ class ColorInterpretationProperties extends ConsumerWidget {
|
|||||||
value == 'auto' ? null : MediaColorSpace.values.byName(value),
|
value == 'auto' ? null : MediaColorSpace.values.byName(value),
|
||||||
),
|
),
|
||||||
options: [
|
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)
|
for (final color in RenderColorSpace.values)
|
||||||
AppSelectOption(color.name, color.label(context.l10n)),
|
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(
|
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 'dart:math' as math;
|
||||||
|
|
||||||
import 'package:cutdex/features/properties/animation_labels.dart';
|
import 'package:cutdex/features/properties/animation_labels.dart';
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
import 'package:cutdex_sdk/preview.dart';
|
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
@@ -180,7 +180,7 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: ListenableSelector<Object>(
|
child: ListenableSelector<Object>(
|
||||||
listenable: preview,
|
listenable: Listenable.merge([preview, preview.positionChanges]),
|
||||||
select: () {
|
select: () {
|
||||||
final mask = preview.maskFor(widget.element);
|
final mask = preview.maskFor(widget.element);
|
||||||
final animation = preview.maskAnimation(widget.element);
|
final animation = preview.maskAnimation(widget.element);
|
||||||
@@ -264,10 +264,11 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
|
|||||||
}) => PropertyNumberInput(
|
}) => PropertyNumberInput(
|
||||||
key: ValueKey((selectedId, label)),
|
key: ValueKey((selectedId, label)),
|
||||||
label: label,
|
label: label,
|
||||||
inlineLabel: inlineLabel,
|
inlineLabel: inlineLabel || AppTheme.isDesktop(context),
|
||||||
labelActions: AppTheme.isDesktop(context) && !inlineLabel
|
prefix: AppTheme.isDesktop(context) && !inlineLabel ? '' : null,
|
||||||
? [key(label)]
|
prefixIcon: AppTheme.isDesktop(context) && wrapRotation
|
||||||
: const [],
|
? AppIcons.angle
|
||||||
|
: null,
|
||||||
unit: unit,
|
unit: unit,
|
||||||
value: value,
|
value: value,
|
||||||
enabled: enabled,
|
enabled: enabled,
|
||||||
@@ -338,12 +339,31 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
|
|||||||
if (mounted) setState(() => _scrubField = null);
|
if (mounted) setState(() => _scrubField = null);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
Widget axes(String label, Widget first, Widget second) =>
|
Widget axes(
|
||||||
LayoutBuilder(
|
String label,
|
||||||
|
Widget first,
|
||||||
|
Widget second, {
|
||||||
|
Widget? additional,
|
||||||
|
}) => LayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
final desktop = AppTheme.isDesktop(context);
|
final desktop = AppTheme.isDesktop(context);
|
||||||
final gap = AppTheme.propertyRowGap(context);
|
final gap = AppTheme.propertyRowGap(context);
|
||||||
final pair = constraints.maxWidth < (desktop ? 180 : 240)
|
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(
|
? Column(
|
||||||
children: [
|
children: [
|
||||||
first,
|
first,
|
||||||
@@ -359,13 +379,7 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
|
|||||||
Expanded(child: second),
|
Expanded(child: second),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
return desktop
|
return Row(
|
||||||
? AppPropertyGroup(
|
|
||||||
label: label,
|
|
||||||
actions: [key(label)],
|
|
||||||
child: pair,
|
|
||||||
)
|
|
||||||
: Row(
|
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: pair),
|
Expanded(child: pair),
|
||||||
SizedBox(width: gap),
|
SizedBox(width: gap),
|
||||||
@@ -376,7 +390,14 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
|
|||||||
);
|
);
|
||||||
Widget singleField(String label, Widget input) =>
|
Widget singleField(String label, Widget input) =>
|
||||||
AppTheme.isDesktop(context)
|
AppTheme.isDesktop(context)
|
||||||
? input
|
? AppPropertyGroup(
|
||||||
|
label: label,
|
||||||
|
padChild: false,
|
||||||
|
child: AppPropertyRow(
|
||||||
|
trailing: key(label),
|
||||||
|
children: [input],
|
||||||
|
),
|
||||||
|
)
|
||||||
: Row(
|
: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: input),
|
Expanded(child: input),
|
||||||
@@ -395,8 +416,7 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
|
|||||||
style: AppTheme.propertySectionTitleStyle(context),
|
style: AppTheme.propertySectionTitleStyle(context),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
Widget section(List<Widget> children) => Padding(
|
Widget section(List<Widget> children) => AppPropertySection(
|
||||||
padding: AppTheme.propertySectionPadding(context),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: children,
|
children: children,
|
||||||
@@ -586,8 +606,11 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
|
|||||||
if (AppTheme.isDesktop(context))
|
if (AppTheme.isDesktop(context))
|
||||||
AppPropertyGroup(
|
AppPropertyGroup(
|
||||||
label: context.l10n.type,
|
label: context.l10n.type,
|
||||||
actions: [shapeReset()],
|
padChild: false,
|
||||||
child: shapeSelector(),
|
child: AppPropertyRow(
|
||||||
|
trailing: shapeReset(),
|
||||||
|
children: [shapeSelector()],
|
||||||
|
),
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
Row(
|
Row(
|
||||||
@@ -620,8 +643,26 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
|
|||||||
unit: '%',
|
unit: '%',
|
||||||
inlineLabel: true,
|
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,
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
|
if (!AppTheme.isDesktop(context))
|
||||||
section([
|
section([
|
||||||
singleField(
|
singleField(
|
||||||
context.l10n.rotation,
|
context.l10n.rotation,
|
||||||
|
|||||||
@@ -1,25 +1,19 @@
|
|||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'dart:async';
|
||||||
import 'package:cutdex_sdk/preview.dart';
|
|
||||||
import 'package:cutdex_sdk/timeline/engine.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||||
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
|
||||||
import '../../workspace/timeline_session.dart';
|
import '../../workspace/timeline_session.dart';
|
||||||
|
import 'property_edit_boundary.dart';
|
||||||
|
|
||||||
part 'picture_edits.g.dart';
|
part 'picture_edits.g.dart';
|
||||||
part 'picture_edits.freezed.dart';
|
part 'picture_edits.freezed.dart';
|
||||||
|
|
||||||
enum PictureEditFailure { keyframes, alignment, invalidTransform, transform }
|
enum PictureEditFailure { keyframes, alignment, invalidTransform, transform }
|
||||||
|
|
||||||
@freezed
|
|
||||||
abstract class PictureEditTarget with _$PictureEditTarget {
|
|
||||||
const factory PictureEditTarget({
|
|
||||||
required TimelineVersion version,
|
|
||||||
required int tick,
|
|
||||||
}) = _PictureEditTarget;
|
|
||||||
}
|
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
abstract class PictureEditException
|
abstract class PictureEditException
|
||||||
with _$PictureEditException
|
with _$PictureEditException
|
||||||
@@ -31,35 +25,16 @@ abstract class PictureEditException
|
|||||||
@riverpod
|
@riverpod
|
||||||
class PictureEdits extends _$PictureEdits {
|
class PictureEdits extends _$PictureEdits {
|
||||||
Future<bool>? _pending;
|
Future<bool>? _pending;
|
||||||
|
late PropertyEditBoundary _boundary;
|
||||||
@override
|
@override
|
||||||
AsyncValue<void> build(
|
AsyncValue<void> build(
|
||||||
EditorTimelineSession session,
|
EditorTimelineSession session,
|
||||||
SequenceId sequence,
|
SequenceId sequence,
|
||||||
ElementId clip,
|
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 ||
|
_boundary = PropertyEditBoundary(session, sequence, clip);
|
||||||
!isCurrent() ||
|
ref.onDispose(_boundary.dispose);
|
||||||
session.activeSequenceId != sequence ||
|
return const AsyncData(null);
|
||||||
preview?.transforms.hasPending == true) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final view = session.view(sequence);
|
|
||||||
return target.tick == view.playheadTick &&
|
|
||||||
identical(target.version, view.version.kernelVersion);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ClipAnimation? animation() {
|
ClipAnimation? animation() {
|
||||||
@@ -86,10 +61,9 @@ class PictureEdits extends _$PictureEdits {
|
|||||||
if (state.isLoading || preview?.transforms.hasPending == true) {
|
if (state.isLoading || preview?.transforms.hasPending == true) {
|
||||||
return Future.value(false);
|
return Future.value(false);
|
||||||
}
|
}
|
||||||
final target = _capture();
|
final work = _run(PictureEditFailure.transform, preview, isCurrent, (
|
||||||
final work = _run(PictureEditFailure.transform, () async {
|
target,
|
||||||
await preview?.pauseForCanvasInteraction();
|
) {
|
||||||
if (!_valid(target, isCurrent, preview)) return false;
|
|
||||||
final current = animation()?.value;
|
final current = animation()?.value;
|
||||||
if (current == null) return false;
|
if (current == null) return false;
|
||||||
final value = change(current);
|
final value = change(current);
|
||||||
@@ -100,7 +74,9 @@ class PictureEdits extends _$PictureEdits {
|
|||||||
value.y == current.y &&
|
value.y == current.y &&
|
||||||
value.scale == current.scale &&
|
value.scale == current.scale &&
|
||||||
value.scaleY == current.scaleY &&
|
value.scaleY == current.scaleY &&
|
||||||
value.rotation == current.rotation) {
|
value.rotation == current.rotation &&
|
||||||
|
value.sameCorners(current) &&
|
||||||
|
value.distortion.same(current.distortion)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
session.commands.setTransform(
|
session.commands.setTransform(
|
||||||
@@ -132,10 +108,7 @@ class PictureEdits extends _$PictureEdits {
|
|||||||
preview?.transforms.hasPending == true) {
|
preview?.transforms.hasPending == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final target = _capture();
|
await _run(PictureEditFailure.keyframes, preview, isCurrent, (target) {
|
||||||
await _run(PictureEditFailure.keyframes, () async {
|
|
||||||
await preview?.pauseForCanvasInteraction();
|
|
||||||
if (!_valid(target, isCurrent, preview)) return false;
|
|
||||||
session.commands.editKeyframeChannel(
|
session.commands.editKeyframeChannel(
|
||||||
sequence: sequence,
|
sequence: sequence,
|
||||||
clip: clip,
|
clip: clip,
|
||||||
@@ -154,7 +127,6 @@ class PictureEdits extends _$PictureEdits {
|
|||||||
required bool Function() isCurrent,
|
required bool Function() isCurrent,
|
||||||
}) async {
|
}) async {
|
||||||
if (state.isLoading || preview.transforms.hasPending) return;
|
if (state.isLoading || preview.transforms.hasPending) return;
|
||||||
final target = _capture();
|
|
||||||
final current = animation();
|
final current = animation();
|
||||||
if (current == null) return;
|
if (current == null) return;
|
||||||
final command = AlignClip(
|
final command = AlignClip(
|
||||||
@@ -166,12 +138,13 @@ class PictureEdits extends _$PictureEdits {
|
|||||||
alignment: alignment,
|
alignment: alignment,
|
||||||
expectedVersion: session.version,
|
expectedVersion: session.version,
|
||||||
);
|
);
|
||||||
await _run(PictureEditFailure.alignment, () async {
|
await _run(PictureEditFailure.alignment, preview, isCurrent, (
|
||||||
await preview.pauseForCanvasInteraction();
|
target,
|
||||||
|
) async {
|
||||||
await session.alignClip(
|
await session.alignClip(
|
||||||
sequence,
|
sequence,
|
||||||
command,
|
command,
|
||||||
isCancelled: () => !_valid(target, isCurrent, preview),
|
isCancelled: () => !target.isCurrent,
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
@@ -179,24 +152,22 @@ class PictureEdits extends _$PictureEdits {
|
|||||||
|
|
||||||
Future<bool> _run(
|
Future<bool> _run(
|
||||||
PictureEditFailure failure,
|
PictureEditFailure failure,
|
||||||
Future<bool> Function() action,
|
PreviewController? preview,
|
||||||
|
bool Function() isCurrent,
|
||||||
|
FutureOr<bool> Function(PropertyEditContext) action,
|
||||||
) async {
|
) async {
|
||||||
final lease = ref.keepAlive();
|
final lease = ref.keepAlive();
|
||||||
state = const AsyncLoading();
|
|
||||||
try {
|
try {
|
||||||
final applied = await session.runEditAsync(
|
final applied = await _boundary.run(
|
||||||
switch (failure) {
|
preview,
|
||||||
|
action,
|
||||||
|
isCurrent: () => ref.mounted && isCurrent(),
|
||||||
|
started: () => state = const AsyncLoading(),
|
||||||
|
operation: switch (failure) {
|
||||||
PictureEditFailure.keyframes => 'editKeyframes',
|
PictureEditFailure.keyframes => 'editKeyframes',
|
||||||
PictureEditFailure.alignment => 'alignClip',
|
PictureEditFailure.alignment => 'alignClip',
|
||||||
_ => 'setTransform',
|
_ => 'setTransform',
|
||||||
},
|
},
|
||||||
sequence,
|
|
||||||
action,
|
|
||||||
context: {
|
|
||||||
'clipIds': [clip.value],
|
|
||||||
'entryPoint': 'property',
|
|
||||||
'playheadTick': session.view(sequence).playheadTick,
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
if (ref.mounted) state = const AsyncData(null);
|
if (ref.mounted) state = const AsyncData(null);
|
||||||
return applied;
|
return applied;
|
||||||
|
|||||||
@@ -12,318 +12,6 @@ part of 'picture_edits.dart';
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
T _$identity<T>(T value) => value;
|
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
|
/// @nodoc
|
||||||
mixin _$PictureEditException {
|
mixin _$PictureEditException {
|
||||||
PictureEditFailure get failure;
|
PictureEditFailure get failure;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ final class PictureEditsProvider
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$pictureEditsHash() => r'6385f3bd53094d57ed054681d142591e059e8b08';
|
String _$pictureEditsHash() => r'b3166b6e97f6a711e6e92b67dfc44341a3fec4e2';
|
||||||
|
|
||||||
final class PictureEditsFamily extends $Family
|
final class PictureEditsFamily extends $Family
|
||||||
with
|
with
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import 'package:cutdex/l10n/l10n.dart';
|
|||||||
import 'dart:math' as math;
|
import 'dart:math' as math;
|
||||||
|
|
||||||
import 'package:cutdex/features/properties/animation_labels.dart';
|
import 'package:cutdex/features/properties/animation_labels.dart';
|
||||||
import 'package:cutdex_sdk/editor.dart';
|
import 'package:cutdex_core/editor.dart';
|
||||||
import 'package:cutdex_sdk/preview.dart';
|
import 'package:cutdex_preview/cutdex_preview.dart';
|
||||||
import 'package:cutdex_sdk/timeline/engine.dart';
|
import 'package:cutdex_core/timeline/engine.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
@@ -22,6 +22,10 @@ import '../../shared/state/operation_scope.dart';
|
|||||||
import '../preview/preview_panel.dart';
|
import '../preview/preview_panel.dart';
|
||||||
import 'property_number_input.dart';
|
import 'property_number_input.dart';
|
||||||
import 'picture_edits.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 {
|
class PictureProperties extends ConsumerStatefulWidget {
|
||||||
const PictureProperties({
|
const PictureProperties({
|
||||||
@@ -57,6 +61,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
|||||||
late final _operations = OperationScope<Object>(_operationContext);
|
late final _operations = OperationScope<Object>(_operationContext);
|
||||||
late final _seeks = OperationScope<Object>(_operationContext);
|
late final _seeks = OperationScope<Object>(_operationContext);
|
||||||
bool _locked = true;
|
bool _locked = true;
|
||||||
|
bool? _independentCorners;
|
||||||
bool _hasFocusedControl = false;
|
bool _hasFocusedControl = false;
|
||||||
PictureEditsProvider get _editProvider =>
|
PictureEditsProvider get _editProvider =>
|
||||||
pictureEditsProvider(widget.session, widget.sequence, widget.clip.id);
|
pictureEditsProvider(widget.session, widget.sequence, widget.clip.id);
|
||||||
@@ -87,6 +92,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
|||||||
oldWidget.clip.id,
|
oldWidget.clip.id,
|
||||||
);
|
);
|
||||||
if (previousIdentity != _editIdentity) {
|
if (previousIdentity != _editIdentity) {
|
||||||
|
_independentCorners = null;
|
||||||
final edit = _clearScrub();
|
final edit = _clearScrub();
|
||||||
if (edit != null) scheduleMicrotask(edit.cancel);
|
if (edit != null) scheduleMicrotask(edit.cancel);
|
||||||
}
|
}
|
||||||
@@ -204,7 +210,9 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
|||||||
value.y == _scrubBase!.y &&
|
value.y == _scrubBase!.y &&
|
||||||
value.rotation == _scrubBase!.rotation &&
|
value.rotation == _scrubBase!.rotation &&
|
||||||
value.scale == _scrubBase!.scale &&
|
value.scale == _scrubBase!.scale &&
|
||||||
value.scaleY == _scrubBase!.scaleY)) {
|
value.scaleY == _scrubBase!.scaleY &&
|
||||||
|
value.sameCorners(_scrubBase!) &&
|
||||||
|
value.distortion.same(_scrubBase!.distortion))) {
|
||||||
_cancelScrub();
|
_cancelScrub();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -267,6 +275,16 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
|||||||
value.scale,
|
value.scale,
|
||||||
value.scaleY,
|
value.scaleY,
|
||||||
value.rotation,
|
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,
|
_scrubValid,
|
||||||
_scrubBase != null,
|
_scrubBase != null,
|
||||||
_saving,
|
_saving,
|
||||||
@@ -359,10 +377,22 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
|||||||
|
|
||||||
final desktop = AppTheme.isDesktop(context);
|
final desktop = AppTheme.isDesktop(context);
|
||||||
final gap = AppTheme.propertyRowGap(context);
|
final gap = AppTheme.propertyRowGap(context);
|
||||||
Widget axes(TransformChannel channel, Widget first, Widget second) =>
|
Widget axes(
|
||||||
LayoutBuilder(
|
TransformChannel channel,
|
||||||
|
Widget first,
|
||||||
|
Widget second, {
|
||||||
|
Widget? trailing,
|
||||||
|
}) => LayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
final pair = constraints.maxWidth < (desktop ? 180 : 240)
|
if (desktop) {
|
||||||
|
return AppPropertyRow(
|
||||||
|
trailing: channel == TransformChannel.position
|
||||||
|
? keyButton(channel)
|
||||||
|
: trailing,
|
||||||
|
children: [first, second],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
final pair = constraints.maxWidth < 240
|
||||||
? Column(
|
? Column(
|
||||||
children: [
|
children: [
|
||||||
first,
|
first,
|
||||||
@@ -378,9 +408,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
|||||||
Expanded(child: second),
|
Expanded(child: second),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
return desktop
|
return Row(
|
||||||
? pair
|
|
||||||
: Row(
|
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: pair),
|
Expanded(child: pair),
|
||||||
SizedBox(width: gap),
|
SizedBox(width: gap),
|
||||||
@@ -488,17 +516,23 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
|||||||
bool inlineLabel = false,
|
bool inlineLabel = false,
|
||||||
String? prefix,
|
String? prefix,
|
||||||
IconData? prefixIcon,
|
IconData? prefixIcon,
|
||||||
|
int prefixQuarterTurns = 0,
|
||||||
|
String? valueText,
|
||||||
}) => PropertyNumberInput(
|
}) => PropertyNumberInput(
|
||||||
key: ValueKey(id),
|
key: ValueKey(id),
|
||||||
label: label,
|
label: label,
|
||||||
inlineLabel: inlineLabel,
|
inlineLabel: inlineLabel,
|
||||||
prefix: prefix,
|
prefix: prefix,
|
||||||
prefixIcon: prefixIcon,
|
prefixIcon: prefixIcon,
|
||||||
|
prefixQuarterTurns: prefixQuarterTurns,
|
||||||
|
valueText: valueText,
|
||||||
unit: unit,
|
unit: unit,
|
||||||
value: value,
|
value: value,
|
||||||
enabled: !_saving,
|
enabled: !_saving,
|
||||||
readOnly: _scrubBase != null || preview?.transforms.hasPending == true,
|
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(
|
onScrubStart: () => _startScrub(
|
||||||
preview,
|
preview,
|
||||||
id,
|
id,
|
||||||
@@ -520,8 +554,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
|||||||
widget.session.view(widget.sequence).playheadTick,
|
widget.session.view(widget.sequence).playheadTick,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
Widget section(List<Widget> children) => Padding(
|
Widget section(List<Widget> children) => AppPropertySection(
|
||||||
padding: AppTheme.propertySectionPadding(context),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: children,
|
children: children,
|
||||||
@@ -555,7 +588,10 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
|||||||
prefixIcon: desktop ? AppIcons.angle : null,
|
prefixIcon: desktop ? AppIcons.angle : null,
|
||||||
);
|
);
|
||||||
final rotation = desktop
|
final rotation = desktop
|
||||||
? rotationInput
|
? AppPropertyRow(
|
||||||
|
trailing: keyButton(TransformChannel.rotation),
|
||||||
|
children: [rotationInput, const SizedBox.shrink()],
|
||||||
|
)
|
||||||
: Row(
|
: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: rotationInput),
|
Expanded(child: rotationInput),
|
||||||
@@ -563,7 +599,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
|||||||
keyButton(TransformChannel.rotation),
|
keyButton(TransformChannel.rotation),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
final scale = axes(
|
Widget scaleControls({Widget? trailing}) => axes(
|
||||||
TransformChannel.scale,
|
TransformChannel.scale,
|
||||||
number(
|
number(
|
||||||
'picture-scale-x',
|
'picture-scale-x',
|
||||||
@@ -595,6 +631,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
|||||||
: 10000,
|
: 10000,
|
||||||
inlineLabel: true,
|
inlineLabel: true,
|
||||||
),
|
),
|
||||||
|
trailing: trailing,
|
||||||
);
|
);
|
||||||
final lock = IconButton(
|
final lock = IconButton(
|
||||||
key: const Key('picture-lock'),
|
key: const Key('picture-lock'),
|
||||||
@@ -610,11 +647,10 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
|||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
);
|
);
|
||||||
|
final scale = scaleControls();
|
||||||
final alignmentControls = LayoutBuilder(
|
final alignmentControls = LayoutBuilder(
|
||||||
builder: (context, constraints) => Wrap(
|
builder: (context, constraints) {
|
||||||
spacing: AppSpacing.small,
|
final groups = <Widget>[
|
||||||
runSpacing: AppSpacing.small,
|
|
||||||
children: [
|
|
||||||
for (final group in [
|
for (final group in [
|
||||||
[
|
[
|
||||||
(
|
(
|
||||||
@@ -648,7 +684,9 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
|||||||
],
|
],
|
||||||
])
|
])
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: constraints.maxWidth < 200
|
width: desktop
|
||||||
|
? null
|
||||||
|
: constraints.maxWidth < 200
|
||||||
? constraints.maxWidth
|
? constraints.maxWidth
|
||||||
: (constraints.maxWidth - AppSpacing.small) / 2,
|
: (constraints.maxWidth - AppSpacing.small) / 2,
|
||||||
child: AppButtonGroup(
|
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(
|
final content = Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
@@ -690,46 +808,43 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
|||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
if (!widget.animationView)
|
if (!widget.animationView && !desktop)
|
||||||
section([
|
section([
|
||||||
if (desktop)
|
|
||||||
AppPropertyGroup(
|
|
||||||
label: context.l10n.alignment,
|
|
||||||
child: alignmentControls,
|
|
||||||
)
|
|
||||||
else ...[
|
|
||||||
Text(
|
Text(
|
||||||
context.l10n.alignment,
|
context.l10n.alignment,
|
||||||
style: AppTheme.propertySectionTitleStyle(context),
|
style: AppTheme.propertySectionTitleStyle(context),
|
||||||
),
|
),
|
||||||
SizedBox(height: gap),
|
SizedBox(height: gap),
|
||||||
alignmentControls,
|
alignmentControls,
|
||||||
],
|
|
||||||
]),
|
]),
|
||||||
if (desktop) ...[
|
if (desktop) ...[
|
||||||
section([
|
section([
|
||||||
AppPropertyGroup(
|
AppPropertyGroup(
|
||||||
label: context.l10n.position,
|
label: context.l10n.position,
|
||||||
actions: [keyButton(TransformChannel.position)],
|
padChild: false,
|
||||||
child: position,
|
child: Column(
|
||||||
),
|
children: [
|
||||||
|
if (!widget.animationView) alignmentControls,
|
||||||
|
position,
|
||||||
keyTools(TransformChannel.position),
|
keyTools(TransformChannel.position),
|
||||||
|
rotation,
|
||||||
|
keyTools(TransformChannel.rotation),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
]),
|
]),
|
||||||
section([
|
section([
|
||||||
AppPropertyGroup(
|
AppPropertyGroup(
|
||||||
label: context.l10n.scale,
|
label: context.l10n.scale,
|
||||||
actions: [lock, keyButton(TransformChannel.scale)],
|
actions: [keyButton(TransformChannel.scale)],
|
||||||
child: 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 ...[
|
] else ...[
|
||||||
section([
|
section([
|
||||||
@@ -759,6 +874,82 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
|||||||
keyTools(TransformChannel.scale),
|
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)
|
if (_error != null)
|
||||||
section([
|
section([
|
||||||
Text(
|
Text(
|
||||||
@@ -824,7 +1015,34 @@ class _KeyframeTimeline extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: AppSpacing.small),
|
const SizedBox(height: AppSpacing.small),
|
||||||
|
for (final (id, label, times) in [
|
||||||
for (final channel in TransformChannel.values)
|
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(
|
SizedBox(
|
||||||
height: 32,
|
height: 32,
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -832,7 +1050,7 @@ class _KeyframeTimeline extends StatelessWidget {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: 36,
|
width: 36,
|
||||||
child: Text(
|
child: Text(
|
||||||
channel.label(context),
|
label,
|
||||||
style: Theme.of(context).textTheme.bodySmall,
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -851,7 +1069,7 @@ class _KeyframeTimeline extends StatelessWidget {
|
|||||||
) *
|
) *
|
||||||
extent;
|
extent;
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
key: ValueKey('picture-key-track-${channel.name}'),
|
key: ValueKey('picture-key-track-$id'),
|
||||||
behavior: HitTestBehavior.opaque,
|
behavior: HitTestBehavior.opaque,
|
||||||
onTapDown: !enabled
|
onTapDown: !enabled
|
||||||
? null
|
? null
|
||||||
@@ -883,18 +1101,16 @@ class _KeyframeTimeline extends StatelessWidget {
|
|||||||
width: 1,
|
width: 1,
|
||||||
child: ColoredBox(color: colors.primary),
|
child: ColoredBox(color: colors.primary),
|
||||||
),
|
),
|
||||||
for (final tick in animation.keyTimes(channel))
|
for (final tick in times)
|
||||||
Positioned(
|
Positioned(
|
||||||
left: x(tick) - AppControlSize.compact / 2,
|
left: x(tick) - AppControlSize.compact / 2,
|
||||||
top: 4,
|
top: 4,
|
||||||
width: AppControlSize.compact,
|
width: AppControlSize.compact,
|
||||||
height: AppControlSize.compact,
|
height: AppControlSize.compact,
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
key: ValueKey(
|
key: ValueKey('picture-key-marker-$id-$tick'),
|
||||||
'picture-key-marker-${channel.name}-$tick',
|
|
||||||
),
|
|
||||||
tooltip:
|
tooltip:
|
||||||
'${channel.label(context)} ${((tick - animation.start) / TimelineClock.ticksPerSecond).toStringAsFixed(2)} s',
|
'$label ${((tick - animation.start) / TimelineClock.ticksPerSecond).toStringAsFixed(2)} s',
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
onPressed: enabled
|
onPressed: enabled
|
||||||
? () => onSeek(tick)
|
? () => onSeek(tick)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'package:cutdex/l10n/l10n.dart';
|
import 'package:cutdex/l10n/l10n.dart';
|
||||||
import 'package:cutdex_sdk/runtime/contracts.dart';
|
import 'package:cutdex_native_flutter/contracts.dart';
|
||||||
import 'package:cutdex_sdk/timeline/model.dart';
|
import 'package:cutdex_core/timeline/model.dart';
|
||||||
import 'package:cutdex_sdk/timeline/engine.dart';
|
import 'package:cutdex_core/timeline/engine.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:cutdex_ui/theme.dart';
|
import 'package:cutdex_ui/theme.dart';
|
||||||
@@ -39,7 +39,9 @@ class ProjectProperties extends StatelessWidget {
|
|||||||
height: AppTheme.isDesktop(context) ? AppInspectorMetrics.input : null,
|
height: AppTheme.isDesktop(context) ? AppInspectorMetrics.input : null,
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
key: const ValueKey('project-settings-edit'),
|
key: const ValueKey('project-settings-edit'),
|
||||||
style: AppTheme.isDesktop(context)
|
style:
|
||||||
|
AppTheme.isDesktop(context) &&
|
||||||
|
!AppTheme.isCompactInspector(context)
|
||||||
? AppTheme.toolbarButtonStyle(context)
|
? AppTheme.toolbarButtonStyle(context)
|
||||||
: null,
|
: null,
|
||||||
onPressed: () => showAppDialog<void>(
|
onPressed: () => showAppDialog<void>(
|
||||||
@@ -50,14 +52,17 @@ class ProjectProperties extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
headerHeight: AppTheme.isDesktop(context)
|
headerHeight: AppTheme.isDesktop(context)
|
||||||
? AppDesktopMetrics.panelHeader
|
? AppInspectorMetrics.sectionHeader
|
||||||
: AppControlSize.panelToolbar,
|
: AppControlSize.panelToolbar,
|
||||||
headerPadding: EdgeInsets.symmetric(
|
headerPadding: AppTheme.isDesktop(context)
|
||||||
horizontal: AppTheme.isDesktop(context)
|
? const EdgeInsets.only(
|
||||||
? AppInspectorMetrics.padding
|
left: AppInspectorMetrics.padding,
|
||||||
: AppSpacing.panelContentHorizontal,
|
right: AppInspectorMetrics.trailingPadding,
|
||||||
|
)
|
||||||
|
: const EdgeInsets.symmetric(
|
||||||
|
horizontal: AppSpacing.panelContentHorizontal,
|
||||||
),
|
),
|
||||||
showHeaderDivider: false,
|
showHeaderDivider: AppTheme.isCompactInspector(context),
|
||||||
child: ScrollEdgeFadeBuilder(
|
child: ScrollEdgeFadeBuilder(
|
||||||
builder: (controller) => SingleChildScrollView(
|
builder: (controller) => SingleChildScrollView(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
@@ -75,8 +80,8 @@ class ProjectProperties extends StatelessWidget {
|
|||||||
() => session.canvas.label(context),
|
() => session.canvas.label(context),
|
||||||
),
|
),
|
||||||
info(
|
info(
|
||||||
context.l10n.projectColorSpace,
|
context.l10n.projectOutputColorSpace,
|
||||||
() => switch (session.projectColorSpace) {
|
() => switch (session.projectOutputColorSpace) {
|
||||||
RenderColorSpace.rec2020HLG => 'HDR · Rec.2020 HLG',
|
RenderColorSpace.rec2020HLG => 'HDR · Rec.2020 HLG',
|
||||||
RenderColorSpace.rec2020PQ => 'HDR · Rec.2020 PQ',
|
RenderColorSpace.rec2020PQ => 'HDR · Rec.2020 PQ',
|
||||||
_ => 'SDR · Rec.709',
|
_ => 'SDR · Rec.709',
|
||||||
@@ -133,8 +138,7 @@ class _Info extends StatelessWidget {
|
|||||||
style: Theme.of(context).textTheme.bodyMedium,
|
style: Theme.of(context).textTheme.bodyMedium,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return Padding(
|
return AppPropertySection(
|
||||||
padding: AppTheme.propertySectionPadding(context),
|
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
spacing: AppSpacing.small,
|
spacing: AppSpacing.small,
|
||||||
|
|||||||
@@ -14,9 +14,11 @@ class ProjectPropertyRow extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => Padding(
|
Widget build(BuildContext context) => Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.fromLTRB(
|
||||||
horizontal: AppInspectorMetrics.padding,
|
AppInspectorMetrics.padding,
|
||||||
vertical: AppInspectorMetrics.rowGap,
|
AppInspectorMetrics.rowPadding,
|
||||||
|
AppInspectorMetrics.trailingPadding,
|
||||||
|
AppInspectorMetrics.rowPadding,
|
||||||
),
|
),
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: const BoxConstraints(minHeight: AppInspectorMetrics.input),
|
constraints: const BoxConstraints(minHeight: AppInspectorMetrics.input),
|
||||||
@@ -35,13 +37,11 @@ class ProjectPropertyRow extends StatelessWidget {
|
|||||||
label,
|
label,
|
||||||
maxLines: 3,
|
maxLines: 3,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: AppTheme.toolbarTextStyle(context).copyWith(
|
style: AppTheme.propertyLabelStyle(context),
|
||||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(width: AppInspectorMetrics.rowGap),
|
||||||
const SizedBox(width: AppInspectorMetrics.rowGap * 2),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 3,
|
flex: 3,
|
||||||
child: Tooltip(
|
child: Tooltip(
|
||||||
@@ -51,7 +51,7 @@ class ProjectPropertyRow extends StatelessWidget {
|
|||||||
maxLines: 3,
|
maxLines: 3,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
textAlign: TextAlign.right,
|
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