Compare commits
1
Commits
No files matched your search
+5
-11
@@ -3,24 +3,18 @@
|
|||||||
# 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.
|
||||||
|
|
||||||
# Default: consume exact platform releases from cutdex_native_flutter/native-dependencies.json.
|
# Windows native source development (requires Rust and FFMPEG_DIR).
|
||||||
# Explicit pinned releases: CUTDEX_NATIVE_BUILD_MODE=artifacts (clear source overrides).
|
# CUTDEX_WINDOWS_PATH=D:/workspace/cutdex_windows
|
||||||
# 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
|
||||||
|
|
||||||
# Artifacts mode only: use an extracted Windows native package.
|
# Alternatively, use an extracted Windows native package. Choose only one path.
|
||||||
# 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/CutdexApple
|
# CUTDEX_APPLE_PATH=/Users/your-name/workspace/cutdex_apple
|
||||||
|
|
||||||
# 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,28 +1,9 @@
|
|||||||
# 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. `dependencies.json` fixes the Core release version,
|
JDK 21 and Android SDK 36. The native cutdex_windows Release and cutdex_android
|
||||||
source commit and source ZIP SHA256, together with its bundled native Flutter
|
Maven packages must be published before building this app. The SDK Git dependency
|
||||||
version and commit. `.gitea/actions/prepare-flutter` downloads that published Core
|
is pinned to Gitea; the runner account needs SSH access to that private repository.
|
||||||
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.
|
||||||
@@ -30,7 +11,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 distributed separately; these workflows do not bundle them.
|
and optional models are separate; these four repositories contain no worker bundle.
|
||||||
|
|
||||||
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
|
||||||
@@ -77,11 +58,7 @@ Android and Windows independently download their platform artifacts from the
|
|||||||
selected CI run and immediately upload them to the draft. These jobs run in
|
selected CI run and immediately upload them to the draft. These jobs run in
|
||||||
parallel. The final job accepts only the compact metadata artifact from that same
|
parallel. The final job accepts only the compact metadata artifact from that same
|
||||||
CI run. Complete binary archives cannot substitute for platform packages or
|
CI run. Complete binary archives cannot substitute for platform packages or
|
||||||
metadata. Gitea can retain old artifact API rows after a job rerun despite overwrite.
|
metadata. Missing, expired or duplicate required artifacts block preparation
|
||||||
Selection requires the exact CI run and source commit, and exactly one artifact
|
|
||||||
created within its current successful producer job's execution interval. Jobs
|
|
||||||
preserved during a partial rerun retain their original intervals and artifacts.
|
|
||||||
Missing, expired or ambiguous artifacts in that interval block preparation
|
|
||||||
before any draft is created. Platform uploads check attachment presence without
|
before any draft is created. Platform uploads check attachment presence without
|
||||||
reading back their bytes. Before publication, every attachment is read back once
|
reading back their bytes. Before publication, every attachment is read back once
|
||||||
and verified against trusted SHA256 checksums; the full update package also
|
and verified against trusted SHA256 checksums; the full update package also
|
||||||
@@ -98,11 +75,6 @@ operator attention. Published Releases are never overwritten. The built-in
|
|||||||
GITEA_TOKEN handles release writes and Actions artifact reads; no separate
|
GITEA_TOKEN handles release writes and Actions artifact reads; no separate
|
||||||
release-write PAT is required. Do not commit credentials or keystores.
|
release-write PAT is required. Do not commit credentials or keystores.
|
||||||
|
|
||||||
Release tools are checked out at the workflow's exact commit; tagged application
|
|
||||||
source is checked out separately in `.release-source`. A manual dispatch on main
|
|
||||||
can therefore apply a reviewed release-tool fix to an existing tag without moving
|
|
||||||
that tag or substituting another application's version or CI artifacts.
|
|
||||||
|
|
||||||
Full-pipeline CI produces Actions artifacts without creating Releases. If a tag is pushed
|
Full-pipeline CI produces Actions artifacts without creating Releases. If a tag is pushed
|
||||||
before main CI succeeds, release preparation fails without creating a draft; retry
|
before main CI succeeds, release preparation fails without creating a draft; retry
|
||||||
the Release workflow once CI has finished. This design overlaps platform uploads,
|
the Release workflow once CI has finished. This design overlaps platform uploads,
|
||||||
|
|||||||
@@ -109,12 +109,6 @@ 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,9 +7,6 @@ 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
|
||||||
|
|||||||
+1
-16
@@ -14,9 +14,7 @@ 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'
|
||||||
@@ -80,13 +78,10 @@ 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.' }
|
||||||
@@ -114,23 +109,13 @@ 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: |
|
||||||
$env:CUTDEX_NATIVE_BUILD_MODE = '${{ vars.CUTDEX_NATIVE_BUILD_MODE || 'artifacts' }}'
|
Remove-Item Env:CUTDEX_WINDOWS_PATH, Env:CUTDEX_WINDOWS_PACKAGE_PATH -ErrorAction SilentlyContinue
|
||||||
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
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ env:
|
|||||||
GIT_CONFIG_VALUE_0: 'false'
|
GIT_CONFIG_VALUE_0: 'false'
|
||||||
GIT_CONFIG_KEY_1: core.eol
|
GIT_CONFIG_KEY_1: core.eol
|
||||||
GIT_CONFIG_VALUE_1: lf
|
GIT_CONFIG_VALUE_1: lf
|
||||||
RELEASE_PUBSPEC: .release-source/pubspec.yaml
|
|
||||||
RELEASE_TAG: ${{ gitea.event.inputs.tag || gitea.ref_name }}
|
RELEASE_TAG: ${{ gitea.event.inputs.tag || gitea.ref_name }}
|
||||||
GITEA_REPOSITORY: ${{ gitea.repository }}
|
GITEA_REPOSITORY: ${{ gitea.repository }}
|
||||||
jobs:
|
jobs:
|
||||||
@@ -41,23 +40,16 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out pinned release tools
|
- name: Check out release tag
|
||||||
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
|
||||||
with:
|
|
||||||
ref: ${{ gitea.sha }}
|
|
||||||
persist-credentials: false
|
|
||||||
github-server-url: ${{ env.CUTDEX_GITEA_INTERNAL_URL }}
|
|
||||||
- name: Check out release source separately
|
|
||||||
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||||
with:
|
with:
|
||||||
ref: ${{ gitea.event.inputs.tag || gitea.ref_name }}
|
ref: ${{ gitea.event.inputs.tag || gitea.ref_name }}
|
||||||
path: .release-source
|
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
github-server-url: ${{ env.CUTDEX_GITEA_INTERNAL_URL }}
|
github-server-url: ${{ env.CUTDEX_GITEA_INTERNAL_URL }}
|
||||||
- name: Select successful CI and prepare draft
|
- name: Select successful CI and prepare draft
|
||||||
id: draft
|
id: draft
|
||||||
run: |
|
run: |
|
||||||
$env:GITEA_SHA = git -C .release-source rev-parse HEAD
|
$env:GITEA_SHA = git rev-parse HEAD
|
||||||
if ($LASTEXITCODE -ne 0) { throw 'Release source resolution failed.' }
|
if ($LASTEXITCODE -ne 0) { throw 'Release source resolution failed.' }
|
||||||
python tool/gitea/stage-release.py prepare-ci
|
python tool/gitea/stage-release.py prepare-ci
|
||||||
if ($LASTEXITCODE -ne 0) { throw 'CI selection or draft preparation failed.' }
|
if ($LASTEXITCODE -ne 0) { throw 'CI selection or draft preparation failed.' }
|
||||||
@@ -73,17 +65,10 @@ jobs:
|
|||||||
CI_RUN_ID: ${{ needs.prepare.outputs.ci-run-id }}
|
CI_RUN_ID: ${{ needs.prepare.outputs.ci-run-id }}
|
||||||
CI_ARTIFACT_ID: ${{ needs.prepare.outputs.android-artifact-id }}
|
CI_ARTIFACT_ID: ${{ needs.prepare.outputs.android-artifact-id }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out pinned release tools
|
- name: Check out release commit
|
||||||
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||||
with:
|
with:
|
||||||
ref: ${{ gitea.sha }}
|
ref: ${{ needs.prepare.outputs.sha }}
|
||||||
persist-credentials: false
|
|
||||||
github-server-url: ${{ env.CUTDEX_GITEA_INTERNAL_URL }}
|
|
||||||
- name: Check out release source separately
|
|
||||||
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
|
||||||
with:
|
|
||||||
ref: ${{ gitea.event.inputs.tag || gitea.ref_name }}
|
|
||||||
path: .release-source
|
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
github-server-url: ${{ env.CUTDEX_GITEA_INTERNAL_URL }}
|
github-server-url: ${{ env.CUTDEX_GITEA_INTERNAL_URL }}
|
||||||
- name: Download Android CI artifact
|
- name: Download Android CI artifact
|
||||||
@@ -106,17 +91,10 @@ jobs:
|
|||||||
CI_RUN_ID: ${{ needs.prepare.outputs.ci-run-id }}
|
CI_RUN_ID: ${{ needs.prepare.outputs.ci-run-id }}
|
||||||
CI_ARTIFACT_ID: ${{ needs.prepare.outputs.windows-artifact-id }}
|
CI_ARTIFACT_ID: ${{ needs.prepare.outputs.windows-artifact-id }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out pinned release tools
|
- name: Check out release commit
|
||||||
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||||
with:
|
with:
|
||||||
ref: ${{ gitea.sha }}
|
ref: ${{ needs.prepare.outputs.sha }}
|
||||||
persist-credentials: false
|
|
||||||
github-server-url: ${{ env.CUTDEX_GITEA_INTERNAL_URL }}
|
|
||||||
- name: Check out release source separately
|
|
||||||
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
|
||||||
with:
|
|
||||||
ref: ${{ gitea.event.inputs.tag || gitea.ref_name }}
|
|
||||||
path: .release-source
|
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
github-server-url: ${{ env.CUTDEX_GITEA_INTERNAL_URL }}
|
github-server-url: ${{ env.CUTDEX_GITEA_INTERNAL_URL }}
|
||||||
- name: Download Windows CI artifact
|
- name: Download Windows CI artifact
|
||||||
@@ -139,17 +117,10 @@ jobs:
|
|||||||
CI_RUN_ID: ${{ needs.prepare.outputs.ci-run-id }}
|
CI_RUN_ID: ${{ needs.prepare.outputs.ci-run-id }}
|
||||||
CI_ARTIFACT_ID: ${{ needs.prepare.outputs.artifact-id }}
|
CI_ARTIFACT_ID: ${{ needs.prepare.outputs.artifact-id }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out pinned release tools
|
- name: Check out release commit
|
||||||
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||||
with:
|
with:
|
||||||
ref: ${{ gitea.sha }}
|
ref: ${{ needs.prepare.outputs.sha }}
|
||||||
persist-credentials: false
|
|
||||||
github-server-url: ${{ env.CUTDEX_GITEA_INTERNAL_URL }}
|
|
||||||
- name: Check out release source separately
|
|
||||||
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
|
||||||
with:
|
|
||||||
ref: ${{ gitea.event.inputs.tag || gitea.ref_name }}
|
|
||||||
path: .release-source
|
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
github-server-url: ${{ env.CUTDEX_GITEA_INTERNAL_URL }}
|
github-server-url: ${{ env.CUTDEX_GITEA_INTERNAL_URL }}
|
||||||
- name: Download release verification metadata
|
- name: Download release verification metadata
|
||||||
|
|||||||
@@ -105,7 +105,3 @@ pubspec_overrides.yaml
|
|||||||
|
|
||||||
# FVM Version Cache
|
# FVM Version Cache
|
||||||
.fvm/
|
.fvm/
|
||||||
|
|
||||||
# Core and native source checkouts prepared by CI or local development.
|
|
||||||
.dependencies/
|
|
||||||
.release-source/
|
|
||||||
@@ -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 暂未提供安装包。
|
本仓库目前尚未发布可下载的安装包。
|
||||||
|
|
||||||
## 可以做什么
|
## 可以做什么
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ analyzer:
|
|||||||
- windows/**
|
- windows/**
|
||||||
- macos/**
|
- macos/**
|
||||||
- linux/**
|
- linux/**
|
||||||
|
- packages/*/example/**
|
||||||
|
|
||||||
plugins:
|
plugins:
|
||||||
riverpod_lint: ^3.1.9
|
riverpod_lint: ^3.1.9
|
||||||
|
|||||||
@@ -25,5 +25,14 @@ plugins {
|
|||||||
|
|
||||||
include(":app")
|
include(":app")
|
||||||
|
|
||||||
// Register native source dependencies before Gradle creates the projects.
|
// Native source development is opt-in; default resolution uses Gitea Maven packages.
|
||||||
apply(from = project(":cutdex_native_flutter").projectDir.resolve("native-settings.gradle"))
|
val nativeAndroidPath = providers.gradleProperty("cutdex.android.path")
|
||||||
|
.orElse(providers.environmentVariable("CUTDEX_ANDROID_PATH"))
|
||||||
|
.orNull
|
||||||
|
nativeAndroidPath?.takeIf { it.isNotBlank() }?.let { nativePath ->
|
||||||
|
includeBuild(nativePath) {
|
||||||
|
dependencySubstitution {
|
||||||
|
substitute(module("dev.cutdex:cutdex-android")).using(project(":cutdex-android"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+14
-23
@@ -12,30 +12,21 @@
|
|||||||
|
|
||||||
本地联调其他包时,可参考 `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 独立解压。
|
|
||||||
|
|
||||||
Core 远端为 `lingjhf/cutdex_core`,Flutter 集成远端为 `cutdex-native/cutdex_native_flutter`。
|
本地路径与原生包认证统一放在应用根目录的 `.env.local`。复制
|
||||||
本地源码联调使用 `pubspec_overrides.yaml.example` 指向同级 checkout,覆盖文件不提交。
|
[配置示例](../.env.example),按需取消注释并填写本机路径;文件已忽略,不提交、
|
||||||
发布 ZIP 包含 `RELEASE.json`,应用同时校验 Core 和 Flutter 集成的版本、提交及平台依赖元数据。
|
不作为应用资源打包。没有配置时,SDK 使用固定版本的已发布原生包。
|
||||||
|
|
||||||
原生实现位于独立的 `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` 和 `CUTDEX_GITEA_TOKEN`。这里的 `GITEA_ACTOR` 是令牌所属的认证
|
||||||
|
账号,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` 自动同步,
|
||||||
@@ -86,7 +77,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。`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/`。
|
应用根目录是 Pub workspace。[cutdex_ui](../packages/cutdex_ui/README.md) 维护通用组件与基础主题,[cutdex_native](../packages/cutdex_native/README.md) 维护设备信息与桌面交互。应用集成入口在 `lib/integrations/`,共享布局与业务样式在 `lib/shared/`。
|
||||||
|
|
||||||
修改剪辑操作时,检查预览、保存、撤销和重做;修改素材导入时,检查文件访问及项目重新打开后的可用性;修改后台任务时,检查完成、失败和取消后的界面状态。
|
修改剪辑操作时,检查预览、保存、撤销和重做;修改素材导入时,检查文件访问及项目重新打开后的可用性;修改后台任务时,检查完成、失败和取消后的界面状态。
|
||||||
|
|
||||||
@@ -112,7 +103,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`。
|
||||||
|
|
||||||
环境文件合并时进程变量优先,包括空值。原生构建仍遵循 `cutdex_native_flutter` 的覆盖规则:
|
环境文件合并时进程变量优先,包括空值。原生构建仍遵循所属 SDK 的覆盖规则:
|
||||||
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,17 +49,3 @@ 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,7 +56,8 @@ 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 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
|
The pinned SDK uses the published Android 0.1.3 Maven artifacts. Use explicit SDK
|
||||||
|
and Android source overrides only when comparing unpublished changes. Calibration
|
||||||
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_core/editor.dart';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
import 'package:cutdex_sdk/preview.dart';
|
||||||
import 'package:cutdex_core/project.dart';
|
import 'package:cutdex_sdk/project.dart';
|
||||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
import 'package:cutdex_sdk/runtime.dart';
|
||||||
import 'package:cutdex_core/timeline/layout.dart';
|
import 'package:cutdex_sdk/timeline/layout.dart';
|
||||||
import 'package:cutdex_core/timeline/model.dart';
|
import 'package:cutdex_sdk/timeline/model.dart';
|
||||||
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
import 'package:cutdex_sdk/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_core/project.dart';
|
import 'package:cutdex_sdk/project.dart';
|
||||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
import 'package:cutdex_sdk/runtime.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_core/editor.dart';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
import 'package:cutdex_sdk/preview.dart';
|
||||||
import 'package:cutdex_core/project.dart';
|
import 'package:cutdex_sdk/project.dart';
|
||||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
import 'package:cutdex_sdk/runtime.dart';
|
||||||
import 'package:cutdex_core/timeline/layout.dart';
|
import 'package:cutdex_sdk/timeline/layout.dart';
|
||||||
import 'package:cutdex_core/timeline/model.dart';
|
import 'package:cutdex_sdk/timeline/model.dart';
|
||||||
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
import 'package:cutdex_sdk/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,14 +16,12 @@ 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_core/editor.dart';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
import 'package:cutdex_core/execution.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: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';
|
||||||
@@ -217,12 +215,7 @@ void main() {
|
|||||||
try {
|
try {
|
||||||
info = await runtime.probe(media);
|
info = await runtime.probe(media);
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
// This diagnostic test deliberately inspects the native wire response.
|
final raw = await runtime.invoke('probe', {'media': media.toMap()});
|
||||||
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,11 +8,10 @@ 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_preview/cutdex_preview.dart';
|
import 'package:cutdex_sdk/preview.dart';
|
||||||
import 'package:cutdex_core/editor.dart';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
import 'package:cutdex_core/execution.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_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_core/editor.dart';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
import 'package:cutdex_core/timeline/model.dart';
|
import 'package:cutdex_sdk/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_core/editor.dart';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
import 'package:cutdex_sdk/runtime.dart';
|
||||||
import 'package:cutdex_core/timeline/layout.dart';
|
import 'package:cutdex_sdk/timeline/layout.dart';
|
||||||
import 'package:cutdex_core/timeline/model.dart';
|
import 'package:cutdex_sdk/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_core/editor.dart';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
import 'package:cutdex_sdk/preview.dart';
|
||||||
import 'package:cutdex_core/project.dart';
|
import 'package:cutdex_sdk/project.dart';
|
||||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
import 'package:cutdex_sdk/runtime.dart';
|
||||||
import 'package:cutdex_core/timeline/model.dart';
|
import 'package:cutdex_sdk/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,12 +6,11 @@ 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_core/project.dart';
|
import 'package:cutdex_sdk/project.dart';
|
||||||
import 'package:cutdex_core/editor.dart';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
import 'package:cutdex_sdk/preview.dart';
|
||||||
import 'package:cutdex_core/execution.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_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,13 +4,12 @@ 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_core/editor.dart';
|
import 'package:cutdex_sdk/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_preview/cutdex_preview.dart';
|
import 'package:cutdex_sdk/preview.dart';
|
||||||
import 'package:cutdex_core/execution.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/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_preview/cutdex_preview.dart';
|
import 'package:cutdex_sdk/preview.dart';
|
||||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
import 'package:cutdex_sdk/runtime.dart';
|
||||||
import 'package:cutdex_core/timeline/model.dart';
|
import 'package:cutdex_sdk/timeline/model.dart';
|
||||||
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
import 'package:cutdex_sdk/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_preview/cutdex_preview.dart';
|
import 'package:cutdex_sdk/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_native_flutter/cutdex_native_flutter.dart';
|
import 'package:cutdex_sdk/runtime.dart';
|
||||||
import 'package:cutdex_core/timeline/model.dart';
|
import 'package:cutdex_sdk/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_core/project.dart';
|
import 'package:cutdex_sdk/project.dart';
|
||||||
import 'package:cutdex_core/timeline/model.dart';
|
import 'package:cutdex_sdk/timeline/model.dart';
|
||||||
import 'package:cutdex_core/editor.dart';
|
import 'package:cutdex_sdk/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_preview/cutdex_preview.dart';
|
import 'package:cutdex_sdk/preview.dart';
|
||||||
import 'package:cutdex/integrations/runtime/timeline_thumbnails.dart';
|
import 'package:cutdex/integrations/runtime/timeline_thumbnails.dart';
|
||||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
import 'package:cutdex_sdk/runtime.dart';
|
||||||
import 'package:cutdex_core/timeline/model.dart';
|
import 'package:cutdex_sdk/timeline/model.dart';
|
||||||
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
import 'package:cutdex_sdk/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_core/editor.dart';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
import 'package:cutdex_sdk/preview.dart';
|
||||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
import 'package:cutdex_sdk/runtime.dart';
|
||||||
import 'package:cutdex_core/timeline/model.dart';
|
import 'package:cutdex_sdk/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_native_flutter/cutdex_native_flutter.dart';
|
import 'package:cutdex_sdk/runtime.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_native_flutter/cutdex_native_flutter.dart';
|
import 'package:cutdex_sdk/runtime.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_core/editor.dart';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
import 'package:cutdex_core/project.dart';
|
import 'package:cutdex_sdk/project.dart';
|
||||||
import 'package:cutdex_core/timeline/model.dart';
|
import 'package:cutdex_sdk/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_native_flutter/cutdex_native_flutter.dart';
|
import 'package:cutdex_sdk/runtime.dart';
|
||||||
import 'package:cutdex_core/timeline/engine.dart';
|
import 'package:cutdex_sdk/timeline/engine.dart';
|
||||||
import 'package:cutdex_core/timeline/model.dart';
|
import 'package:cutdex_sdk/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,12 +17,11 @@ 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_core/editor.dart';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
import 'package:cutdex_sdk/preview.dart';
|
||||||
import 'package:cutdex_core/execution.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: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,11 +17,10 @@ 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_core/editor.dart';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
import 'package:cutdex_core/execution.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: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_core/editor.dart';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
import 'package:cutdex_sdk/preview.dart';
|
||||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
import 'package:cutdex_sdk/runtime.dart';
|
||||||
import 'package:cutdex_core/timeline/model.dart';
|
import 'package:cutdex_sdk/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';
|
||||||
|
|||||||
@@ -1,264 +0,0 @@
|
|||||||
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, workflow, settings }
|
enum DesktopContent { workspace, library, resourceLibrary, 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_timeline_ui/cutdex_timeline_ui.dart';
|
import 'package:cutdex_sdk/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.workflowSelected = false,
|
this.resourceLibrarySelected = 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 workflowSelected;
|
final bool resourceLibrarySelected;
|
||||||
|
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,110 +119,88 @@ class DesktopWindowFrame extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
if (projectTabs == null)
|
||||||
key: const Key('desktop-navigation-rail'),
|
SizedBox(
|
||||||
width: railWidth,
|
key: const Key('desktop-navigation-rail'),
|
||||||
child: LayoutBuilder(
|
width: railWidth,
|
||||||
builder: (context, constraints) => SingleChildScrollView(
|
child: Padding(
|
||||||
child: ConstrainedBox(
|
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||||
constraints: BoxConstraints(
|
child: Column(
|
||||||
minHeight: constraints.maxHeight,
|
children: [
|
||||||
),
|
for (final section in [0, 2])
|
||||||
child: IntrinsicHeight(
|
Padding(
|
||||||
child: Padding(
|
padding: const EdgeInsets.only(bottom: 8),
|
||||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
child: IconButton.filledTonal(
|
||||||
child: Column(
|
key: ValueKey(switch (section) {
|
||||||
children: [
|
0 => 'desktop-rail-home',
|
||||||
IconButton.filledTonal(
|
_ => 'desktop-rail-resources',
|
||||||
key: const ValueKey('desktop-rail-home'),
|
}),
|
||||||
tooltip: context.l10n.navigationHome,
|
tooltip: switch (section) {
|
||||||
isSelected:
|
0 => context.l10n.navigationHome,
|
||||||
!settingsSelected && !workflowSelected,
|
_ => context.l10n.navigationLibrary,
|
||||||
style: IconButton.styleFrom(
|
},
|
||||||
fixedSize: const Size.square(railButtonSize),
|
isSelected:
|
||||||
minimumSize: const Size.square(
|
!settingsSelected &&
|
||||||
railButtonSize,
|
(section == 2
|
||||||
),
|
? resourceLibrarySelected
|
||||||
maximumSize: const Size.square(
|
: !resourceLibrarySelected),
|
||||||
railButtonSize,
|
style: IconButton.styleFrom(
|
||||||
),
|
fixedSize: const Size.square(railButtonSize),
|
||||||
padding: EdgeInsets.zero,
|
minimumSize: const Size.square(railButtonSize),
|
||||||
iconSize: railIconSize,
|
maximumSize: const Size.square(railButtonSize),
|
||||||
tapTargetSize:
|
padding: EdgeInsets.zero,
|
||||||
MaterialTapTargetSize.shrinkWrap,
|
iconSize: railIconSize,
|
||||||
backgroundColor:
|
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||||
settingsSelected || workflowSelected
|
backgroundColor:
|
||||||
? Colors.transparent
|
!settingsSelected &&
|
||||||
: null,
|
(section == 2
|
||||||
),
|
? resourceLibrarySelected
|
||||||
onPressed: onHomePressed,
|
: !resourceLibrarySelected)
|
||||||
icon: const Icon(AppIcons.home),
|
? null
|
||||||
|
: Colors.transparent,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
onPressed: switch (section) {
|
||||||
IconButton.filledTonal(
|
0 => onHomePressed,
|
||||||
key: const ValueKey('desktop-rail-workflow'),
|
_ => onResourceLibraryPressed,
|
||||||
tooltip: context.l10n.workflow,
|
},
|
||||||
isSelected: workflowSelected,
|
icon: Icon(switch (section) {
|
||||||
style: IconButton.styleFrom(
|
0 => AppIcons.home,
|
||||||
fixedSize: const Size.square(railButtonSize),
|
_ => AppIcons.folder,
|
||||||
minimumSize: const Size.square(
|
}),
|
||||||
railButtonSize,
|
),
|
||||||
),
|
|
||||||
maximumSize: const Size.square(
|
|
||||||
railButtonSize,
|
|
||||||
),
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
iconSize: railIconSize,
|
|
||||||
tapTargetSize:
|
|
||||||
MaterialTapTargetSize.shrinkWrap,
|
|
||||||
backgroundColor: workflowSelected
|
|
||||||
? null
|
|
||||||
: Colors.transparent,
|
|
||||||
),
|
|
||||||
onPressed: onWorkflowPressed,
|
|
||||||
icon: const Icon(AppIcons.timeline),
|
|
||||||
),
|
|
||||||
const Spacer(),
|
|
||||||
IconButton(
|
|
||||||
key: const Key('desktop-rail-settings'),
|
|
||||||
tooltip: context.l10n.settings,
|
|
||||||
isSelected: settingsSelected,
|
|
||||||
onPressed: onSettingsPressed,
|
|
||||||
style: IconButton.styleFrom(
|
|
||||||
fixedSize: const Size.square(railButtonSize),
|
|
||||||
minimumSize: const Size.square(
|
|
||||||
railButtonSize,
|
|
||||||
),
|
|
||||||
maximumSize: const Size.square(
|
|
||||||
railButtonSize,
|
|
||||||
),
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
iconSize: railIconSize,
|
|
||||||
tapTargetSize:
|
|
||||||
MaterialTapTargetSize.shrinkWrap,
|
|
||||||
),
|
|
||||||
icon: const Icon(AppIcons.settings),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
const Spacer(),
|
||||||
|
IconButton(
|
||||||
|
key: const Key('project-settings-button'),
|
||||||
|
tooltip: context.l10n.settings,
|
||||||
|
isSelected: settingsSelected,
|
||||||
|
onPressed: onSettingsPressed,
|
||||||
|
style: IconButton.styleFrom(
|
||||||
|
fixedSize: const Size.square(railButtonSize),
|
||||||
|
minimumSize: const Size.square(railButtonSize),
|
||||||
|
maximumSize: const Size.square(railButtonSize),
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
iconSize: railIconSize,
|
||||||
|
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||||
|
),
|
||||||
|
icon: const Icon(AppIcons.settings),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
left: contentInset,
|
left: projectTabs == null ? 0 : 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: const Offset(
|
offset: Offset(
|
||||||
railWidth + contentInset,
|
projectTabs == null ? railWidth : contentInset,
|
||||||
headerHeight,
|
headerHeight,
|
||||||
),
|
),
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
|
|||||||
@@ -32,11 +32,6 @@ 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;
|
||||||
@@ -52,53 +47,12 @@ 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();
|
||||||
@@ -110,11 +64,6 @@ 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);
|
||||||
@@ -136,9 +85,6 @@ 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,
|
||||||
@@ -149,17 +95,11 @@ 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 build(BuildContext context) => widget.projectTabsLayout
|
||||||
WorkspaceResizeHighlightScope(child: _workspace(context));
|
|
||||||
|
|
||||||
Widget _workspace(BuildContext context) => widget.projectTabsLayout
|
|
||||||
? _projectWorkspace(context)
|
? _projectWorkspace(context)
|
||||||
: LayoutBuilder(
|
: LayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
@@ -224,7 +164,6 @@ 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,
|
||||||
@@ -378,12 +317,6 @@ 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,
|
||||||
@@ -391,7 +324,6 @@ 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,
|
||||||
@@ -424,64 +356,20 @@ class _DesktopWorkspaceShellState extends State<DesktopWorkspaceShell> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (!floating &&
|
if (!collapsed)
|
||||||
widget.sidebarCanExpand &&
|
|
||||||
WorkspaceLayoutPolicy.desktopNavigationFits(width))
|
|
||||||
Positioned(
|
Positioned(
|
||||||
left: collapsed
|
left: sidebarWidth - WorkspaceLayoutMetrics.desktopResizeSlop,
|
||||||
? 0
|
|
||||||
: sidebarWidth - WorkspaceLayoutMetrics.desktopResizeSlop,
|
|
||||||
top: 0,
|
top: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
child: _gutter(
|
child: _gutter(
|
||||||
name: 'project-sidebar',
|
name: 'project-sidebar',
|
||||||
highlightTargets: const {WorkspaceResizeBoundary.sidebar},
|
initialWidth: sidebarWidth,
|
||||||
highlightOffset: collapsed
|
onResize: (value) => widget.onSidebarWidthChanged(
|
||||||
? const Offset(
|
value.clamp(
|
||||||
-WorkspaceLayoutMetrics.desktopResizeHitExtent / 2,
|
WorkspaceLayoutMetrics.sidebarMinimumWidth,
|
||||||
0,
|
maximum,
|
||||||
)
|
),
|
||||||
: 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_native_flutter/cutdex_native_flutter.dart';
|
import 'package:cutdex_sdk/runtime.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,20 +2,24 @@ import 'dart:async';
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
import 'package:flutter/services.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.session, this.clock);
|
BenchDiagnostics(this.sessionId, this.clock);
|
||||||
final RuntimeSession session;
|
final String sessionId;
|
||||||
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, Object?>> read() => session.previewDiagnostics();
|
Future<Map<String, dynamic>> read() async =>
|
||||||
|
(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_core/timeline/model.dart';
|
import 'package:cutdex_sdk/timeline/model.dart';
|
||||||
import 'package:cutdex_core/timeline/layout.dart';
|
import 'package:cutdex_sdk/timeline/layout.dart';
|
||||||
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
import 'package:cutdex_sdk/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_core/editor.dart';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
import 'package:cutdex_sdk/runtime.dart';
|
||||||
import 'package:cutdex_core/timeline/model.dart';
|
import 'package:cutdex_sdk/timeline/model.dart';
|
||||||
import 'package:cutdex_core/timeline/layout.dart';
|
import 'package:cutdex_sdk/timeline/layout.dart';
|
||||||
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
import 'package:cutdex_sdk/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!, clock);
|
final native = diagnostics = BenchDiagnostics(preview.session!.id, 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_core/timeline/layout.dart';
|
import 'package:cutdex_sdk/timeline/layout.dart';
|
||||||
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
import 'package:cutdex_sdk/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!,
|
preview!.session!.id,
|
||||||
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_core/project.dart';
|
import 'package:cutdex_sdk/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_core/project.dart';
|
import 'package:cutdex_sdk/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_core/project.dart';
|
import 'package:cutdex_sdk/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_native_flutter/cutdex_native_flutter.dart';
|
import 'package:cutdex_sdk/runtime.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_core/project.dart';
|
import 'package:cutdex_sdk/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_core/project.dart';
|
import 'package:cutdex_sdk/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_core/project.dart';
|
import 'package:cutdex_sdk/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,6 +80,7 @@ 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 ||
|
||||||
@@ -92,8 +93,7 @@ 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,15 +205,10 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
|||||||
if (desktop) mediaButton,
|
if (desktop) mediaButton,
|
||||||
Expanded(
|
Expanded(
|
||||||
child: desktop
|
child: desktop
|
||||||
? Padding(
|
? _PreviewHeaderTitle(
|
||||||
padding: const EdgeInsets.symmetric(
|
projectId: widget.projectId,
|
||||||
horizontal: AppSpacing.small,
|
timelineId: widget.timelineId,
|
||||||
),
|
pending: _timelinePending,
|
||||||
child: _PreviewHeaderTitle(
|
|
||||||
projectId: widget.projectId,
|
|
||||||
timelineId: widget.timelineId,
|
|
||||||
pending: _timelinePending,
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
: widget.showProjectName
|
: widget.showProjectName
|
||||||
? Row(
|
? Row(
|
||||||
@@ -254,7 +249,7 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
|||||||
? context.l10n.collapseProperties
|
? context.l10n.collapseProperties
|
||||||
: context.l10n.expandProperties,
|
: context.l10n.expandProperties,
|
||||||
isSelected: propertiesOpen,
|
isSelected: propertiesOpen,
|
||||||
onPressed: !viewSettings.$1
|
onPressed: !viewSettings.hasValue
|
||||||
? null
|
? null
|
||||||
: () {
|
: () {
|
||||||
if (desktop) {
|
if (desktop) {
|
||||||
@@ -290,40 +285,23 @@ class _EditorWorkspaceState extends ConsumerState<EditorWorkspace> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
Widget dockedEditing({required bool showTools}) => Consumer(
|
Widget dockedEditing({required bool showTools}) =>
|
||||||
builder: (context, ref, _) {
|
ExpandedEditorLayout(
|
||||||
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,
|
||||||
mediaWidth: dimensions.$1,
|
timelineHeight: _timelineHeight,
|
||||||
onMediaWidthChanged: (width) {
|
|
||||||
if (viewSettings.$1) {
|
|
||||||
_viewController.setMediaWidth(width);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onMediaWidthChangeEnd: _saveViewSettings,
|
|
||||||
timelineHeight: dimensions.$2,
|
|
||||||
onTimelineHeightChanged: (height) {
|
onTimelineHeightChanged: (height) {
|
||||||
if (viewSettings.$1) {
|
if (viewSettings.hasValue) {
|
||||||
_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.small : 0,
|
horizontal: AppTheme.isDesktop(context) ? AppSpacing.tiny : 0,
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
@@ -90,9 +90,7 @@ class EditorTimelineDefaults extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Padding(
|
: Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
horizontal: AppSpacing.medium,
|
|
||||||
),
|
|
||||||
child: AppCommandToolbar(
|
child: AppCommandToolbar(
|
||||||
groups: [
|
groups: [
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ 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';
|
||||||
@@ -62,11 +61,6 @@ 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,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -109,12 +103,7 @@ class BoundedEditorLayout extends StatelessWidget {
|
|||||||
right: 0,
|
right: 0,
|
||||||
width: page
|
width: page
|
||||||
? constraints.maxWidth
|
? constraints.maxWidth
|
||||||
: math.min(
|
: math.min(320, constraints.maxWidth),
|
||||||
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,13 +15,9 @@ 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,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -31,13 +27,9 @@ 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
|
||||||
@@ -58,35 +50,28 @@ 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) =>
|
Widget build(BuildContext context) => LayoutBuilder(
|
||||||
WorkspaceResizeHighlightScope(child: _layout());
|
|
||||||
|
|
||||||
Widget _layout() => LayoutBuilder(
|
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
double resolveTimelineHeight(double? height) =>
|
final maximum = math.max(
|
||||||
WorkspaceLayoutMetrics.resolveTimelineHeight(
|
0.0,
|
||||||
constraints.maxHeight,
|
constraints.maxHeight -
|
||||||
height,
|
gap -
|
||||||
);
|
WorkspaceLayoutMetrics.previewMinimumHeight,
|
||||||
final timelineHeight = resolveTimelineHeight(widget.timelineHeight);
|
);
|
||||||
|
final minimum = math.min(
|
||||||
|
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: [
|
||||||
@@ -145,24 +130,6 @@ 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,
|
||||||
@@ -171,39 +138,15 @@ 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) =>
|
onResize: (height) => widget.onTimelineHeightChanged(
|
||||||
widget.onTimelineHeightChanged(resolveTimelineHeight(height)),
|
height.clamp(minimum, maximum).toDouble(),
|
||||||
|
),
|
||||||
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_core/project.dart';
|
import 'package:cutdex_sdk/project.dart';
|
||||||
import 'package:cutdex_core/timeline/model.dart';
|
import 'package:cutdex_sdk/timeline/model.dart';
|
||||||
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
import 'package:cutdex_sdk/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_core/editor.dart';
|
import 'package:cutdex_sdk/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_core/editor.dart';
|
import 'package:cutdex_sdk/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_core/project.dart';
|
import 'package:cutdex_sdk/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,23 +24,12 @@ 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?.copyWith(
|
Theme.of(context).textTheme.bodyMedium
|
||||||
fontFamily: 'packages/cutdex_ui/Inter',
|
?.copyWith(fontSize: 13, height: 20 / 13);
|
||||||
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?.copyWith(
|
Theme.of(context).textTheme.bodySmall
|
||||||
fontFamily: 'packages/cutdex_ui/Inter',
|
?.copyWith(fontSize: 12, height: 16 / 12);
|
||||||
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) {
|
||||||
@@ -117,7 +106,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(AppInspectorMetrics.radius),
|
borderRadius: BorderRadius.circular(4),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
if (unavailable)
|
if (unavailable)
|
||||||
@@ -226,3 +215,66 @@ 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_core/project.dart';
|
import 'package:cutdex_sdk/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_core/project.dart';
|
import 'package:cutdex_sdk/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_core/project.dart';
|
import 'package:cutdex_sdk/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,95 +298,6 @@ 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(
|
||||||
@@ -471,6 +382,105 @@ 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(
|
||||||
@@ -499,10 +509,9 @@ class _MediaBrowserBodyState extends ConsumerState<MediaBrowserBody>
|
|||||||
separatorBuilder: (_, _) =>
|
separatorBuilder: (_, _) =>
|
||||||
SizedBox(height: spacing),
|
SizedBox(height: spacing),
|
||||||
)
|
)
|
||||||
: GridView.custom(
|
: GridView.builder(
|
||||||
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,
|
||||||
@@ -519,10 +528,8 @@ class _MediaBrowserBodyState extends ConsumerState<MediaBrowserBody>
|
|||||||
labelHeight +
|
labelHeight +
|
||||||
2,
|
2,
|
||||||
),
|
),
|
||||||
childrenDelegate: _MediaChildrenDelegate(
|
itemCount: assets.length,
|
||||||
item,
|
itemBuilder: item,
|
||||||
childCount: assets.length,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
if (widget.desktop) {
|
if (widget.desktop) {
|
||||||
return ScrollEdgeFade(
|
return ScrollEdgeFade(
|
||||||
@@ -539,6 +546,8 @@ 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(
|
||||||
@@ -802,13 +811,3 @@ 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_core/project.dart';
|
import 'package:cutdex_sdk/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(96),
|
small(120),
|
||||||
medium(120),
|
medium(160),
|
||||||
large(160);
|
large(200);
|
||||||
|
|
||||||
const MediaGridSize(this.targetWidth);
|
const MediaGridSize(this.targetWidth);
|
||||||
final double targetWidth;
|
final double targetWidth;
|
||||||
|
|||||||
@@ -2,14 +2,15 @@ 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 = 16.0;
|
static const padding = 12.0;
|
||||||
static const gap = 8.0;
|
static const gap = 8.0;
|
||||||
static const tilePadding = 8.0;
|
static const tilePadding = 5.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)).ceil());
|
math.max(1, ((width + gap) / (targetWidth + gap)).floor());
|
||||||
|
|
||||||
static double gridExtent(double tileWidth, double labelHeight) =>
|
static double gridExtent(double tileWidth, double labelHeight) =>
|
||||||
(tileWidth - tilePadding * 2) * 9 / 16 +
|
(tileWidth - tilePadding * 2) * 9 / 16 +
|
||||||
@@ -18,7 +19,7 @@ abstract final class DesktopMediaMetrics {
|
|||||||
tilePadding * 2;
|
tilePadding * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// List-column visibility within asset rows.
|
/// Matching list-column visibility for a header and its asset rows.
|
||||||
final class DesktopMediaListColumns {
|
final class DesktopMediaListColumns {
|
||||||
const DesktopMediaListColumns(double width)
|
const DesktopMediaListColumns(double width)
|
||||||
: duration = width >= 240,
|
: duration = width >= 240,
|
||||||
|
|||||||
@@ -292,34 +292,6 @@ 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(
|
||||||
@@ -337,7 +309,6 @@ 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(
|
||||||
@@ -370,14 +341,9 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
|||||||
else
|
else
|
||||||
SizedBox(
|
SizedBox(
|
||||||
key: const Key('media-project-row'),
|
key: const Key('media-project-row'),
|
||||||
height: AppInspectorMetrics.row,
|
height: 36,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
||||||
AppInspectorMetrics.padding,
|
|
||||||
AppInspectorMetrics.rowPadding,
|
|
||||||
AppInspectorMetrics.trailingPadding,
|
|
||||||
AppInspectorMetrics.rowPadding,
|
|
||||||
),
|
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (context, constraints) => Row(
|
builder: (context, constraints) => Row(
|
||||||
children: [
|
children: [
|
||||||
@@ -403,7 +369,6 @@ 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(
|
||||||
@@ -420,7 +385,7 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: AppSpacing.small),
|
const SizedBox(width: 4),
|
||||||
ConstrainedBox(
|
ConstrainedBox(
|
||||||
constraints: BoxConstraints(
|
constraints: BoxConstraints(
|
||||||
maxWidth: (constraints.maxWidth * .45).clamp(
|
maxWidth: (constraints.maxWidth * .45).clamp(
|
||||||
@@ -429,12 +394,12 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: AppInspectorMetrics.input,
|
height: 28,
|
||||||
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: desktopButtonStyle,
|
style: AppTheme.toolbarButtonStyle(context),
|
||||||
onPressed: canImport ? onImport : null,
|
onPressed: canImport ? onImport : null,
|
||||||
child: Text(
|
child: Text(
|
||||||
context.l10n.importMedia,
|
context.l10n.importMedia,
|
||||||
@@ -462,14 +427,6 @@ 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(
|
||||||
@@ -505,7 +462,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: AppInspectorMetrics.action,
|
dimension: 28,
|
||||||
child: AppDropdownMenu(
|
child: AppDropdownMenu(
|
||||||
items: items,
|
items: items,
|
||||||
builder: (context, toggle, focus) => IconButton(
|
builder: (context, toggle, focus) => IconButton(
|
||||||
@@ -520,14 +477,9 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
|||||||
);
|
);
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
key: const Key('media-filter-row'),
|
key: const Key('media-filter-row'),
|
||||||
height: AppInspectorMetrics.row,
|
height: 40,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(
|
padding: const EdgeInsets.fromLTRB(12, 4, 12, 4),
|
||||||
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;
|
||||||
@@ -538,10 +490,13 @@ 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(context, style: searchText),
|
style: AppTheme.inputTextStyle(
|
||||||
|
context,
|
||||||
|
style: AppTheme.toolbarTextStyle(context),
|
||||||
|
),
|
||||||
cursorHeight: AppTheme.inputCursorHeight(
|
cursorHeight: AppTheme.inputCursorHeight(
|
||||||
context,
|
context,
|
||||||
style: searchText,
|
style: AppTheme.toolbarTextStyle(context),
|
||||||
),
|
),
|
||||||
textAlignVertical: TextAlignVertical.center,
|
textAlignVertical: TextAlignVertical.center,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
@@ -550,61 +505,36 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
|||||||
),
|
),
|
||||||
hintStyle: AppTheme.inputHintStyle(
|
hintStyle: AppTheme.inputHintStyle(
|
||||||
context,
|
context,
|
||||||
style: searchText,
|
style: AppTheme.toolbarTextStyle(context),
|
||||||
),
|
),
|
||||||
filled: true,
|
|
||||||
fillColor: colors.surfaceContainer,
|
|
||||||
isDense: true,
|
isDense: true,
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(minHeight: 32),
|
||||||
minHeight: AppInspectorMetrics.input,
|
|
||||||
),
|
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
horizontal: AppSpacing.small,
|
horizontal: 8,
|
||||||
),
|
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: AppInspectorMetrics.input,
|
minWidth: 28,
|
||||||
minHeight: AppInspectorMetrics.input,
|
minHeight: 28,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onChanged: (value) => widget.onQueryChanged?.call(value),
|
onChanged: (value) => widget.onQueryChanged?.call(value),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: AppSpacing.small),
|
const SizedBox(width: 4),
|
||||||
if (wide) ...[
|
if (wide) ...[
|
||||||
SizedBox(
|
SizedBox(width: 88, height: 28, child: category()),
|
||||||
width: 88,
|
const SizedBox(width: 4),
|
||||||
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: AppSpacing.small),
|
const SizedBox(width: 4),
|
||||||
menuButton(
|
menuButton(
|
||||||
key: const Key('media-size-button'),
|
key: const Key('media-size-button'),
|
||||||
tooltip: context.l10n.mediaThumbnailSize,
|
tooltip: context.l10n.mediaThumbnailSize,
|
||||||
@@ -634,9 +564,9 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
|||||||
...sizeItems(),
|
...sizeItems(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(width: AppSpacing.small),
|
const SizedBox(width: 4),
|
||||||
SizedBox.square(
|
SizedBox.square(
|
||||||
dimension: AppInspectorMetrics.action,
|
dimension: 28,
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
key: const Key('media-layout-toggle'),
|
key: const Key('media-layout-toggle'),
|
||||||
onPressed: onToggleGrid,
|
onPressed: onToggleGrid,
|
||||||
@@ -651,9 +581,9 @@ class _MediaBrowserToolbarState extends State<MediaBrowserToolbar> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (widget.projectScoped) ...[
|
if (widget.projectScoped) ...[
|
||||||
const SizedBox(width: AppSpacing.small),
|
const SizedBox(width: 4),
|
||||||
SizedBox.square(
|
SizedBox.square(
|
||||||
dimension: AppInspectorMetrics.action,
|
dimension: 28,
|
||||||
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_core/timeline/model.dart';
|
import 'package:cutdex_sdk/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,13 +115,9 @@ 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: AppDesktopMetrics.timelineTabs,
|
height: 36,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsetsDirectional.only(
|
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
|
||||||
start: AppSpacing.small,
|
|
||||||
top: 4,
|
|
||||||
bottom: 4,
|
|
||||||
),
|
|
||||||
child: ScrollEdgeFade(
|
child: ScrollEdgeFade(
|
||||||
controller: _scrollController,
|
controller: _scrollController,
|
||||||
axis: Axis.horizontal,
|
axis: Axis.horizontal,
|
||||||
@@ -131,30 +127,35 @@ 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: Row(
|
child: Padding(
|
||||||
children: [
|
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||||
for (final section in ResourceSection.values) ...[
|
child: Row(
|
||||||
if (section != ResourceSection.values.first)
|
children: [
|
||||||
const SizedBox(width: AppSpacing.tiny),
|
for (final section in ResourceSection.values) ...[
|
||||||
KeyedSubtree(
|
if (section != ResourceSection.values.first)
|
||||||
key: widget.selected == section ? _selectedTabKey : null,
|
const SizedBox(width: 4),
|
||||||
child: Semantics(
|
KeyedSubtree(
|
||||||
selected: widget.selected == section,
|
key: widget.selected == section
|
||||||
child: TextButton(
|
? _selectedTabKey
|
||||||
key: ValueKey('resource-tab-${section.name}'),
|
: null,
|
||||||
style: AppTheme.timelineTabStyle(
|
child: Semantics(
|
||||||
context,
|
selected: widget.selected == section,
|
||||||
selected: widget.selected == section,
|
child: TextButton(
|
||||||
|
key: ValueKey('resource-tab-${section.name}'),
|
||||||
|
style: AppTheme.timelineTabStyle(
|
||||||
|
context,
|
||||||
|
selected: widget.selected == section,
|
||||||
|
),
|
||||||
|
onPressed: widget.onSelected == null
|
||||||
|
? null
|
||||||
|
: () => widget.onSelected!(section),
|
||||||
|
child: Text(section.label(l10n), maxLines: 1),
|
||||||
),
|
),
|
||||||
onPressed: widget.onSelected == null
|
|
||||||
? null
|
|
||||||
: () => widget.onSelected!(section),
|
|
||||||
child: Text(section.label(l10n), maxLines: 1),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import 'package:cutdex/diagnostics/app_diagnostics.dart';
|
import 'package:cutdex/diagnostics/app_diagnostics.dart';
|
||||||
import 'package:cutdex/errors/app_failure.dart';
|
import 'package:cutdex/errors/app_failure.dart';
|
||||||
|
|
||||||
import 'package:cutdex_core/editor.dart';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
import 'package:cutdex_core/project.dart';
|
import 'package:cutdex_sdk/project.dart';
|
||||||
import 'package:cutdex_core/timeline/model.dart';
|
import 'package:cutdex_sdk/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_core/editor.dart';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
import 'package:cutdex_core/timeline/model.dart';
|
import 'package:cutdex_sdk/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_core/project.dart';
|
import 'package:cutdex_sdk/project.dart';
|
||||||
import 'package:cutdex_native_flutter/processing_contracts.dart';
|
import 'package:cutdex_sdk/runtime/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_core/project.dart';
|
import 'package:cutdex_sdk/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_core/timeline/model.dart';
|
import 'package:cutdex_sdk/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_native_flutter/cutdex_native_flutter.dart';
|
import 'package:cutdex_sdk/runtime.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,9 +2,8 @@ import 'package:cutdex/l10n/l10n.dart';
|
|||||||
|
|
||||||
import '../../errors/app_failure.dart';
|
import '../../errors/app_failure.dart';
|
||||||
|
|
||||||
import 'package:cutdex_core/editor.dart';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
import 'package:cutdex_core/execution.dart';
|
import 'package:cutdex_sdk/runtime.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_core/editor.dart';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
import 'package:cutdex_sdk/preview.dart';
|
||||||
import 'package:cutdex_core/project.dart';
|
import 'package:cutdex_sdk/project.dart';
|
||||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
import 'package:cutdex_sdk/runtime.dart';
|
||||||
import 'package:cutdex_core/timeline/model.dart';
|
import 'package:cutdex_sdk/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,8 +228,6 @@ 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,
|
||||||
),
|
),
|
||||||
@@ -623,22 +621,6 @@ 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) {
|
||||||
@@ -679,7 +661,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.seekInteractive(tick);
|
await source.control(SourcePreviewAction.seek, at: time);
|
||||||
} 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);
|
||||||
}
|
}
|
||||||
@@ -723,25 +705,12 @@ 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 ??
|
||||||
@@ -793,9 +762,7 @@ class _PreviewToolbar extends StatelessWidget {
|
|||||||
? AppDesktopMetrics.playbackBar
|
? AppDesktopMetrics.playbackBar
|
||||||
: AppControlSize.panelHeader,
|
: AppControlSize.panelHeader,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(horizontal: AppSpacing.compact),
|
||||||
horizontal: AppInspectorMetrics.padding,
|
|
||||||
),
|
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
final controls = Row(
|
final controls = Row(
|
||||||
@@ -836,14 +803,13 @@ class _PreviewToolbar extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: timeTextStyle,
|
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||||
|
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: () => (
|
||||||
@@ -860,14 +826,10 @@ 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)) ...[
|
if (AppTheme.isDesktop(context)) _frameButton(context, 1),
|
||||||
_frameButton(context, 1),
|
|
||||||
const SizedBox(width: AppSpacing.small),
|
|
||||||
],
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ListenableSelector(
|
child: ListenableSelector(
|
||||||
listenable: source ?? preview,
|
listenable: source ?? preview,
|
||||||
@@ -892,9 +854,8 @@ 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.small),
|
const SizedBox(width: AppSpacing.gap),
|
||||||
],
|
],
|
||||||
if (source == null &&
|
if (source == null &&
|
||||||
PreviewFullscreenScope.of(context)?.fullscreen !=
|
PreviewFullscreenScope.of(context)?.fullscreen !=
|
||||||
@@ -904,25 +865,6 @@ 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,
|
||||||
@@ -952,7 +894,6 @@ class _PreviewToolbar extends StatelessWidget {
|
|||||||
? AppIcons.exitFullscreen
|
? AppIcons.exitFullscreen
|
||||||
: AppIcons.fullscreen,
|
: AppIcons.fullscreen,
|
||||||
),
|
),
|
||||||
style: _compactButtonStyle(context),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ 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.
|
||||||
@@ -295,19 +294,6 @@ 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(
|
||||||
@@ -645,33 +631,30 @@ 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: !isActiveContent(surface),
|
excluding:
|
||||||
|
(contentSelection.surface ==
|
||||||
|
DesktopContent.settings) !=
|
||||||
|
(surface == DesktopContent.settings),
|
||||||
child: TickerMode(
|
child: TickerMode(
|
||||||
enabled: isActiveContent(surface),
|
enabled:
|
||||||
|
(contentSelection.surface ==
|
||||||
|
DesktopContent.settings) ==
|
||||||
|
(surface == DesktopContent.settings),
|
||||||
child: child,
|
child: child,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
Widget desktopContents(
|
Widget desktopContents(
|
||||||
Widget workspace,
|
Widget workspace,
|
||||||
) => IndexedStack(
|
) => IndexedStack(
|
||||||
index: switch (contentSelection.surface) {
|
index:
|
||||||
DesktopContent.settings => 1,
|
contentSelection.surface ==
|
||||||
DesktopContent.workflow => 2,
|
DesktopContent.settings
|
||||||
_ => 0,
|
? 1
|
||||||
},
|
: 0,
|
||||||
children: [
|
children: [
|
||||||
contentSurface(
|
contentSurface(
|
||||||
DesktopContent.workspace,
|
DesktopContent.workspace,
|
||||||
@@ -702,10 +685,6 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
|||||||
)
|
)
|
||||||
: const SizedBox.shrink(),
|
: const SizedBox.shrink(),
|
||||||
),
|
),
|
||||||
contentSurface(
|
|
||||||
DesktopContent.workflow,
|
|
||||||
const WorkflowPage(),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
return switch (experience) {
|
return switch (experience) {
|
||||||
@@ -794,23 +773,17 @@ class _EditingPageState extends ConsumerState<EditingPage> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
resourceLibrarySelected:
|
||||||
|
contentSelection.surface ==
|
||||||
|
DesktopContent.resourceLibrary,
|
||||||
|
onResourceLibraryPressed: () => selectSidebar(
|
||||||
|
DesktopContent.resourceLibrary,
|
||||||
|
),
|
||||||
settingsSelected:
|
settingsSelected:
|
||||||
contentSelection.surface ==
|
contentSelection.surface ==
|
||||||
DesktopContent.settings,
|
DesktopContent.settings,
|
||||||
workflowSelected:
|
onHomePressed: () =>
|
||||||
contentSelection.surface ==
|
selectSidebar(DesktopContent.workspace),
|
||||||
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(
|
||||||
@@ -821,43 +794,15 @@ 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,
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
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,17 +1,12 @@
|
|||||||
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_core/editor.dart';
|
import 'package:cutdex_sdk/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_core/timeline/engine.dart';
|
import 'package:cutdex_sdk/timeline/engine.dart';
|
||||||
import 'package:cutdex_core/timeline/model.dart';
|
import 'package:cutdex_sdk/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_core/editor.dart';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
|
|
||||||
export 'package:cutdex_core/editor.dart' show ClipAudioGain;
|
export 'package:cutdex_sdk/editor.dart' show ClipAudioGain;
|
||||||
|
|
||||||
class AudioProperties extends StatefulWidget {
|
class AudioProperties extends StatefulWidget {
|
||||||
const AudioProperties({
|
const AudioProperties({
|
||||||
@@ -169,7 +169,8 @@ 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 AppPropertySection(
|
return Padding(
|
||||||
|
padding: AppTheme.propertySectionPadding(context),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
@@ -342,18 +343,15 @@ class _AudioPropertiesState extends State<AudioProperties> {
|
|||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
AppPropertySection(
|
Padding(
|
||||||
|
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.skip(1).toList(),
|
actions: volumeActions,
|
||||||
padChild: false,
|
child: volumeControls,
|
||||||
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_core/editor.dart';
|
import 'package:cutdex_sdk/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_core/editor.dart';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
import 'package:cutdex_core/timeline/model.dart';
|
import 'package:cutdex_sdk/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,7 +196,8 @@ class _CaptionPropertiesState extends State<CaptionProperties> {
|
|||||||
: 28.0;
|
: 28.0;
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
AppPropertySection(
|
Padding(
|
||||||
|
padding: AppTheme.propertySectionPadding(context),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: AppTheme.propertyInputHeight(context),
|
height: AppTheme.propertyInputHeight(context),
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -225,13 +226,9 @@ class _CaptionPropertiesState extends State<CaptionProperties> {
|
|||||||
vertical: 0,
|
vertical: 0,
|
||||||
),
|
),
|
||||||
prefixIcon: const Icon(AppIcons.search, size: 14),
|
prefixIcon: const Icon(AppIcons.search, size: 14),
|
||||||
prefixIconConstraints: BoxConstraints(
|
prefixIconConstraints: const BoxConstraints(
|
||||||
minWidth: AppTheme.isCompactInspector(context)
|
minWidth: 28,
|
||||||
? 24
|
minHeight: 28,
|
||||||
: 28,
|
|
||||||
minHeight: AppTheme.isCompactInspector(context)
|
|
||||||
? 24
|
|
||||||
: 28,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onChanged: (value) => setState(
|
onChanged: (value) => setState(
|
||||||
@@ -451,7 +448,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)
|
||||||
? AppInspectorMetrics.sectionHeader
|
? AppDesktopMetrics.panelHeader
|
||||||
: CompactPanelTabs.height,
|
: CompactPanelTabs.height,
|
||||||
headerPadding: EdgeInsets.zero,
|
headerPadding: EdgeInsets.zero,
|
||||||
showHeaderDivider: false,
|
showHeaderDivider: false,
|
||||||
@@ -567,9 +564,7 @@ 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: AppTheme.isDesktop(context)
|
padding: const EdgeInsets.symmetric(vertical: AppSpacing.small),
|
||||||
? EdgeInsets.zero
|
|
||||||
: const EdgeInsets.symmetric(vertical: AppSpacing.small),
|
|
||||||
children:
|
children:
|
||||||
[
|
[
|
||||||
if (AppTheme.isDesktop(context))
|
if (AppTheme.isDesktop(context))
|
||||||
@@ -780,21 +775,16 @@ 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: const EdgeInsets.symmetric(
|
padding: EdgeInsets.symmetric(
|
||||||
horizontal: AppSpacing.panelContentHorizontal,
|
horizontal: AppTheme.isDesktop(context)
|
||||||
|
? AppInspectorMetrics.padding
|
||||||
|
: AppSpacing.panelContentHorizontal,
|
||||||
),
|
),
|
||||||
child: item,
|
child: item,
|
||||||
),
|
),
|
||||||
@@ -814,13 +804,11 @@ 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;
|
||||||
|
|
||||||
@@ -882,7 +870,6 @@ 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,
|
||||||
@@ -914,39 +901,17 @@ 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 swatch = Container(
|
|
||||||
width: desktop ? 14 : 20,
|
|
||||||
height: desktop ? 14 : 20,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Color(int.parse('FF${value.substring(1)}', radix: 16)),
|
|
||||||
border: Border.all(
|
|
||||||
color: desktop
|
|
||||||
? Theme.of(context).colorScheme.outlineVariant
|
|
||||||
: Theme.of(context).colorScheme.outline,
|
|
||||||
),
|
|
||||||
borderRadius: BorderRadius.circular(AppRadius.extraSmall),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
if (desktop) {
|
|
||||||
return AppPropertyGroup(
|
|
||||||
label: label,
|
|
||||||
padChild: false,
|
|
||||||
child: AppPropertyRow(
|
|
||||||
reserveTrailing: false,
|
|
||||||
children: [
|
|
||||||
_CaptionTextInput(
|
|
||||||
value: value,
|
|
||||||
editContext: editContext,
|
|
||||||
leading: SizedBox(width: 24, child: Center(child: swatch)),
|
|
||||||
onSubmit: onSubmit,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
final controls = Row(
|
final controls = Row(
|
||||||
children: [
|
children: [
|
||||||
swatch,
|
Container(
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Color(int.parse('FF${value.substring(1)}', radix: 16)),
|
||||||
|
border: Border.all(color: Theme.of(context).colorScheme.outline),
|
||||||
|
borderRadius: BorderRadius.circular(AppRadius.extraSmall),
|
||||||
|
),
|
||||||
|
),
|
||||||
const SizedBox(width: AppSpacing.small),
|
const SizedBox(width: AppSpacing.small),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: _CaptionTextInput(
|
child: _CaptionTextInput(
|
||||||
@@ -958,6 +923,11 @@ class _CaptionColorInput extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
return controls;
|
return desktop
|
||||||
|
? AppPropertyGroup(
|
||||||
|
label: label,
|
||||||
|
child: Semantics(label: label, child: controls),
|
||||||
|
)
|
||||||
|
: controls;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
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),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
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_core/editor.dart';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
import 'package:cutdex_native_flutter/cutdex_native_flutter.dart';
|
import 'package:cutdex_sdk/runtime.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,15 +40,20 @@ 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 notice = !reported
|
final status = selected != null
|
||||||
? context.l10n.colorInfoNotLoaded
|
? context.l10n.manualColorSpace(selected.label(context.l10n))
|
||||||
: selected == null && detected == null
|
: detected != null
|
||||||
|
? context.l10n.detectedColorSpace(detected.label(context.l10n))
|
||||||
|
: reported
|
||||||
? context.l10n.unknownColorSpace
|
? context.l10n.unknownColorSpace
|
||||||
: null;
|
: context.l10n.colorInfoNotLoaded;
|
||||||
return ColorInterpretationControls(
|
final selector = AppSelect<String>(
|
||||||
|
emptyLabel: context.l10n.noMatchingOptions,
|
||||||
|
key: const Key('media-color-menu'),
|
||||||
|
outlined: false,
|
||||||
|
label: context.l10n.mediaColorInterpretation,
|
||||||
value: selected?.name ?? 'auto',
|
value: selected?.name ?? 'auto',
|
||||||
notice: notice,
|
onChanged: !reported
|
||||||
onChanged: !reported || !session.acceptsEdits
|
|
||||||
? null
|
? null
|
||||||
: (value) => session.commands.setMediaColor(
|
: (value) => session.commands.setMediaColor(
|
||||||
assetId,
|
assetId,
|
||||||
@@ -56,16 +61,66 @@ class ColorInterpretationProperties extends ConsumerWidget {
|
|||||||
value == 'auto' ? null : MediaColorSpace.values.byName(value),
|
value == 'auto' ? null : MediaColorSpace.values.byName(value),
|
||||||
),
|
),
|
||||||
options: [
|
options: [
|
||||||
AppSelectOption(
|
AppSelectOption('auto', context.l10n.auto),
|
||||||
'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(
|
||||||
|
|||||||
@@ -1,211 +0,0 @@
|
|||||||
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),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,196 +0,0 @@
|
|||||||
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,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
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,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,132 +0,0 @@
|
|||||||
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),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,245 +0,0 @@
|
|||||||
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,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,172 +0,0 @@
|
|||||||
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_core/editor.dart';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
import 'package:cutdex_sdk/preview.dart';
|
||||||
import 'package:cutdex_core/timeline/model.dart';
|
import 'package:cutdex_sdk/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: Listenable.merge([preview, preview.positionChanges]),
|
listenable: preview,
|
||||||
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,11 +264,10 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
|
|||||||
}) => PropertyNumberInput(
|
}) => PropertyNumberInput(
|
||||||
key: ValueKey((selectedId, label)),
|
key: ValueKey((selectedId, label)),
|
||||||
label: label,
|
label: label,
|
||||||
inlineLabel: inlineLabel || AppTheme.isDesktop(context),
|
inlineLabel: inlineLabel,
|
||||||
prefix: AppTheme.isDesktop(context) && !inlineLabel ? '' : null,
|
labelActions: AppTheme.isDesktop(context) && !inlineLabel
|
||||||
prefixIcon: AppTheme.isDesktop(context) && wrapRotation
|
? [key(label)]
|
||||||
? AppIcons.angle
|
: const [],
|
||||||
: null,
|
|
||||||
unit: unit,
|
unit: unit,
|
||||||
value: value,
|
value: value,
|
||||||
enabled: enabled,
|
enabled: enabled,
|
||||||
@@ -339,65 +338,45 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
|
|||||||
if (mounted) setState(() => _scrubField = null);
|
if (mounted) setState(() => _scrubField = null);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
Widget axes(
|
Widget axes(String label, Widget first, Widget second) =>
|
||||||
String label,
|
LayoutBuilder(
|
||||||
Widget first,
|
builder: (context, constraints) {
|
||||||
Widget second, {
|
final desktop = AppTheme.isDesktop(context);
|
||||||
Widget? additional,
|
final gap = AppTheme.propertyRowGap(context);
|
||||||
}) => LayoutBuilder(
|
final pair = constraints.maxWidth < (desktop ? 180 : 240)
|
||||||
builder: (context, constraints) {
|
? Column(
|
||||||
final desktop = AppTheme.isDesktop(context);
|
children: [
|
||||||
final gap = AppTheme.propertyRowGap(context);
|
first,
|
||||||
if (desktop) {
|
SizedBox(height: gap),
|
||||||
return AppPropertyGroup(
|
second,
|
||||||
label: label,
|
],
|
||||||
padChild: false,
|
)
|
||||||
child: Column(
|
: Row(
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
AppPropertyRow(
|
children: [
|
||||||
trailing: key(label),
|
Expanded(child: first),
|
||||||
children: [first, second],
|
SizedBox(width: gap),
|
||||||
),
|
Expanded(child: second),
|
||||||
?additional,
|
],
|
||||||
],
|
);
|
||||||
),
|
return desktop
|
||||||
);
|
? AppPropertyGroup(
|
||||||
}
|
label: label,
|
||||||
final pair = constraints.maxWidth < 240
|
actions: [key(label)],
|
||||||
? Column(
|
child: pair,
|
||||||
children: [
|
)
|
||||||
first,
|
: Row(
|
||||||
SizedBox(height: gap),
|
children: [
|
||||||
second,
|
Expanded(child: pair),
|
||||||
],
|
SizedBox(width: gap),
|
||||||
)
|
key(label),
|
||||||
: Row(
|
],
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
);
|
||||||
children: [
|
},
|
||||||
Expanded(child: first),
|
|
||||||
SizedBox(width: gap),
|
|
||||||
Expanded(child: second),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
return Row(
|
|
||||||
children: [
|
|
||||||
Expanded(child: pair),
|
|
||||||
SizedBox(width: gap),
|
|
||||||
key(label),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
},
|
|
||||||
);
|
|
||||||
Widget singleField(String label, Widget input) =>
|
Widget singleField(String label, Widget input) =>
|
||||||
AppTheme.isDesktop(context)
|
AppTheme.isDesktop(context)
|
||||||
? AppPropertyGroup(
|
? input
|
||||||
label: label,
|
|
||||||
padChild: false,
|
|
||||||
child: AppPropertyRow(
|
|
||||||
trailing: key(label),
|
|
||||||
children: [input],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: Row(
|
: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: input),
|
Expanded(child: input),
|
||||||
@@ -416,7 +395,8 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
|
|||||||
style: AppTheme.propertySectionTitleStyle(context),
|
style: AppTheme.propertySectionTitleStyle(context),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
Widget section(List<Widget> children) => AppPropertySection(
|
Widget section(List<Widget> children) => Padding(
|
||||||
|
padding: AppTheme.propertySectionPadding(context),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: children,
|
children: children,
|
||||||
@@ -606,11 +586,8 @@ class _MaskPropertiesState extends ConsumerState<MaskProperties> {
|
|||||||
if (AppTheme.isDesktop(context))
|
if (AppTheme.isDesktop(context))
|
||||||
AppPropertyGroup(
|
AppPropertyGroup(
|
||||||
label: context.l10n.type,
|
label: context.l10n.type,
|
||||||
padChild: false,
|
actions: [shapeReset()],
|
||||||
child: AppPropertyRow(
|
child: shapeSelector(),
|
||||||
trailing: shapeReset(),
|
|
||||||
children: [shapeSelector()],
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
Row(
|
Row(
|
||||||
@@ -643,40 +620,22 @@ 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,
|
||||||
|
field(
|
||||||
context.l10n.rotation,
|
context.l10n.rotation,
|
||||||
field(
|
mask.rotation,
|
||||||
context.l10n.rotation,
|
-180,
|
||||||
mask.rotation,
|
180,
|
||||||
-180,
|
(v) => mask.copyWith(rotation: v),
|
||||||
180,
|
unit: '°',
|
||||||
(v) => mask.copyWith(rotation: v),
|
wrapRotation: true,
|
||||||
unit: '°',
|
|
||||||
wrapRotation: true,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
]),
|
),
|
||||||
|
]),
|
||||||
section([
|
section([
|
||||||
heading(context.l10n.size),
|
heading(context.l10n.size),
|
||||||
axes(
|
axes(
|
||||||
|
|||||||
@@ -1,19 +1,25 @@
|
|||||||
import 'dart:async';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
|
import 'package:cutdex_sdk/preview.dart';
|
||||||
import 'package:cutdex_core/editor.dart';
|
import 'package:cutdex_sdk/timeline/engine.dart';
|
||||||
import 'package:cutdex_preview/cutdex_preview.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';
|
||||||
|
|
||||||
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
|
||||||
@@ -25,16 +31,35 @@ 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,
|
||||||
) {
|
) {
|
||||||
_boundary = PropertyEditBoundary(session, sequence, clip);
|
if (!ref.mounted ||
|
||||||
ref.onDispose(_boundary.dispose);
|
!isCurrent() ||
|
||||||
return const AsyncData(null);
|
session.activeSequenceId != sequence ||
|
||||||
|
preview?.transforms.hasPending == true) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final view = session.view(sequence);
|
||||||
|
return target.tick == view.playheadTick &&
|
||||||
|
identical(target.version, view.version.kernelVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClipAnimation? animation() {
|
ClipAnimation? animation() {
|
||||||
@@ -61,9 +86,10 @@ 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 work = _run(PictureEditFailure.transform, preview, isCurrent, (
|
final target = _capture();
|
||||||
target,
|
final work = _run(PictureEditFailure.transform, () async {
|
||||||
) {
|
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);
|
||||||
@@ -74,9 +100,7 @@ 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(
|
||||||
@@ -108,7 +132,10 @@ class PictureEdits extends _$PictureEdits {
|
|||||||
preview?.transforms.hasPending == true) {
|
preview?.transforms.hasPending == true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await _run(PictureEditFailure.keyframes, preview, isCurrent, (target) {
|
final target = _capture();
|
||||||
|
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,
|
||||||
@@ -127,6 +154,7 @@ 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(
|
||||||
@@ -138,13 +166,12 @@ class PictureEdits extends _$PictureEdits {
|
|||||||
alignment: alignment,
|
alignment: alignment,
|
||||||
expectedVersion: session.version,
|
expectedVersion: session.version,
|
||||||
);
|
);
|
||||||
await _run(PictureEditFailure.alignment, preview, isCurrent, (
|
await _run(PictureEditFailure.alignment, () async {
|
||||||
target,
|
await preview.pauseForCanvasInteraction();
|
||||||
) async {
|
|
||||||
await session.alignClip(
|
await session.alignClip(
|
||||||
sequence,
|
sequence,
|
||||||
command,
|
command,
|
||||||
isCancelled: () => !target.isCurrent,
|
isCancelled: () => !_valid(target, isCurrent, preview),
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
@@ -152,22 +179,24 @@ class PictureEdits extends _$PictureEdits {
|
|||||||
|
|
||||||
Future<bool> _run(
|
Future<bool> _run(
|
||||||
PictureEditFailure failure,
|
PictureEditFailure failure,
|
||||||
PreviewController? preview,
|
Future<bool> Function() action,
|
||||||
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 _boundary.run(
|
final applied = await session.runEditAsync(
|
||||||
preview,
|
switch (failure) {
|
||||||
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,6 +12,318 @@ 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'b3166b6e97f6a711e6e92b67dfc44341a3fec4e2';
|
String _$pictureEditsHash() => r'6385f3bd53094d57ed054681d142591e059e8b08';
|
||||||
|
|
||||||
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_core/editor.dart';
|
import 'package:cutdex_sdk/editor.dart';
|
||||||
import 'package:cutdex_preview/cutdex_preview.dart';
|
import 'package:cutdex_sdk/preview.dart';
|
||||||
import 'package:cutdex_core/timeline/engine.dart';
|
import 'package:cutdex_sdk/timeline/engine.dart';
|
||||||
import 'package:cutdex_core/timeline/model.dart';
|
import 'package:cutdex_sdk/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,10 +22,6 @@ 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({
|
||||||
@@ -61,7 +57,6 @@ 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);
|
||||||
@@ -92,7 +87,6 @@ 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);
|
||||||
}
|
}
|
||||||
@@ -210,9 +204,7 @@ 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;
|
||||||
}
|
}
|
||||||
@@ -275,16 +267,6 @@ 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,
|
||||||
@@ -377,46 +359,36 @@ 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(
|
Widget axes(TransformChannel channel, Widget first, Widget second) =>
|
||||||
TransformChannel channel,
|
LayoutBuilder(
|
||||||
Widget first,
|
builder: (context, constraints) {
|
||||||
Widget second, {
|
final pair = constraints.maxWidth < (desktop ? 180 : 240)
|
||||||
Widget? trailing,
|
? Column(
|
||||||
}) => LayoutBuilder(
|
children: [
|
||||||
builder: (context, constraints) {
|
first,
|
||||||
if (desktop) {
|
SizedBox(height: gap),
|
||||||
return AppPropertyRow(
|
second,
|
||||||
trailing: channel == TransformChannel.position
|
],
|
||||||
? keyButton(channel)
|
)
|
||||||
: trailing,
|
: Row(
|
||||||
children: [first, second],
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
);
|
children: [
|
||||||
}
|
Expanded(child: first),
|
||||||
final pair = constraints.maxWidth < 240
|
SizedBox(width: gap),
|
||||||
? Column(
|
Expanded(child: second),
|
||||||
children: [
|
],
|
||||||
first,
|
);
|
||||||
SizedBox(height: gap),
|
return desktop
|
||||||
second,
|
? pair
|
||||||
],
|
: Row(
|
||||||
)
|
children: [
|
||||||
: Row(
|
Expanded(child: pair),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
SizedBox(width: gap),
|
||||||
children: [
|
keyButton(channel),
|
||||||
Expanded(child: first),
|
],
|
||||||
SizedBox(width: gap),
|
);
|
||||||
Expanded(child: second),
|
},
|
||||||
],
|
|
||||||
);
|
|
||||||
return Row(
|
|
||||||
children: [
|
|
||||||
Expanded(child: pair),
|
|
||||||
SizedBox(width: gap),
|
|
||||||
keyButton(channel),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
Widget keyTools(TransformChannel channel) {
|
Widget keyTools(TransformChannel channel) {
|
||||||
if (animation == null || !animation.animated(channel)) {
|
if (animation == null || !animation.animated(channel)) {
|
||||||
@@ -516,23 +488,17 @@ 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) => v < min || v > max
|
submit: (v) => _commit(preview, (current) => change(current, v)),
|
||||||
? Future.value(false)
|
|
||||||
: _commit(preview, (current) => change(current, v)),
|
|
||||||
onScrubStart: () => _startScrub(
|
onScrubStart: () => _startScrub(
|
||||||
preview,
|
preview,
|
||||||
id,
|
id,
|
||||||
@@ -554,7 +520,8 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
|||||||
widget.session.view(widget.sequence).playheadTick,
|
widget.session.view(widget.sequence).playheadTick,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
Widget section(List<Widget> children) => AppPropertySection(
|
Widget section(List<Widget> children) => Padding(
|
||||||
|
padding: AppTheme.propertySectionPadding(context),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: children,
|
children: children,
|
||||||
@@ -588,10 +555,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
|||||||
prefixIcon: desktop ? AppIcons.angle : null,
|
prefixIcon: desktop ? AppIcons.angle : null,
|
||||||
);
|
);
|
||||||
final rotation = desktop
|
final rotation = desktop
|
||||||
? AppPropertyRow(
|
? rotationInput
|
||||||
trailing: keyButton(TransformChannel.rotation),
|
|
||||||
children: [rotationInput, const SizedBox.shrink()],
|
|
||||||
)
|
|
||||||
: Row(
|
: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: rotationInput),
|
Expanded(child: rotationInput),
|
||||||
@@ -599,7 +563,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
|||||||
keyButton(TransformChannel.rotation),
|
keyButton(TransformChannel.rotation),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
Widget scaleControls({Widget? trailing}) => axes(
|
final scale = axes(
|
||||||
TransformChannel.scale,
|
TransformChannel.scale,
|
||||||
number(
|
number(
|
||||||
'picture-scale-x',
|
'picture-scale-x',
|
||||||
@@ -631,7 +595,6 @@ 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'),
|
||||||
@@ -647,10 +610,11 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
|||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
);
|
);
|
||||||
final scale = scaleControls();
|
|
||||||
final alignmentControls = LayoutBuilder(
|
final alignmentControls = LayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) => Wrap(
|
||||||
final groups = <Widget>[
|
spacing: AppSpacing.small,
|
||||||
|
runSpacing: AppSpacing.small,
|
||||||
|
children: [
|
||||||
for (final group in [
|
for (final group in [
|
||||||
[
|
[
|
||||||
(
|
(
|
||||||
@@ -684,9 +648,7 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
|||||||
],
|
],
|
||||||
])
|
])
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: desktop
|
width: constraints.maxWidth < 200
|
||||||
? null
|
|
||||||
: constraints.maxWidth < 200
|
|
||||||
? constraints.maxWidth
|
? constraints.maxWidth
|
||||||
: (constraints.maxWidth - AppSpacing.small) / 2,
|
: (constraints.maxWidth - AppSpacing.small) / 2,
|
||||||
child: AppButtonGroup(
|
child: AppButtonGroup(
|
||||||
@@ -713,89 +675,9 @@ 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: [
|
||||||
@@ -808,43 +690,46 @@ class _PicturePropertiesState extends ConsumerState<PictureProperties> {
|
|||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
if (!widget.animationView && !desktop)
|
if (!widget.animationView)
|
||||||
section([
|
section([
|
||||||
Text(
|
if (desktop)
|
||||||
context.l10n.alignment,
|
AppPropertyGroup(
|
||||||
style: AppTheme.propertySectionTitleStyle(context),
|
label: context.l10n.alignment,
|
||||||
),
|
child: alignmentControls,
|
||||||
SizedBox(height: gap),
|
)
|
||||||
alignmentControls,
|
else ...[
|
||||||
|
Text(
|
||||||
|
context.l10n.alignment,
|
||||||
|
style: AppTheme.propertySectionTitleStyle(context),
|
||||||
|
),
|
||||||
|
SizedBox(height: gap),
|
||||||
|
alignmentControls,
|
||||||
|
],
|
||||||
]),
|
]),
|
||||||
if (desktop) ...[
|
if (desktop) ...[
|
||||||
section([
|
section([
|
||||||
AppPropertyGroup(
|
AppPropertyGroup(
|
||||||
label: context.l10n.position,
|
label: context.l10n.position,
|
||||||
padChild: false,
|
actions: [keyButton(TransformChannel.position)],
|
||||||
child: Column(
|
child: position,
|
||||||
children: [
|
|
||||||
if (!widget.animationView) alignmentControls,
|
|
||||||
position,
|
|
||||||
keyTools(TransformChannel.position),
|
|
||||||
rotation,
|
|
||||||
keyTools(TransformChannel.rotation),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
keyTools(TransformChannel.position),
|
||||||
]),
|
]),
|
||||||
section([
|
section([
|
||||||
AppPropertyGroup(
|
AppPropertyGroup(
|
||||||
label: context.l10n.scale,
|
label: context.l10n.scale,
|
||||||
actions: [keyButton(TransformChannel.scale)],
|
actions: [lock, keyButton(TransformChannel.scale)],
|
||||||
padChild: false,
|
child: scale,
|
||||||
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([
|
||||||
@@ -874,82 +759,6 @@ 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(
|
||||||
@@ -1015,34 +824,7 @@ 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(
|
||||||
@@ -1050,7 +832,7 @@ class _KeyframeTimeline extends StatelessWidget {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: 36,
|
width: 36,
|
||||||
child: Text(
|
child: Text(
|
||||||
label,
|
channel.label(context),
|
||||||
style: Theme.of(context).textTheme.bodySmall,
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -1069,7 +851,7 @@ class _KeyframeTimeline extends StatelessWidget {
|
|||||||
) *
|
) *
|
||||||
extent;
|
extent;
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
key: ValueKey('picture-key-track-$id'),
|
key: ValueKey('picture-key-track-${channel.name}'),
|
||||||
behavior: HitTestBehavior.opaque,
|
behavior: HitTestBehavior.opaque,
|
||||||
onTapDown: !enabled
|
onTapDown: !enabled
|
||||||
? null
|
? null
|
||||||
@@ -1101,16 +883,18 @@ class _KeyframeTimeline extends StatelessWidget {
|
|||||||
width: 1,
|
width: 1,
|
||||||
child: ColoredBox(color: colors.primary),
|
child: ColoredBox(color: colors.primary),
|
||||||
),
|
),
|
||||||
for (final tick in times)
|
for (final tick in animation.keyTimes(channel))
|
||||||
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('picture-key-marker-$id-$tick'),
|
key: ValueKey(
|
||||||
|
'picture-key-marker-${channel.name}-$tick',
|
||||||
|
),
|
||||||
tooltip:
|
tooltip:
|
||||||
'$label ${((tick - animation.start) / TimelineClock.ticksPerSecond).toStringAsFixed(2)} s',
|
'${channel.label(context)} ${((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_native_flutter/contracts.dart';
|
import 'package:cutdex_sdk/runtime/contracts.dart';
|
||||||
import 'package:cutdex_core/timeline/model.dart';
|
import 'package:cutdex_sdk/timeline/model.dart';
|
||||||
import 'package:cutdex_core/timeline/engine.dart';
|
import 'package:cutdex_sdk/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,9 +39,7 @@ 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:
|
style: AppTheme.isDesktop(context)
|
||||||
AppTheme.isDesktop(context) &&
|
|
||||||
!AppTheme.isCompactInspector(context)
|
|
||||||
? AppTheme.toolbarButtonStyle(context)
|
? AppTheme.toolbarButtonStyle(context)
|
||||||
: null,
|
: null,
|
||||||
onPressed: () => showAppDialog<void>(
|
onPressed: () => showAppDialog<void>(
|
||||||
@@ -52,17 +50,14 @@ class ProjectProperties extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
headerHeight: AppTheme.isDesktop(context)
|
headerHeight: AppTheme.isDesktop(context)
|
||||||
? AppInspectorMetrics.sectionHeader
|
? AppDesktopMetrics.panelHeader
|
||||||
: AppControlSize.panelToolbar,
|
: AppControlSize.panelToolbar,
|
||||||
headerPadding: AppTheme.isDesktop(context)
|
headerPadding: EdgeInsets.symmetric(
|
||||||
? const EdgeInsets.only(
|
horizontal: AppTheme.isDesktop(context)
|
||||||
left: AppInspectorMetrics.padding,
|
? AppInspectorMetrics.padding
|
||||||
right: AppInspectorMetrics.trailingPadding,
|
: AppSpacing.panelContentHorizontal,
|
||||||
)
|
),
|
||||||
: const EdgeInsets.symmetric(
|
showHeaderDivider: false,
|
||||||
horizontal: AppSpacing.panelContentHorizontal,
|
|
||||||
),
|
|
||||||
showHeaderDivider: AppTheme.isCompactInspector(context),
|
|
||||||
child: ScrollEdgeFadeBuilder(
|
child: ScrollEdgeFadeBuilder(
|
||||||
builder: (controller) => SingleChildScrollView(
|
builder: (controller) => SingleChildScrollView(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
@@ -80,8 +75,8 @@ class ProjectProperties extends StatelessWidget {
|
|||||||
() => session.canvas.label(context),
|
() => session.canvas.label(context),
|
||||||
),
|
),
|
||||||
info(
|
info(
|
||||||
context.l10n.projectOutputColorSpace,
|
context.l10n.projectColorSpace,
|
||||||
() => switch (session.projectOutputColorSpace) {
|
() => switch (session.projectColorSpace) {
|
||||||
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',
|
||||||
@@ -138,7 +133,8 @@ class _Info extends StatelessWidget {
|
|||||||
style: Theme.of(context).textTheme.bodyMedium,
|
style: Theme.of(context).textTheme.bodyMedium,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return AppPropertySection(
|
return Padding(
|
||||||
|
padding: AppTheme.propertySectionPadding(context),
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
spacing: AppSpacing.small,
|
spacing: AppSpacing.small,
|
||||||
|
|||||||
@@ -14,11 +14,9 @@ class ProjectPropertyRow extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => Padding(
|
Widget build(BuildContext context) => Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(
|
padding: const EdgeInsets.symmetric(
|
||||||
AppInspectorMetrics.padding,
|
horizontal: AppInspectorMetrics.padding,
|
||||||
AppInspectorMetrics.rowPadding,
|
vertical: AppInspectorMetrics.rowGap,
|
||||||
AppInspectorMetrics.trailingPadding,
|
|
||||||
AppInspectorMetrics.rowPadding,
|
|
||||||
),
|
),
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: const BoxConstraints(minHeight: AppInspectorMetrics.input),
|
constraints: const BoxConstraints(minHeight: AppInspectorMetrics.input),
|
||||||
@@ -37,11 +35,13 @@ class ProjectPropertyRow extends StatelessWidget {
|
|||||||
label,
|
label,
|
||||||
maxLines: 3,
|
maxLines: 3,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: AppTheme.propertyLabelStyle(context),
|
style: AppTheme.toolbarTextStyle(context).copyWith(
|
||||||
|
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.inputTextStyle(context),
|
style: AppTheme.toolbarTextStyle(context),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Loaded 100 of 437 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user