fix(ui): refine create task actions and relocate icon sources (#1500)
No files matched your search
@@ -0,0 +1,3 @@
|
||||
.venv/
|
||||
.build/
|
||||
__pycache__/
|
||||
@@ -0,0 +1,59 @@
|
||||
---
|
||||
name: gopeed-file-category-icons
|
||||
description: Design or revise Gopeed file-classification icons as one cohesive SVG-to-Flutter icon font. Use for file types, generic and protocol-marked folders, unknown files, and extension-to-icon taxonomy; do not use for launcher, navigation, action, or status icons.
|
||||
---
|
||||
|
||||
# Gopeed File Category Icons
|
||||
|
||||
Maintain Gopeed's file-classification visual language and its deterministic SVG → TTF → Flutter `IconData` pipeline.
|
||||
|
||||
The canonical editable materials live in `design/file-category-icons/` as tooling-only sources inside the Flutter project. Read its `README.md` before changing any source. Do not add that directory to Flutter assets.
|
||||
|
||||
## Classification grammar
|
||||
|
||||
- A directory is always a folder outline. Add a classification or protocol mark only when one is known; otherwise leave the folder empty.
|
||||
- A non-directory is always a file outline plus its classification mark.
|
||||
- An unknown file is an empty file outline. Do not invent a generic interior mark.
|
||||
- Transfer state is separate from classification. Never replace a file glyph with paused, failed, completed, or downloading artwork.
|
||||
- Keep this skill scoped to file browsing, task assets, extension classification, and the font that renders those categories.
|
||||
|
||||
## Workflow
|
||||
|
||||
1. Read `design/file-category-icons/README.md`, then inspect its manifest, the classification mapping, real task-card size, and file-tree size. Read [references/style-guide.md](references/style-guide.md) for every visual revision.
|
||||
2. Preserve the shared file or folder shell. Redraw only the classification mark unless the task explicitly revises the complete system.
|
||||
3. Create 24×24 SVG sources containing only closed, filled `<path>` geometry. Convert strokes and lettering to paths; never leave `<text>`, live strokes, masks, clipping, filters, or external references.
|
||||
4. Keep every decorated mark inside the documented safe area. Reject any mark that touches or visually merges with the shell at 16 or 20 px.
|
||||
5. Preserve existing names and codepoints. Omit the codepoint only for a new category, then allocate it with the builder. Bump the font version for a visual revision.
|
||||
6. Rebuild the complete TTF and generated Dart class, then generate the multi-size contact sheet.
|
||||
7. Inspect 16, 20, 24, and 32 px in light and dark swatches. Check the actual Flutter task card and task-detail file tree when their sizes differ from the sheet.
|
||||
8. Run the relevant classification tests, `flutter analyze`, and `flutter test` after integration changes.
|
||||
|
||||
## Tool setup
|
||||
|
||||
The scripts require the pinned packages in `scripts/requirements.txt`. Keep the environment local and untracked:
|
||||
|
||||
```bash
|
||||
python3 -m venv .agent/skills/gopeed-file-category-icons/.venv
|
||||
.agent/skills/gopeed-file-category-icons/.venv/bin/pip install -r .agent/skills/gopeed-file-category-icons/scripts/requirements.txt
|
||||
```
|
||||
|
||||
Build and preview a manifest:
|
||||
|
||||
```bash
|
||||
.agent/skills/gopeed-file-category-icons/.venv/bin/python .agent/skills/gopeed-file-category-icons/scripts/build_icon_font.py --manifest design/file-category-icons/manifest.json --allocate-codepoints
|
||||
.agent/skills/gopeed-file-category-icons/.venv/bin/python .agent/skills/gopeed-file-category-icons/scripts/preview_icon_font.py --manifest design/file-category-icons/manifest.json
|
||||
```
|
||||
|
||||
Use [assets/manifest.example.json](assets/manifest.example.json) and [assets/folder-symbol-template.svg](assets/folder-symbol-template.svg) only as structural starting points.
|
||||
|
||||
## Invariants
|
||||
|
||||
- Existing codepoints are API: never renumber or reuse one unless the user explicitly approves a breaking migration.
|
||||
- `design/file-category-icons/` is the sole editable source of truth. The packaged Flutter runtime uses only the generated TTF and Dart constants.
|
||||
- Never add the design-material directory to `pubspec.yaml`; it must remain outside the packaged Flutter asset graph.
|
||||
- The manifest is the source of truth. Do not hand-edit generated Dart constants or patch the binary font.
|
||||
- Keep icon names lowercase `snake_case`; the generator emits lowerCamelCase Dart fields.
|
||||
- File and folder shells in the same revision must share outline weight, baseline, fold/tab geometry, and optical scale.
|
||||
- Prefer a recognizable classification symbol over lettering. If lettering is necessary, convert it to geometry and prove it remains legible at 16 px; PDF-like multi-letter marks need deliberate spacing rather than scaling text into the available area.
|
||||
- New classification groups require both an extension/domain mapping and a glyph. Do not add a glyph that no classifier can reach.
|
||||
- Rebuild the complete font after every source change so all platforms consume the same binary.
|
||||
@@ -0,0 +1,4 @@
|
||||
interface:
|
||||
display_name: "Gopeed File Category Icons"
|
||||
short_description: "Design cohesive Gopeed file-classification icons"
|
||||
default_prompt: "Use $gopeed-file-category-icons to update the source materials and regenerate a consistent Gopeed file-category icon."
|
||||
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M2 4C2 3.17 2.67 2.5 3.5 2.5H9.25L11.25 4.5H20.5C21.33 4.5 22 5.17 22 6V7.5H2V4ZM2 5.5H4V20H2V5.5ZM20 5.5H22V20H20V5.5ZM2 19.5H22V20C22 20.83 21.33 21.5 20.5 21.5H3.5C2.67 21.5 2 20.83 2 20V19.5Z"/>
|
||||
<path d="M12 9.25C13.1 9.25 14 10.15 14 11.25C14 12.35 13.1 13.25 12 13.25C10.9 13.25 10 12.35 10 11.25C10 10.15 10.9 9.25 12 9.25ZM7.25 14.25C8.35 14.25 9.25 15.15 9.25 16.25C9.25 17.35 8.35 18.25 7.25 18.25C6.15 18.25 5.25 17.35 5.25 16.25C5.25 15.15 6.15 14.25 7.25 14.25ZM16.75 14.25C17.85 14.25 18.75 15.15 18.75 16.25C18.75 17.35 17.85 18.25 16.75 18.25C15.65 18.25 14.75 17.35 14.75 16.25C14.75 15.15 15.65 14.25 16.75 14.25ZM10.35 12L11.35 13.4L8.9 15.15L7.9 13.75L10.35 12ZM13.65 12L16.1 13.75L15.1 15.15L12.65 13.4L13.65 12Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 818 B |
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"fontFamily": "GopeedIcons",
|
||||
"fontOutput": "../.build/GopeedIcons.ttf",
|
||||
"dartOutput": "../.build/gopeed_icons.dart",
|
||||
"previewOutput": "../.build/gopeed_icons_preview.png",
|
||||
"dartClass": "GopeedIcons",
|
||||
"codepointStart": "0xE900",
|
||||
"unitsPerEm": 1024,
|
||||
"ascent": 896,
|
||||
"descent": -128,
|
||||
"padding": 0,
|
||||
"version": "1.0.0",
|
||||
"icons": [
|
||||
{
|
||||
"name": "file_category_template",
|
||||
"source": "folder-symbol-template.svg",
|
||||
"codepoint": "0xE900"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
# Gopeed file-category icon style
|
||||
|
||||
## Composition
|
||||
|
||||
- Unknown file: empty file shell.
|
||||
- Known file: file shell plus one classification mark.
|
||||
- Generic folder: empty folder shell.
|
||||
- Known or protocol folder: folder shell plus one classification mark.
|
||||
- Status and actions never belong inside a classification glyph.
|
||||
|
||||
## Geometry
|
||||
|
||||
- Use a `0 0 24 24` viewBox and keep the optical drawing inside `2…22` on both axes.
|
||||
- Use the current shared shell as the source of truth. The established file shell spans roughly `x=3…21` with a 1.5-unit outline; do not silently introduce a heavier one-off border.
|
||||
- Keep decorated marks approximately inside `x=6.2…17.8` and `y=9.2…19`. Preserve at least 1.5 units of visible separation from the shell wherever its interior edge is closer.
|
||||
- Prefer radii around 1.5–2 units, consistent terminal shapes, and simple silhouettes. Avoid details or gaps below 1.25 units.
|
||||
- Center by optical mass rather than bounding-box arithmetic when the shape has a tab, arrow, or asymmetric label.
|
||||
- Use non-zero winding for counters and holes; reverse inner-contour direction where a cutout is required.
|
||||
|
||||
## Classification marks
|
||||
|
||||
- Use one dominant mark, not several miniature objects.
|
||||
- Prefer semantic geometry: play for video, note for audio, image silhouette for images, grid for spreadsheets, a zipper for archive/compressed files, and a cylinder for databases.
|
||||
- Avoid lettering when a semantic mark is clearer. When a conventional label such as PDF is retained, build each letter as filled geometry with at least 1.25-unit stems and explicit inter-letter gaps.
|
||||
- Keep an empty file truly empty. A question mark, star, or extension text changes its meaning.
|
||||
|
||||
## Protocol-marked folders
|
||||
|
||||
- Keep the folder silhouette recognizable before adding the protocol symbol.
|
||||
- Place a simple filled protocol symbol in the lower folder body with clear space from every edge.
|
||||
- Prefer semantic marks such as a magnet/swarm for BitTorrent or a donkey/server-network mark for ED2K. Do not default to acronym lettering.
|
||||
- Let the visible folder occupy about 80–85% of the 24-unit canvas. Avoid adding generator padding on top of the SVG optical margin; double padding makes Flutter icons look undersized.
|
||||
- Compare optical center and occupied area against Flutter's `folder_outlined` at the actual widget size, not only in an enlarged preview.
|
||||
|
||||
## Consistency checks
|
||||
|
||||
- Compare new icons beside at least one existing folder icon and one file-type icon.
|
||||
- Inspect the generated contact sheet at 16, 20, 24, and 32 px on light and dark swatches.
|
||||
- Reject icons that depend on color, contain live text/strokes, have inconsistent baseline/weight, drift off center, become ambiguous at 16 px, or leave less than the shared safe-area separation from the shell.
|
||||
- Compare decorated icons against both empty shells. Interior marks must not make the shell look heavier by merging into its border.
|
||||
|
||||
## Flutter usage
|
||||
|
||||
Register the generated TTF under `flutter.fonts` using the exact `fontFamily` from the manifest. Use the generated Dart constants rather than raw codepoints. Render icon-font glyphs with `Icon`; do not use `Text` because icon sizing and semantics should follow Flutter's icon pipeline.
|
||||
@@ -0,0 +1,298 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Build a deterministic Gopeed file-category font and Flutter IconData class from SVG paths."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
import xml.etree.ElementTree as ET
|
||||
from pathlib import Path
|
||||
|
||||
try:
|
||||
from fontTools.fontBuilder import FontBuilder
|
||||
from fontTools.pens.boundsPen import BoundsPen
|
||||
from fontTools.pens.cu2quPen import Cu2QuPen
|
||||
from fontTools.pens.transformPen import TransformPen
|
||||
from fontTools.pens.ttGlyphPen import TTGlyphPen
|
||||
from fontTools.svgLib.path import SVGPath
|
||||
except ImportError as error:
|
||||
raise SystemExit("Missing fonttools; install scripts/requirements.txt in the skill's .venv") from error
|
||||
|
||||
|
||||
NAME_PATTERN = re.compile(r"^[a-z][a-z0-9_]*$")
|
||||
DART_NAME_PATTERN = re.compile(r"^[A-Za-z][A-Za-z0-9]*$")
|
||||
PRIVATE_USE_START = 0xE000
|
||||
PRIVATE_USE_END = 0xF8FF
|
||||
ALLOWED_SVG_TAGS = {"svg", "g", "path"}
|
||||
|
||||
|
||||
def parse_args() -> argparse.Namespace:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--manifest", required=True, type=Path)
|
||||
parser.add_argument("--allocate-codepoints", action="store_true")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def local_name(tag: str) -> str:
|
||||
return tag.rsplit("}", 1)[-1]
|
||||
|
||||
|
||||
def parse_number(value: object, field: str) -> int:
|
||||
if isinstance(value, int):
|
||||
return value
|
||||
if isinstance(value, str):
|
||||
try:
|
||||
return int(value, 0)
|
||||
except ValueError as error:
|
||||
raise ValueError(f"{field} must be an integer or 0x-prefixed integer") from error
|
||||
raise ValueError(f"{field} must be an integer or string")
|
||||
|
||||
|
||||
def parse_view_box(svg_text: str, source: Path) -> tuple[float, float, float, float]:
|
||||
try:
|
||||
root = ET.fromstring(svg_text)
|
||||
except ET.ParseError as error:
|
||||
raise ValueError(f"{source}: invalid XML: {error}") from error
|
||||
if local_name(root.tag) != "svg":
|
||||
raise ValueError(f"{source}: root element must be <svg>")
|
||||
values = re.split(r"[\s,]+", root.attrib.get("viewBox", "").strip())
|
||||
if len(values) != 4:
|
||||
raise ValueError(f"{source}: viewBox must contain four numbers")
|
||||
try:
|
||||
min_x, min_y, width, height = (float(value) for value in values)
|
||||
except ValueError as error:
|
||||
raise ValueError(f"{source}: viewBox contains a non-numeric value") from error
|
||||
if width <= 0 or height <= 0:
|
||||
raise ValueError(f"{source}: viewBox dimensions must be positive")
|
||||
if abs(width - height) > 1e-6:
|
||||
raise ValueError(f"{source}: icon viewBox must be square")
|
||||
|
||||
path_count = 0
|
||||
for element in root.iter():
|
||||
tag = local_name(element.tag)
|
||||
if tag not in ALLOWED_SVG_TAGS:
|
||||
raise ValueError(f"{source}: unsupported <{tag}>; convert everything to filled paths")
|
||||
style = element.attrib.get("style", "").replace(" ", "").lower()
|
||||
stroke = element.attrib.get("stroke", "none").lower()
|
||||
if stroke != "none" or ("stroke:" in style and "stroke:none" not in style):
|
||||
raise ValueError(f"{source}: live strokes are not allowed; expand strokes to paths")
|
||||
if tag == "path":
|
||||
if not element.attrib.get("d", "").strip():
|
||||
raise ValueError(f"{source}: every <path> needs path data")
|
||||
if element.attrib.get("fill", "").lower() == "none" or "fill:none" in style:
|
||||
raise ValueError(f"{source}: paths must be filled outlines")
|
||||
path_count += 1
|
||||
if path_count == 0:
|
||||
raise ValueError(f"{source}: no paths found")
|
||||
return min_x, min_y, width, height
|
||||
|
||||
|
||||
def dart_name(icon: dict[str, object]) -> str:
|
||||
explicit = icon.get("dartName")
|
||||
if explicit is not None:
|
||||
value = str(explicit)
|
||||
else:
|
||||
parts = str(icon["name"]).split("_")
|
||||
value = parts[0] + "".join(part.capitalize() for part in parts[1:])
|
||||
if not DART_NAME_PATTERN.fullmatch(value):
|
||||
raise ValueError(f"invalid Dart field name: {value}")
|
||||
return value
|
||||
|
||||
|
||||
def allocate_codepoints(manifest: dict[str, object], allow_allocation: bool) -> bool:
|
||||
icons = manifest.get("icons")
|
||||
if not isinstance(icons, list) or not icons:
|
||||
raise ValueError("manifest.icons must be a non-empty list")
|
||||
used = {
|
||||
parse_number(icon["codepoint"], f"icons[{index}].codepoint")
|
||||
for index, icon in enumerate(icons)
|
||||
if isinstance(icon, dict) and icon.get("codepoint") is not None
|
||||
}
|
||||
next_codepoint = parse_number(manifest.get("codepointStart", "0xE900"), "codepointStart")
|
||||
changed = False
|
||||
for index, icon in enumerate(icons):
|
||||
if not isinstance(icon, dict):
|
||||
raise ValueError(f"icons[{index}] must be an object")
|
||||
if icon.get("codepoint") is not None:
|
||||
continue
|
||||
if not allow_allocation:
|
||||
raise ValueError(f"icons[{index}] has no codepoint; rerun with --allocate-codepoints")
|
||||
while next_codepoint in used:
|
||||
next_codepoint += 1
|
||||
if next_codepoint > PRIVATE_USE_END:
|
||||
raise ValueError("no codepoints remain in the BMP private-use area")
|
||||
icon["codepoint"] = f"0x{next_codepoint:04X}"
|
||||
used.add(next_codepoint)
|
||||
next_codepoint += 1
|
||||
changed = True
|
||||
return changed
|
||||
|
||||
|
||||
def validate_icons(manifest: dict[str, object], manifest_dir: Path) -> list[dict[str, object]]:
|
||||
icons = manifest["icons"]
|
||||
assert isinstance(icons, list)
|
||||
names: set[str] = set()
|
||||
dart_names: set[str] = set()
|
||||
codepoints: set[int] = set()
|
||||
validated: list[dict[str, object]] = []
|
||||
for index, raw_icon in enumerate(icons):
|
||||
assert isinstance(raw_icon, dict)
|
||||
name = str(raw_icon.get("name", ""))
|
||||
if not NAME_PATTERN.fullmatch(name):
|
||||
raise ValueError(f"icons[{index}].name must be lowercase snake_case")
|
||||
field_name = dart_name(raw_icon)
|
||||
codepoint = parse_number(raw_icon.get("codepoint"), f"icons[{index}].codepoint")
|
||||
if not PRIVATE_USE_START <= codepoint <= PRIVATE_USE_END:
|
||||
raise ValueError(f"{name}: codepoint must be in U+E000…U+F8FF")
|
||||
source_value = raw_icon.get("source")
|
||||
if not isinstance(source_value, str) or not source_value:
|
||||
raise ValueError(f"{name}: source must be a relative SVG path")
|
||||
source = (manifest_dir / source_value).resolve()
|
||||
if source.suffix.lower() != ".svg" or not source.is_file():
|
||||
raise ValueError(f"{name}: SVG source does not exist: {source}")
|
||||
if name in names or field_name in dart_names or codepoint in codepoints:
|
||||
raise ValueError(f"{name}: duplicate name, Dart field, or codepoint")
|
||||
names.add(name)
|
||||
dart_names.add(field_name)
|
||||
codepoints.add(codepoint)
|
||||
validated.append(
|
||||
{
|
||||
**raw_icon,
|
||||
"name": name,
|
||||
"glyphName": f"icon_{name}",
|
||||
"dartName": field_name,
|
||||
"codepoint": codepoint,
|
||||
"sourcePath": source,
|
||||
}
|
||||
)
|
||||
return sorted(validated, key=lambda icon: int(icon["codepoint"]))
|
||||
|
||||
|
||||
def build_font(manifest: dict[str, object], manifest_dir: Path, icons: list[dict[str, object]]) -> Path:
|
||||
family = str(manifest.get("fontFamily", "GopeedIcons"))
|
||||
units_per_em = parse_number(manifest.get("unitsPerEm", 1024), "unitsPerEm")
|
||||
ascent = parse_number(manifest.get("ascent", 896), "ascent")
|
||||
descent = parse_number(manifest.get("descent", -128), "descent")
|
||||
padding = parse_number(manifest.get("padding", 96), "padding")
|
||||
if ascent <= 0 or descent >= 0 or ascent - descent != units_per_em:
|
||||
raise ValueError("ascent must be positive, descent negative, and their span must equal unitsPerEm")
|
||||
if padding < 0 or padding * 2 >= units_per_em:
|
||||
raise ValueError("padding must leave positive drawing space")
|
||||
|
||||
glyph_order = [".notdef", *(str(icon["glyphName"]) for icon in icons)]
|
||||
glyphs = {}
|
||||
metrics = {".notdef": (units_per_em, 0)}
|
||||
empty_pen = TTGlyphPen(None)
|
||||
glyphs[".notdef"] = empty_pen.glyph()
|
||||
|
||||
for icon in icons:
|
||||
source = icon["sourcePath"]
|
||||
assert isinstance(source, Path)
|
||||
svg_text = source.read_text(encoding="utf-8")
|
||||
min_x, min_y, width, height = parse_view_box(svg_text, source)
|
||||
available = units_per_em - padding * 2
|
||||
scale = min(available / width, available / height)
|
||||
glyph_width = width * scale
|
||||
glyph_height = height * scale
|
||||
left = (units_per_em - glyph_width) / 2
|
||||
bottom = descent + (units_per_em - glyph_height) / 2
|
||||
transform = (scale, 0, 0, -scale, left - scale * min_x, bottom + glyph_height + scale * min_y)
|
||||
glyph_pen = TTGlyphPen(None)
|
||||
quadratic_pen = Cu2QuPen(glyph_pen, max_err=1.0, reverse_direction=False)
|
||||
transformed_pen = TransformPen(quadratic_pen, transform)
|
||||
SVGPath.fromstring(svg_text).draw(transformed_pen)
|
||||
glyphs[str(icon["glyphName"])] = glyph_pen.glyph()
|
||||
|
||||
bounds_pen = BoundsPen(None)
|
||||
SVGPath.fromstring(svg_text).draw(TransformPen(bounds_pen, transform))
|
||||
if bounds_pen.bounds is None:
|
||||
raise ValueError(f"{source}: icon produced no drawable bounds")
|
||||
metrics[str(icon["glyphName"])] = (units_per_em, round(bounds_pen.bounds[0]))
|
||||
|
||||
builder = FontBuilder(units_per_em, isTTF=True)
|
||||
builder.setupGlyphOrder(glyph_order)
|
||||
builder.setupCharacterMap({int(icon["codepoint"]): str(icon["glyphName"]) for icon in icons})
|
||||
builder.setupGlyf(glyphs)
|
||||
builder.setupHorizontalMetrics(metrics)
|
||||
builder.setupHorizontalHeader(ascent=ascent, descent=descent)
|
||||
version = str(manifest.get("version", "1.0.0"))
|
||||
postscript_name = re.sub(r"[^A-Za-z0-9-]", "", family.replace(" ", "-")) or "GopeedIcons"
|
||||
builder.setupNameTable(
|
||||
{
|
||||
"familyName": family,
|
||||
"styleName": "Regular",
|
||||
"uniqueFontIdentifier": f"{family};{version}",
|
||||
"fullName": family,
|
||||
"psName": postscript_name,
|
||||
"version": f"Version {version}",
|
||||
}
|
||||
)
|
||||
builder.setupOS2(
|
||||
sTypoAscender=ascent,
|
||||
sTypoDescender=descent,
|
||||
usWinAscent=ascent,
|
||||
usWinDescent=-descent,
|
||||
usWeightClass=400,
|
||||
usWidthClass=5,
|
||||
)
|
||||
builder.setupPost()
|
||||
builder.setupMaxp()
|
||||
|
||||
output = (manifest_dir / str(manifest["fontOutput"])).resolve()
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
builder.save(output)
|
||||
return output
|
||||
|
||||
|
||||
def write_dart(manifest: dict[str, object], manifest_dir: Path, icons: list[dict[str, object]]) -> Path:
|
||||
family = str(manifest.get("fontFamily", "GopeedIcons"))
|
||||
class_name = str(manifest.get("dartClass", "GopeedIcons"))
|
||||
if not DART_NAME_PATTERN.fullmatch(class_name):
|
||||
raise ValueError("dartClass must be a valid Dart class name")
|
||||
package = manifest.get("fontPackage")
|
||||
package_argument = "" if package in (None, "") else f", fontPackage: '{package}'"
|
||||
lines = [
|
||||
"// Generated by gopeed-file-category-icons. Do not edit by hand.",
|
||||
"import 'package:flutter/widgets.dart';",
|
||||
"",
|
||||
f"abstract final class {class_name} {{",
|
||||
f" static const String _fontFamily = '{family}';",
|
||||
]
|
||||
for icon in icons:
|
||||
lines.append(
|
||||
f" static const IconData {icon['dartName']} = IconData(0x{int(icon['codepoint']):04x}, fontFamily: _fontFamily{package_argument});"
|
||||
)
|
||||
lines.extend(["}", ""])
|
||||
output = (manifest_dir / str(manifest["dartOutput"])).resolve()
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text("\n".join(lines), encoding="utf-8")
|
||||
return output
|
||||
|
||||
|
||||
def main() -> int:
|
||||
args = parse_args()
|
||||
manifest_path = args.manifest.resolve()
|
||||
manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
|
||||
if allocate_codepoints(manifest, args.allocate_codepoints):
|
||||
manifest_path.write_text(json.dumps(manifest, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
|
||||
manifest_dir = manifest_path.parent
|
||||
icons = validate_icons(manifest, manifest_dir)
|
||||
for required in ("fontOutput", "dartOutput"):
|
||||
if not isinstance(manifest.get(required), str) or not manifest[required]:
|
||||
raise ValueError(f"manifest.{required} must be a path")
|
||||
font_output = build_font(manifest, manifest_dir, icons)
|
||||
dart_output = write_dart(manifest, manifest_dir, icons)
|
||||
print(f"Built {len(icons)} icons")
|
||||
print(f"Font: {font_output}")
|
||||
print(f"Dart: {dart_output}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
raise SystemExit(main())
|
||||
except (KeyError, OSError, ValueError, json.JSONDecodeError) as error:
|
||||
print(f"error: {error}", file=sys.stderr)
|
||||
raise SystemExit(1)
|
||||
@@ -0,0 +1,106 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Render a light/dark multi-size contact sheet for a generated file-category font."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
try:
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
except ImportError as error:
|
||||
raise SystemExit("Missing Pillow; install scripts/requirements.txt in the skill's .venv") from error
|
||||
|
||||
|
||||
def parse_number(value: object) -> int:
|
||||
return value if isinstance(value, int) else int(str(value), 0)
|
||||
|
||||
|
||||
def parse_args() -> argparse.Namespace:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--manifest", required=True, type=Path)
|
||||
parser.add_argument("--sizes", default="16,20,24,32")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def draw_centered(
|
||||
draw: ImageDraw.ImageDraw,
|
||||
center: tuple[float, float],
|
||||
char: str,
|
||||
font: ImageFont.FreeTypeFont,
|
||||
fill: str,
|
||||
) -> None:
|
||||
bounds = draw.textbbox((0, 0), char, font=font)
|
||||
height = bounds[3] - bounds[1]
|
||||
advance = draw.textlength(char, font=font)
|
||||
draw.text(
|
||||
(center[0] - advance / 2, center[1] - height / 2 - bounds[1]),
|
||||
char,
|
||||
font=font,
|
||||
fill=fill,
|
||||
)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
args = parse_args()
|
||||
manifest_path = args.manifest.resolve()
|
||||
manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
|
||||
manifest_dir = manifest_path.parent
|
||||
font_path = (manifest_dir / str(manifest["fontOutput"])).resolve()
|
||||
if not font_path.is_file():
|
||||
raise ValueError(f"font does not exist; run the builder first: {font_path}")
|
||||
sizes = [int(value) for value in args.sizes.split(",") if value.strip()]
|
||||
if not sizes or any(size <= 0 for size in sizes):
|
||||
raise ValueError("sizes must contain positive integers")
|
||||
icons = sorted(manifest["icons"], key=lambda icon: parse_number(icon["codepoint"]))
|
||||
|
||||
label_width = 210
|
||||
cell_width = 112
|
||||
header_height = 44
|
||||
row_height = 78
|
||||
image = Image.new(
|
||||
"RGB",
|
||||
(label_width + cell_width * len(sizes), header_height + row_height * len(icons)),
|
||||
"#F8FAFC",
|
||||
)
|
||||
draw = ImageDraw.Draw(image)
|
||||
label_font = ImageFont.load_default()
|
||||
draw.text((12, 15), "icon / codepoint", font=label_font, fill="#111827")
|
||||
for column, size in enumerate(sizes):
|
||||
x = label_width + column * cell_width
|
||||
draw.text((x + 42, 15), f"{size}px", font=label_font, fill="#111827")
|
||||
|
||||
for row, icon in enumerate(icons):
|
||||
y = header_height + row * row_height
|
||||
codepoint = parse_number(icon["codepoint"])
|
||||
draw.text(
|
||||
(12, y + 29),
|
||||
f"{icon['name']} U+{codepoint:04X}",
|
||||
font=label_font,
|
||||
fill="#111827",
|
||||
)
|
||||
for column, size in enumerate(sizes):
|
||||
x = label_width + column * cell_width
|
||||
midpoint = x + cell_width // 2
|
||||
draw.rectangle((x, y, midpoint, y + row_height), fill="#FFFFFF")
|
||||
draw.rectangle((midpoint, y, x + cell_width, y + row_height), fill="#111827")
|
||||
font = ImageFont.truetype(str(font_path), size=size)
|
||||
draw_centered(draw, (x + cell_width * 0.25, y + row_height / 2), chr(codepoint), font, "#111827")
|
||||
draw_centered(draw, (x + cell_width * 0.75, y + row_height / 2), chr(codepoint), font, "#F8FAFC")
|
||||
|
||||
output_value = manifest.get("previewOutput", "file-category-icons-preview.png")
|
||||
output = (manifest_dir / str(output_value)).resolve()
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
image.save(output)
|
||||
print(f"Preview: {output}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
raise SystemExit(main())
|
||||
except (KeyError, OSError, ValueError, json.JSONDecodeError) as error:
|
||||
print(f"error: {error}", file=sys.stderr)
|
||||
raise SystemExit(1)
|
||||
@@ -0,0 +1,2 @@
|
||||
fonttools==4.59.2
|
||||
Pillow==11.3.0
|
||||
@@ -0,0 +1,30 @@
|
||||
# 文件分类图标源物料
|
||||
|
||||
此目录是 Gopeed 文件分类图标的唯一源物料目录。它位于 Flutter 工程内,但只用于设计和生成流程,不得加入 `pubspec.yaml` 的 `assets` 配置。
|
||||
|
||||
## 维护限制
|
||||
|
||||
- 不要绕过 `$gopeed-file-category-icons` 技能直接修改、移动或批量替换这里的 SVG 与 manifest。
|
||||
- 需要调整图标时,必须配套使用该技能的安全区、码位兼容、字体生成和多尺寸预览流程。
|
||||
- 不要直接编辑生成的 `GopeedIcons.ttf` 或 `gopeed_icons.dart`。
|
||||
- 不要复用或重排 manifest 中已有的 codepoint。
|
||||
|
||||
## 目录内容
|
||||
|
||||
- `svg/`:24×24 的可编辑 SVG 源文件。
|
||||
- `manifest.json`:图标名称、SVG、稳定码位与产物路径的唯一映射。
|
||||
- `preview/`:生成的 16/20/24/32px 明暗预览,用于整套视觉审查。
|
||||
|
||||
## 生成产物
|
||||
|
||||
- Flutter 字体:`assets/fonts/GopeedIcons.ttf`
|
||||
- Flutter 常量:`lib/core/icons/gopeed_icons.dart`
|
||||
|
||||
所有修改都应遵循:
|
||||
|
||||
```text
|
||||
使用 $gopeed-file-category-icons 修改 SVG/manifest
|
||||
→ 重新生成完整 TTF 和 Dart 常量
|
||||
→ 检查多尺寸明暗预览
|
||||
→ 运行 Flutter 静态分析与测试
|
||||
```
|
||||
@@ -0,0 +1,130 @@
|
||||
{
|
||||
"fontFamily": "GopeedIcons",
|
||||
"fontOutput": "../../assets/fonts/GopeedIcons.ttf",
|
||||
"dartOutput": "../../lib/core/icons/gopeed_icons.dart",
|
||||
"previewOutput": "preview/gopeed_icons_preview.png",
|
||||
"dartClass": "GopeedIcons",
|
||||
"codepointStart": "0xE900",
|
||||
"unitsPerEm": 1024,
|
||||
"ascent": 896,
|
||||
"descent": -128,
|
||||
"padding": 0,
|
||||
"version": "1.3.2",
|
||||
"icons": [
|
||||
{
|
||||
"name": "protocol_bt",
|
||||
"source": "svg/protocol-bt.svg",
|
||||
"codepoint": "0xE900"
|
||||
},
|
||||
{
|
||||
"name": "protocol_ed2k",
|
||||
"source": "svg/protocol-ed2k.svg",
|
||||
"codepoint": "0xE901"
|
||||
},
|
||||
{
|
||||
"name": "folder",
|
||||
"source": "svg/folder.svg",
|
||||
"codepoint": "0xE902"
|
||||
},
|
||||
{
|
||||
"name": "folder_bt",
|
||||
"source": "svg/folder-bt.svg",
|
||||
"codepoint": "0xE903"
|
||||
},
|
||||
{
|
||||
"name": "file",
|
||||
"source": "svg/file.svg",
|
||||
"codepoint": "0xE904"
|
||||
},
|
||||
{
|
||||
"name": "file_installer",
|
||||
"source": "svg/file-installer.svg",
|
||||
"codepoint": "0xE905"
|
||||
},
|
||||
{
|
||||
"name": "file_android",
|
||||
"source": "svg/file-android.svg",
|
||||
"codepoint": "0xE906"
|
||||
},
|
||||
{
|
||||
"name": "file_ios",
|
||||
"source": "svg/file-ios.svg",
|
||||
"codepoint": "0xE907"
|
||||
},
|
||||
{
|
||||
"name": "file_disk_image",
|
||||
"source": "svg/file-disk-image.svg",
|
||||
"codepoint": "0xE908"
|
||||
},
|
||||
{
|
||||
"name": "file_web",
|
||||
"source": "svg/file-web.svg",
|
||||
"codepoint": "0xE909"
|
||||
},
|
||||
{
|
||||
"name": "file_text",
|
||||
"source": "svg/file-text.svg",
|
||||
"codepoint": "0xE90A"
|
||||
},
|
||||
{
|
||||
"name": "file_pdf",
|
||||
"source": "svg/file-pdf.svg",
|
||||
"codepoint": "0xE90B"
|
||||
},
|
||||
{
|
||||
"name": "file_document",
|
||||
"source": "svg/file-document.svg",
|
||||
"codepoint": "0xE90C"
|
||||
},
|
||||
{
|
||||
"name": "file_spreadsheet",
|
||||
"source": "svg/file-spreadsheet.svg",
|
||||
"codepoint": "0xE90D"
|
||||
},
|
||||
{
|
||||
"name": "file_presentation",
|
||||
"source": "svg/file-presentation.svg",
|
||||
"codepoint": "0xE90E"
|
||||
},
|
||||
{
|
||||
"name": "file_archive",
|
||||
"source": "svg/file-archive.svg",
|
||||
"codepoint": "0xE90F"
|
||||
},
|
||||
{
|
||||
"name": "file_image",
|
||||
"source": "svg/file-image.svg",
|
||||
"codepoint": "0xE910"
|
||||
},
|
||||
{
|
||||
"name": "file_audio",
|
||||
"source": "svg/file-audio.svg",
|
||||
"codepoint": "0xE911"
|
||||
},
|
||||
{
|
||||
"name": "file_video",
|
||||
"source": "svg/file-video.svg",
|
||||
"codepoint": "0xE912"
|
||||
},
|
||||
{
|
||||
"name": "file_code",
|
||||
"source": "svg/file-code.svg",
|
||||
"codepoint": "0xE913"
|
||||
},
|
||||
{
|
||||
"name": "file_ebook",
|
||||
"source": "svg/file-ebook.svg",
|
||||
"codepoint": "0xE914"
|
||||
},
|
||||
{
|
||||
"name": "file_font",
|
||||
"source": "svg/file-font.svg",
|
||||
"codepoint": "0xE915"
|
||||
},
|
||||
{
|
||||
"name": "file_database",
|
||||
"source": "svg/file-database.svg",
|
||||
"codepoint": "0xE916"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
After Width: | Height: | Size: 94 KiB |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M3 2H14V3.5H4.5V20.5H19.5V8H21V22H3V2ZM13.25 2H14.5L21 8.5V9.75H19.75L13.25 3.25V2Z"/>
|
||||
<path d="M8.15 10.2L9.25 9.5L10.15 10.9C10.72 10.65 11.35 10.5 12 10.5C12.65 10.5 13.28 10.65 13.85 10.9L14.75 9.5L15.85 10.2L14.95 11.6C15.62 12.22 16 13.05 16 14V18.5H8V14C8 13.05 8.38 12.22 9.05 11.6L8.15 10.2ZM9.5 14V17H14.5V14C14.5 12.9 13.38 12 12 12C10.62 12 9.5 12.9 9.5 14ZM9.75 13.75H11.25V15.25H9.75V13.75ZM12.75 13.75H14.25V15.25H12.75V13.75Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 526 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M3 2H14V3.5H4.5V20.5H19.5V8H21V22H3V2ZM13.25 2H14.5L21 8.5V9.75H19.75L13.25 3.25V2Z"/>
|
||||
<path d="M10.25 9.5H12V11H10.25V9.5ZM12 11H13.75V12.5H12V11ZM10.25 12.5H12V14H10.25V12.5ZM12 14H13.75V15.5H12V14ZM10 15.75H14V17.25H13.5L13 18.75H11L10.5 17.25H10V15.75ZM11.5 16.75L11.85 17.75H12.15L12.5 16.75H11.5Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 387 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M3 2H14V3.5H4.5V20.5H19.5V8H21V22H3V2ZM13.25 2H14.5L21 8.5V9.75H19.75L13.25 3.25V2Z"/>
|
||||
<path d="M11 9.75H16.5V11.5H12.75V16C12.75 17.52 11.52 18.75 10 18.75C8.48 18.75 7.25 17.75 7.25 16.5C7.25 15.25 8.48 14.25 10 14.25C10.35 14.25 10.69 14.3 11 14.42V9.75Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 342 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M3 2H14V3.5H4.5V20.5H19.5V8H21V22H3V2ZM13.25 2H14.5L21 8.5V9.75H19.75L13.25 3.25V2Z"/>
|
||||
<path d="M10.25 10L11.5 11.25L9 13.75L11.5 16.25L10.25 17.5L6.5 13.75L10.25 10ZM13.75 10L17.5 13.75L13.75 17.5L12.5 16.25L15 13.75L12.5 11.25L13.75 10Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 323 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M3 2H14V3.5H4.5V20.5H19.5V8H21V22H3V2ZM13.25 2H14.5L21 8.5V9.75H19.75L13.25 3.25V2Z"/>
|
||||
<path d="M7.75 11C7.75 10.17 9.65 9.5 12 9.5C14.35 9.5 16.25 10.17 16.25 11C16.25 11.83 14.35 12.5 12 12.5C9.65 12.5 7.75 11.83 7.75 11ZM7.75 13C8.82 13.65 10.2 13.95 12 13.95C13.8 13.95 15.18 13.65 16.25 13V15C16.25 15.83 14.35 16.5 12 16.5C9.65 16.5 7.75 15.83 7.75 15V13ZM7.75 16.75C8.82 17.4 10.2 17.7 12 17.7C13.8 17.7 15.18 17.4 16.25 16.75V17.25C16.25 18.08 14.35 18.75 12 18.75C9.65 18.75 7.75 18.08 7.75 17.25V16.75Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 597 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M3 2H14V3.5H4.5V20.5H19.5V8H21V22H3V2ZM13.25 2H14.5L21 8.5V9.75H19.75L13.25 3.25V2Z"/>
|
||||
<path d="M12 9.5C14.49 9.5 16.5 11.51 16.5 14C16.5 16.49 14.49 18.5 12 18.5C9.51 18.5 7.5 16.49 7.5 14C7.5 11.51 9.51 9.5 12 9.5ZM12 12.75C11.31 12.75 10.75 13.31 10.75 14C10.75 14.69 11.31 15.25 12 15.25C12.69 15.25 13.25 14.69 13.25 14C13.25 13.31 12.69 12.75 12 12.75ZM13.2 12.2L13.5 13.5L15.85 12.5L15.2 11.3L13.2 12.2Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 495 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M3 2H14V3.5H4.5V20.5H19.5V8H21V22H3V2ZM13.25 2H14.5L21 8.5V9.75H19.75L13.25 3.25V2Z"/>
|
||||
<path d="M7.5 10H13.5V11.5H7.5V10ZM7.5 12.75H16.5V14H7.5V12.75ZM7.5 15.13H15V16.38H7.5V15.13ZM7.5 17.5H12V18.75H7.5V17.5Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 293 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M3 2H14V3.5H4.5V20.5H19.5V8H21V22H3V2ZM13.25 2H14.5L21 8.5V9.75H19.75L13.25 3.25V2Z"/>
|
||||
<path d="M6.75 9.75L11.25 10.75V19L6.75 18V9.75ZM8.25 11.65V16.8L9.75 17.15V11.98L8.25 11.65ZM12.75 10.75L17.25 9.75V18L12.75 19V10.75ZM14.25 11.98V17.15L15.75 16.8V11.65L14.25 11.98Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 355 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M3 2H14V3.5H4.5V20.5H19.5V8H21V22H3V2ZM13.25 2H14.5L21 8.5V9.75H19.75L13.25 3.25V2Z"/>
|
||||
<path d="M10.5 9.75H13.5L16.75 18.5H14.65L14.05 16.75H9.95L9.35 18.5H7.25L10.5 9.75ZM12 11.25L10.55 15.25H13.45L12 11.25Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 293 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M3 2H14V3.5H4.5V20.5H19.5V8H21V22H3V2ZM13.25 2H14.5L21 8.5V9.75H19.75L13.25 3.25V2Z"/>
|
||||
<path d="M14.75 9.75C15.58 9.75 16.25 10.42 16.25 11.25C16.25 12.08 15.58 12.75 14.75 12.75C13.92 12.75 13.25 12.08 13.25 11.25C13.25 10.42 13.92 9.75 14.75 9.75ZM7.25 18.5L10.75 13.75L12.5 15.75L14.25 13.5L17.25 18.5H7.25Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 395 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M3 2H14V3.5H4.5V20.5H19.5V8H21V22H3V2ZM13.25 2H14.5L21 8.5V9.75H19.75L13.25 3.25V2Z"/>
|
||||
<path d="M11.1 9.5H12.9V13.5H15L12 16.5L9 13.5H11.1V9.5ZM7.75 17H16.25V18.5H7.75V17Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 256 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M3 2H14V3.5H4.5V20.5H19.5V8H21V22H3V2ZM13.25 2H14.5L21 8.5V9.75H19.75L13.25 3.25V2Z"/>
|
||||
<path d="M8.5 9.5H15.5V18.75H8.5V9.5ZM10 11V16.25H14V11H10ZM11.25 17V18.25H12.75V17H11.25Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 262 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M3 2H14V3.5H4.5V20.5H19.5V8H21V22H3V2ZM13.25 2H14.5L21 8.5V9.75H19.75L13.25 3.25V2Z"/>
|
||||
<path d="M11.1 9.5H12.75C12.85 11.18 13.22 12.6 13.9 13.86L12.45 14.5C11.62 13 11.2 11.38 11.1 9.5ZM12.05 13.45L12.9 14.9C11.35 15.36 10.08 16.02 8.6 17.12L7.3 16.05C8.98 14.82 10.44 14.06 12.05 13.45ZM13.25 13.12L14.55 12.25C15.38 13.52 16.3 14.35 17.55 15.05L16.9 16.58C15.28 15.7 14.12 14.64 13.25 13.12Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 479 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M3 2H14V3.5H4.5V20.5H19.5V8H21V22H3V2ZM13.25 2H14.5L21 8.5V9.75H19.75L13.25 3.25V2Z"/>
|
||||
<path d="M12.75 9.5C15.12 9.82 16.93 11.68 17.25 14H12.75V9.5ZM11.25 11.25V15.5H15.5C15.13 17.38 13.43 18.75 11.25 18.75C8.77 18.75 6.75 17.07 6.75 15C6.75 13.02 8.68 11.55 11.25 11.25Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 357 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M3 2H14V3.5H4.5V20.5H19.5V8H21V22H3V2ZM13.25 2H14.5L21 8.5V9.75H19.75L13.25 3.25V2Z"/>
|
||||
<path d="M7.5 10H16.5V11.5H7.5V10ZM7.5 11.5H8.75V17.25H11.38V11.5H12.63V17.25H15.25V11.5H16.5V18.5H7.5V11.5ZM8.75 13.88H15.25V15.13H8.75V13.88Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 315 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M3 2H14V3.5H4.5V20.5H19.5V8H21V22H3V2ZM13.25 2H14.5L21 8.5V9.75H19.75L13.25 3.25V2Z"/>
|
||||
<path d="M7.75 10H16.25V11.5H12.88V18.5H11.13V11.5H7.75V10Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 231 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M3 2H14V3.5H4.5V20.5H19.5V8H21V22H3V2ZM13.25 2H14.5L21 8.5V9.75H19.75L13.25 3.25V2Z"/>
|
||||
<path d="M7.25 10.75H14.5V17.75H7.25V10.75ZM8.75 12.25V16.25H13V12.25H8.75ZM14.25 12.6L17.5 10.85V17.65L14.25 15.9V12.6Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 292 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M3 2H14V3.5H4.5V20.5H19.5V8H21V22H3V2ZM13.25 2H14.5L21 8.5V9.75H19.75L13.25 3.25V2Z"/>
|
||||
<path d="M12 9.5C14.49 9.5 16.5 11.51 16.5 14C16.5 16.49 14.49 18.5 12 18.5C9.51 18.5 7.5 16.49 7.5 14C7.5 11.51 9.51 9.5 12 9.5ZM12 11C10.34 11 9 12.34 9 14C9 15.66 10.34 17 12 17C13.66 17 15 15.66 15 14C15 12.34 13.66 11 12 11ZM11.25 10.5H12.75V17.5H11.25V10.5ZM8.5 13.25H15.5V14.75H8.5V13.25Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 467 B |
@@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M3 2H14V3.5H4.5V20.5H19.5V8H21V22H3V2ZM13.25 2H14.5L21 8.5V9.75H19.75L13.25 3.25V2Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 166 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M2 4C2 3.17 2.67 2.5 3.5 2.5H9.25L11.25 4.5H20.5C21.33 4.5 22 5.17 22 6V6.75H2V4ZM2 5.75H3.5V20H20.5V5.75H22V20.5C22 21.05 21.55 21.5 21 21.5H3C2.45 21.5 2 21.05 2 20.5V5.75Z"/>
|
||||
<path d="M7.5 9.25H9.75V11H7.5V9.25ZM14.25 9.25H16.5V11H14.25V9.25ZM8 10.5H9.75V14C9.75 15.5 10.55 16.5 12 16.5C13.45 16.5 14.25 15.5 14.25 14V10.5H16V14C16 16.6 14.4 18.25 12 18.25C9.6 18.25 8 16.6 8 14V10.5Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 472 B |
@@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M2 4C2 3.17 2.67 2.5 3.5 2.5H9.25L11.25 4.5H20.5C21.33 4.5 22 5.17 22 6V6.75H2V4ZM2 5.75H3.5V20H20.5V5.75H22V20.5C22 21.05 21.55 21.5 21 21.5H3C2.45 21.5 2 21.05 2 20.5V5.75Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 257 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M3 2H14V3.5H4.5V20.5H19.5V8H21V22H3V2ZM13.25 2H14.5L21 8.5V9.75H19.75L13.25 3.25V2Z"/>
|
||||
<path d="M7.5 9.5H9.75V11.25H7.5V9.5ZM14.25 9.5H16.5V11.25H14.25V9.5ZM8 10.75H9.75V14C9.75 15.5 10.55 16.5 12 16.5C13.45 16.5 14.25 15.5 14.25 14V10.75H16V14C16 16.6 14.4 18.25 12 18.25C9.6 18.25 8 16.6 8 14V10.75Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 386 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||
<path d="M3 2H14V3.5H4.5V20.5H19.5V8H21V22H3V2ZM13.25 2H14.5L21 8.5V9.75H19.75L13.25 3.25V2Z"/>
|
||||
<path d="M11.25 11.45L9.05 15.35L7.75 14.6L10.05 10.6L11.25 11.45ZM12.75 11.45L13.95 10.6L16.25 14.6L14.95 15.35L12.75 11.45ZM12 9.25C13.1 9.25 14 10.15 14 11.25C14 12.35 13.1 13.25 12 13.25C10.9 13.25 10 12.35 10 11.25C10 10.15 10.9 9.25 12 9.25ZM8.25 14.75C9.35 14.75 10.25 15.65 10.25 16.75C10.25 17.85 9.35 18.75 8.25 18.75C7.15 18.75 6.25 17.85 6.25 16.75C6.25 15.65 7.15 14.75 8.25 14.75ZM15.75 14.75C16.85 14.75 17.75 15.65 17.75 16.75C17.75 17.85 16.85 18.75 15.75 18.75C14.65 18.75 13.75 17.85 13.75 16.75C13.75 15.65 14.65 14.75 15.75 14.75Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 723 B |
@@ -29,7 +29,6 @@ import '../../../../shared/theme/app_design_tokens.dart';
|
||||
import '../../../../shared/theme/app_palette.dart';
|
||||
import '../../../../shared/widgets/app_choice_segmented_control.dart';
|
||||
import '../../../../shared/widgets/app_http_headers_editor.dart';
|
||||
import '../../../../shared/widgets/app_loading_button.dart';
|
||||
import '../../../../shared/widgets/app_number_input.dart';
|
||||
import '../../../../shared/widgets/app_path_picker_field.dart';
|
||||
import '../../../../shared/widgets/app_text_field.dart';
|
||||
@@ -38,8 +37,8 @@ import '../../../../shared/widgets/app_toast.dart';
|
||||
import '../../../../l10n/l10n.dart';
|
||||
import '../../../../util/util.dart';
|
||||
import '../../application/pending_create_task.dart';
|
||||
import '../widgets/create_task_action_buttons.dart';
|
||||
import '../widgets/resolve_file_tree.dart';
|
||||
import '../widgets/resolve_task_actions.dart';
|
||||
|
||||
class CreateTaskWindowPage extends ConsumerStatefulWidget {
|
||||
const CreateTaskWindowPage({super.key, this.windowController, this.initialTask});
|
||||
@@ -696,17 +695,14 @@ class _CreateTaskWindowPageState extends ConsumerState<CreateTaskWindowPage> {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SecondaryButton(
|
||||
onPressed: _creating ? null : _closeWindow,
|
||||
child: SizedBox(width: 68, child: Center(child: Text(context.l10n.cancel))),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
AppLoadingButton(
|
||||
key: const ValueKey('create-task-confirm-button'),
|
||||
onPressed: _confirm,
|
||||
loading: _creating,
|
||||
variant: AppLoadingButtonVariant.primary,
|
||||
child: SizedBox(width: 68, child: Center(child: Text(context.l10n.confirm))),
|
||||
CreateTaskActionButtons(
|
||||
submitting: _creating,
|
||||
onCancel: _closeWindow,
|
||||
onSubmit: _confirm,
|
||||
cancelLabel: context.l10n.cancel,
|
||||
submitLabel: context.l10n.confirm,
|
||||
cancelButtonKey: const ValueKey('create-task-cancel-button'),
|
||||
submitButtonKey: const ValueKey('create-task-confirm-button'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -1159,10 +1155,14 @@ class _CreateTaskWindowPageState extends ConsumerState<CreateTaskWindowPage> {
|
||||
),
|
||||
actions: [
|
||||
flutter.Flexible(
|
||||
child: ResolveTaskActions(
|
||||
child: CreateTaskActionButtons(
|
||||
submitting: submitting,
|
||||
onCancel: () => closeOverlay(dialogContext, false),
|
||||
onCreate: submit,
|
||||
onSubmit: submit,
|
||||
cancelLabel: dialogContext.l10n.cancel,
|
||||
submitLabel: dialogContext.l10n.createAction,
|
||||
cancelButtonKey: const ValueKey('resolve-cancel-button'),
|
||||
submitButtonKey: const ValueKey('resolve-create-button'),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -1205,7 +1205,7 @@ class _CreateTaskWindowPageState extends ConsumerState<CreateTaskWindowPage> {
|
||||
width: contentWidth,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(child: Text(dialogContext.l10n.createHistory)),
|
||||
Expanded(child: Text(dialogContext.l10n.historyLinks)),
|
||||
AppTooltip(
|
||||
message: dialogContext.l10n.clearHistory,
|
||||
child: GhostButton(
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
import 'package:flutter/widgets.dart' as flutter;
|
||||
import 'package:shadcn_flutter/shadcn_flutter.dart';
|
||||
|
||||
import '../../../../shared/theme/app_design_tokens.dart';
|
||||
import '../../../../shared/widgets/app_loading_button.dart';
|
||||
|
||||
class CreateTaskActionButtons extends StatelessWidget {
|
||||
const CreateTaskActionButtons({
|
||||
super.key,
|
||||
required this.submitting,
|
||||
required this.onCancel,
|
||||
required this.onSubmit,
|
||||
required this.cancelLabel,
|
||||
required this.submitLabel,
|
||||
this.cancelButtonKey,
|
||||
this.submitButtonKey,
|
||||
});
|
||||
|
||||
final bool submitting;
|
||||
final VoidCallback onCancel;
|
||||
final VoidCallback onSubmit;
|
||||
final String cancelLabel;
|
||||
final String submitLabel;
|
||||
final Key? cancelButtonKey;
|
||||
final Key? submitButtonKey;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return flutter.Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SecondaryButton(
|
||||
key: cancelButtonKey,
|
||||
onPressed: submitting ? null : onCancel,
|
||||
child: SizedBox(
|
||||
width: _actionContentWidth,
|
||||
child: Center(child: Text(cancelLabel)),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: AppDesignTokens.space12),
|
||||
AppLoadingButton(
|
||||
key: submitButtonKey,
|
||||
onPressed: onSubmit,
|
||||
loading: submitting,
|
||||
variant: AppLoadingButtonVariant.primary,
|
||||
child: SizedBox(
|
||||
width: _actionContentWidth,
|
||||
child: Center(child: Text(submitLabel)),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const _actionContentWidth = 68.0;
|
||||
@@ -189,42 +189,48 @@ class _TreeFooter extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final palette = AppPalette.of(context);
|
||||
final filters = _FileTypeFilterGroup(
|
||||
videoActive: activeTypeFilters.contains(_FileTypeFilter.video),
|
||||
audioActive: activeTypeFilters.contains(_FileTypeFilter.audio),
|
||||
imageActive: activeTypeFilters.contains(_FileTypeFilter.image),
|
||||
onSelectVideo: onSelectVideo,
|
||||
onSelectAudio: onSelectAudio,
|
||||
onSelectImage: onSelectImage,
|
||||
final filters = KeyedSubtree(
|
||||
key: const ValueKey('resolve-tree-filters'),
|
||||
child: _FileTypeFilterGroup(
|
||||
videoActive: activeTypeFilters.contains(_FileTypeFilter.video),
|
||||
audioActive: activeTypeFilters.contains(_FileTypeFilter.audio),
|
||||
imageActive: activeTypeFilters.contains(_FileTypeFilter.image),
|
||||
onSelectVideo: onSelectVideo,
|
||||
onSelectAudio: onSelectAudio,
|
||||
onSelectImage: onSelectImage,
|
||||
),
|
||||
);
|
||||
final stats = Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
final statsStyle = TextStyle(color: palette.textSecondary, fontSize: 12, fontWeight: FontWeight.w600);
|
||||
final selectedLabel = context.l10n.selectedCount(selectedCount, totalCount);
|
||||
final sizeLabel = unknownSize ? context.l10n.unknownSize : Util.fmtByte(selectedSize);
|
||||
final baseline = MediaQuery.textScalerOf(context).scale(statsStyle.fontSize!);
|
||||
final stats = Wrap(
|
||||
key: const ValueKey('resolve-tree-selection-stats'),
|
||||
alignment: WrapAlignment.end,
|
||||
spacing: AppDesignTokens.space8,
|
||||
runSpacing: AppDesignTokens.space4,
|
||||
crossAxisAlignment: WrapCrossAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
context.l10n.selectedCount(selectedCount, totalCount),
|
||||
style: TextStyle(color: palette.textSecondary, fontSize: 12, fontWeight: FontWeight.w600),
|
||||
Baseline(
|
||||
baseline: baseline,
|
||||
baselineType: TextBaseline.alphabetic,
|
||||
child: Text(key: const ValueKey('resolve-tree-selected-count'), selectedLabel, style: statsStyle),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
unknownSize ? context.l10n.unknownSize : Util.fmtByte(selectedSize),
|
||||
style: TextStyle(color: palette.textSecondary, fontSize: 12, fontWeight: FontWeight.w600),
|
||||
Baseline(
|
||||
baseline: baseline,
|
||||
baselineType: TextBaseline.alphabetic,
|
||||
child: Text(key: const ValueKey('resolve-tree-selected-size'), sizeLabel, style: statsStyle),
|
||||
),
|
||||
],
|
||||
);
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
if (constraints.maxWidth < 360) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Align(alignment: Alignment.centerLeft, child: filters),
|
||||
const SizedBox(height: 4),
|
||||
Align(alignment: Alignment.centerRight, child: stats),
|
||||
],
|
||||
);
|
||||
}
|
||||
return Row(crossAxisAlignment: CrossAxisAlignment.center, children: [filters, const Spacer(), stats]);
|
||||
},
|
||||
|
||||
return OverflowBar(
|
||||
key: const ValueKey('resolve-tree-footer'),
|
||||
spacing: AppDesignTokens.space8,
|
||||
alignment: MainAxisAlignment.spaceBetween,
|
||||
overflowAlignment: OverflowBarAlignment.end,
|
||||
overflowSpacing: AppDesignTokens.space4,
|
||||
children: [filters, stats],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -290,7 +296,11 @@ class _FilterDivider extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(width: 1, height: 18, child: ColoredBox(color: color));
|
||||
return SizedBox(
|
||||
width: _fileTypeFilterDividerWidth,
|
||||
height: 18,
|
||||
child: ColoredBox(color: color),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,7 +315,7 @@ class _FilterButton extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final palette = AppPalette.of(context);
|
||||
return SizedBox(
|
||||
width: 40,
|
||||
width: _fileTypeFilterButtonWidth,
|
||||
height: 28,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(color: active ? palette.filterActiveBg : null),
|
||||
@@ -340,3 +350,5 @@ const _audioExts = <String>{'mp3', 'flac', 'wav', 'aac', 'm4a', 'ogg', 'ape'};
|
||||
const _imageExts = <String>{'jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg'};
|
||||
const _resolveTreeRowHeight = 36.0;
|
||||
const _resolveFileNameStyle = TextStyle(fontSize: 14, height: 1.25);
|
||||
const _fileTypeFilterButtonWidth = 40.0;
|
||||
const _fileTypeFilterDividerWidth = 1.0;
|
||||
@@ -1,50 +0,0 @@
|
||||
import 'package:shadcn_flutter/shadcn_flutter.dart';
|
||||
import 'package:flutter/widgets.dart' as flutter;
|
||||
|
||||
import '../../../../l10n/l10n.dart';
|
||||
import '../../../../shared/theme/app_design_tokens.dart';
|
||||
import '../../../../shared/widgets/app_loading_button.dart';
|
||||
|
||||
class ResolveTaskActions extends StatelessWidget {
|
||||
const ResolveTaskActions({super.key, required this.submitting, required this.onCancel, required this.onCreate});
|
||||
|
||||
final bool submitting;
|
||||
final VoidCallback onCancel;
|
||||
final VoidCallback onCreate;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Size both actions from the wider translated label, including while the
|
||||
// create button replaces its label with a loader.
|
||||
return IntrinsicWidth(
|
||||
child: flutter.Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
flutter.Expanded(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(minWidth: AppDesignTokens.dialogActionMinWidth),
|
||||
child: SecondaryButton(
|
||||
key: const ValueKey('resolve-cancel-button'),
|
||||
onPressed: submitting ? null : onCancel,
|
||||
child: Text(context.l10n.cancel, maxLines: 1, softWrap: false),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: AppDesignTokens.space8),
|
||||
flutter.Expanded(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(minWidth: AppDesignTokens.dialogActionMinWidth),
|
||||
child: AppLoadingButton(
|
||||
key: const ValueKey('resolve-create-button'),
|
||||
onPressed: onCreate,
|
||||
loading: submitting,
|
||||
variant: AppLoadingButtonVariant.primary,
|
||||
child: Text(context.l10n.createAction, maxLines: 1, softWrap: false),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -353,7 +353,7 @@
|
||||
"resolvedFileCount": "{count}",
|
||||
"resourceHasNoFiles": "ولا توجد في هذا المورد قائمة ملف قابلة للاختيار",
|
||||
"noFiles": "لا توجد ملفات",
|
||||
"createHistory": "تاريخ الخلق",
|
||||
"historyLinks": "روابط السجل",
|
||||
"noHistory": "لا تاريخ",
|
||||
"directDownloadDescription": "حل المشاكل وخلق المهام على الفور",
|
||||
"taskProgress": "التقدم المحرز",
|
||||
|
||||
@@ -367,7 +367,7 @@
|
||||
"resolvedFileCount": "{count} fayl tapıldı",
|
||||
"resourceHasNoFiles": "Bu resursda seçilə bilən fayl siyahısı yoxdur",
|
||||
"noFiles": "Fayl yoxdur",
|
||||
"createHistory": "Tarixçə Yarat",
|
||||
"historyLinks": "Tarixçə keçidləri",
|
||||
"noHistory": "Tarixçə yoxdur",
|
||||
"directDownloadDescription": "Təhlili keç və tapşırıqları dərhal yarat",
|
||||
"taskProgress": "Tapşırığın irəliləyişi",
|
||||
|
||||
@@ -353,7 +353,7 @@
|
||||
"resolvedFileCount": "{count}",
|
||||
"resourceHasNoFiles": "El recurs no té cap llista de fitxers per seleccionar",
|
||||
"noFiles": "Sense fitxers",
|
||||
"createHistory": "Crea un historial",
|
||||
"historyLinks": "Enllaços de l'historial",
|
||||
"noHistory": "Sense historial",
|
||||
"directDownloadDescription": "Omet la resolució i crea les tasques immediatament",
|
||||
"taskProgress": "Progrés de la tasca",
|
||||
|
||||
@@ -353,7 +353,7 @@
|
||||
"resolvedFileCount": "{count}-Dateien behoben",
|
||||
"resourceHasNoFiles": "Die Ressource verfügt über keine auswählbare Dateiliste",
|
||||
"noFiles": "Keine Dateien",
|
||||
"createHistory": "Verlauf erstellen",
|
||||
"historyLinks": "Verlaufslinks",
|
||||
"noHistory": "Keine Historie",
|
||||
"directDownloadDescription": "Überspringen Sie die Lösung und erstellen Sie sofort Aufgaben",
|
||||
"taskProgress": "Aufgabenfortschritt",
|
||||
|
||||
@@ -367,7 +367,7 @@
|
||||
"resolvedFileCount": "{count, plural, =1{1 file resolved} other{{count} files resolved}}",
|
||||
"resourceHasNoFiles": "The resource has no selectable file list",
|
||||
"noFiles": "No files",
|
||||
"createHistory": "Create History",
|
||||
"historyLinks": "History Links",
|
||||
"noHistory": "No history",
|
||||
"directDownloadDescription": "Skip resolving and create tasks immediately",
|
||||
"taskProgress": "Task progress",
|
||||
|
||||
@@ -353,7 +353,7 @@
|
||||
"resolvedFileCount": "{count} resueltos",
|
||||
"resourceHasNoFiles": "El recurso no tiene lista de archivos seleccionable",
|
||||
"noFiles": "No hay archivos",
|
||||
"createHistory": "Crear historia",
|
||||
"historyLinks": "Enlaces del historial",
|
||||
"noHistory": "No hay historia",
|
||||
"directDownloadDescription": "Saltar a resolver y crear tareas inmediatamente",
|
||||
"taskProgress": "Progresos en la tarea",
|
||||
|
||||
@@ -353,7 +353,7 @@
|
||||
"resolvedFileCount": "{count} فایل شناسایی شد",
|
||||
"resourceHasNoFiles": "منبع هیچ لیست فایل قابل انتخاب ندارد",
|
||||
"noFiles": "فایل ها",
|
||||
"createHistory": "ایجاد تاریخ",
|
||||
"historyLinks": "پیوندهای تاریخچه",
|
||||
"noHistory": "تاریخ",
|
||||
"directDownloadDescription": "پیاده سازی و ایجاد وظایف بلافاصله",
|
||||
"taskProgress": "پیشرفت شغلی",
|
||||
|
||||
@@ -353,7 +353,7 @@
|
||||
"resolvedFileCount": "{count} résolus",
|
||||
"resourceHasNoFiles": "La ressource n'a pas de liste de fichiers sélectionnable",
|
||||
"noFiles": "Aucun fichier",
|
||||
"createHistory": "Créer l'historique",
|
||||
"historyLinks": "Liens de l'historique",
|
||||
"noHistory": "Pas d'histoire",
|
||||
"directDownloadDescription": "Sautez la résolution et créez immédiatement des tâches",
|
||||
"taskProgress": "Progrès accomplis dans la tâche",
|
||||
|
||||
@@ -353,7 +353,7 @@
|
||||
"resolvedFileCount": "{count} fájlok megoldva",
|
||||
"resourceHasNoFiles": "Az erőforrásnak nincs kiválasztható fájllistája",
|
||||
"noFiles": "Nincsenek fájlok",
|
||||
"createHistory": "Készítsen előzményeket",
|
||||
"historyLinks": "Előzményhivatkozások",
|
||||
"noHistory": "Nincs előzmény",
|
||||
"directDownloadDescription": "Hagyja ki a megoldást, és azonnal hozzon létre feladatokat",
|
||||
"taskProgress": "A feladat előrehaladása",
|
||||
|
||||
@@ -353,7 +353,7 @@
|
||||
"resolvedFileCount": "{count} terselesaikan",
|
||||
"resourceHasNoFiles": "Sumber daya tidak memiliki daftar berkas yang dapat dipilih",
|
||||
"noFiles": "Tidak ada berkas",
|
||||
"createHistory": "Buat Riwayat",
|
||||
"historyLinks": "Tautan Riwayat",
|
||||
"noHistory": "Tidak ada sejarah",
|
||||
"directDownloadDescription": "Lewatkan pemecahan dan buat tugas segera",
|
||||
"taskProgress": "Kemajuan tugas",
|
||||
|
||||
@@ -353,7 +353,7 @@
|
||||
"resolvedFileCount": "{count} risolti",
|
||||
"resourceHasNoFiles": "La risorsa non ha un elenco di file selezionabile",
|
||||
"noFiles": "Nessun file",
|
||||
"createHistory": "Creare la storia",
|
||||
"historyLinks": "Link della cronologia",
|
||||
"noHistory": "Nessuna storia",
|
||||
"directDownloadDescription": "Salta la risoluzione e crea immediatamente i compiti",
|
||||
"taskProgress": "Prospettive di attività",
|
||||
|
||||
@@ -353,7 +353,7 @@
|
||||
"resolvedFileCount": "{count} ファイルが解決しました",
|
||||
"resourceHasNoFiles": "リソースには、選択可能なファイルリストはありません",
|
||||
"noFiles": "ファイルがない場合",
|
||||
"createHistory": "歴史を創造する",
|
||||
"historyLinks": "履歴リンク",
|
||||
"noHistory": "歴史なし",
|
||||
"directDownloadDescription": "解決をスキップし、すぐにタスクを作成",
|
||||
"taskProgress": "タスクの進捗",
|
||||
|
||||
@@ -353,7 +353,7 @@
|
||||
"resolvedFileCount": "{count} 파일 해결",
|
||||
"resourceHasNoFiles": "리소스에는 선택 가능한 파일 목록이 없습니다",
|
||||
"noFiles": "파일 없음",
|
||||
"createHistory": "회사연혁",
|
||||
"historyLinks": "기록 링크",
|
||||
"noHistory": "의 역사",
|
||||
"directDownloadDescription": "재해를 드리며 즉시 업무를 만듭니다",
|
||||
"taskProgress": "작업 진행",
|
||||
|
||||
@@ -353,7 +353,7 @@
|
||||
"resolvedFileCount": "{count} plików rozwiązanych",
|
||||
"resourceHasNoFiles": "Zasób nie ma listy plików do wyboru",
|
||||
"noFiles": "Brak plików",
|
||||
"createHistory": "Utwórz historię",
|
||||
"historyLinks": "Linki historii",
|
||||
"noHistory": "Brak historii",
|
||||
"directDownloadDescription": "Pomiń rozwiązywanie i tworzyć zadania natychmiast",
|
||||
"taskProgress": "Postępy w realizacji zadań",
|
||||
|
||||
@@ -353,7 +353,7 @@
|
||||
"resolvedFileCount": "{count} ficheiros resolvidos",
|
||||
"resourceHasNoFiles": "O recurso não tem lista de arquivos selecionáveis",
|
||||
"noFiles": "Sem arquivos",
|
||||
"createHistory": "Criar Histórico",
|
||||
"historyLinks": "Links do histórico",
|
||||
"noHistory": "Sem histórico",
|
||||
"directDownloadDescription": "Ignorar resolver e criar tarefas imediatamente",
|
||||
"taskProgress": "Progresso da tarefa",
|
||||
|
||||
@@ -353,7 +353,7 @@
|
||||
"resolvedFileCount": "{count} файлов, разрешенных",
|
||||
"resourceHasNoFiles": "Ресурс не имеет выбираемого списка файлов",
|
||||
"noFiles": "Нет файлов",
|
||||
"createHistory": "Создаем историю",
|
||||
"historyLinks": "Ссылки в истории",
|
||||
"noHistory": "Нет истории",
|
||||
"directDownloadDescription": "Немедленно пропустите решение и создайте задачи",
|
||||
"taskProgress": "Прогресс в решении задач",
|
||||
|
||||
@@ -353,7 +353,7 @@
|
||||
"resolvedFileCount": "{count} கோப்புகள் தீர்க்கப்பட்டன",
|
||||
"resourceHasNoFiles": "வளத்தில் தேர்ந்தெடுக்கக்கூடிய கோப்பு பட்டியல் இல்லை",
|
||||
"noFiles": "(% 1 மொத்தம்) Items (Folders, Files), Size",
|
||||
"createHistory": "வரலாற்றை உருவாக்கு",
|
||||
"historyLinks": "வரலாற்று இணைப்புகள்",
|
||||
"noHistory": "& வரலாறà¯à®±à®¿à®²à¯ à®à®£à¯à®à¯à®ªà®¿à®à®¿... Unlimited (number of lines)",
|
||||
"directDownloadDescription": "தீர்க்கப்படுவதைத் தவிர்த்து, உடனடியாகப் பணிகளை உருவாக்கவும்",
|
||||
"taskProgress": "பணி முன்னேற்றம்",
|
||||
|
||||
@@ -353,7 +353,7 @@
|
||||
"resolvedFileCount": "{count} dosyaları çözüldü",
|
||||
"resourceHasNoFiles": "Kaynak, uygun olmayan dosya listesine sahiptir",
|
||||
"noFiles": "Hiçbir dosya yok",
|
||||
"createHistory": "Create History Create History",
|
||||
"historyLinks": "Geçmiş Bağlantıları",
|
||||
"noHistory": "Geçmiş yok",
|
||||
"directDownloadDescription": "Hemen çözümle ve görevleri oluşturun",
|
||||
"taskProgress": "Görev ilerlemesi",
|
||||
|
||||
@@ -353,7 +353,7 @@
|
||||
"resolvedFileCount": "{count} файли вирішені",
|
||||
"resourceHasNoFiles": "Ресурс не має вибраного списку файлів",
|
||||
"noFiles": "Немає файлів",
|
||||
"createHistory": "Історія",
|
||||
"historyLinks": "Посилання історії",
|
||||
"noHistory": "Історія",
|
||||
"directDownloadDescription": "Вирішити і створювати завдання відразу",
|
||||
"taskProgress": "Завдання",
|
||||
|
||||
@@ -353,7 +353,7 @@
|
||||
"resolvedFileCount": "{count} tập tin được giải quyết",
|
||||
"resourceHasNoFiles": "Không thể chọn danh sách tập tin",
|
||||
"noFiles": "Không có tập tin",
|
||||
"createHistory": "Tạo ra lịch sử",
|
||||
"historyLinks": "Liên kết lịch sử",
|
||||
"noHistory": "Không có lịch sử",
|
||||
"directDownloadDescription": "Bỏ qua việc giải quyết và tạo tác vụ ngay lập tức",
|
||||
"taskProgress": "Tiến trình tác vụ",
|
||||
|
||||
@@ -353,7 +353,7 @@
|
||||
"resolvedFileCount": "已解析 {count} 个文件",
|
||||
"resourceHasNoFiles": "该资源没有可选择的文件列表",
|
||||
"noFiles": "没有文件",
|
||||
"createHistory": "创建历史",
|
||||
"historyLinks": "历史链接",
|
||||
"noHistory": "暂无历史记录",
|
||||
"directDownloadDescription": "跳过解析并立即创建任务",
|
||||
"taskProgress": "任务进度",
|
||||
|
||||
@@ -353,7 +353,7 @@
|
||||
"resolvedFileCount": "已解析 {count} 個檔案",
|
||||
"resourceHasNoFiles": "該資源沒有可選擇的檔案列表",
|
||||
"noFiles": "沒有檔案",
|
||||
"createHistory": "建立歷史記錄",
|
||||
"historyLinks": "歷史連結",
|
||||
"noHistory": "暫無歷史記錄",
|
||||
"directDownloadDescription": "跳過解析並立即建立任務",
|
||||
"taskProgress": "任務進度",
|
||||
|
||||
@@ -499,11 +499,12 @@ void main() {
|
||||
|
||||
expect(_fieldText(tester, 'create-task-rename-input'), isEmpty);
|
||||
final createButton = tester.widget<AppLoadingButton>(find.byKey(const ValueKey('resolve-create-button')));
|
||||
expect(createButton.child, isA<Text>());
|
||||
final createText = createButton.child as Text;
|
||||
expect(createText.data, 'Create');
|
||||
expect(createText.maxLines, 1);
|
||||
expect(createText.softWrap, isFalse);
|
||||
expect(createButton.child, isA<SizedBox>());
|
||||
expect((createButton.child as SizedBox).width, 68);
|
||||
expect(
|
||||
find.descendant(of: find.byKey(const ValueKey('resolve-create-button')), matching: find.text('Create')),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
tester.getSize(find.byKey(const ValueKey('resolve-cancel-button'))),
|
||||
tester.getSize(find.byKey(const ValueKey('resolve-create-button'))),
|
||||
@@ -555,6 +556,7 @@ void main() {
|
||||
|
||||
await tester.tap(find.byIcon(Icons.history));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('History Links'), findsOneWidget);
|
||||
expect(
|
||||
tester.getSize(find.byKey(const ValueKey('create-history-title-bar'))).width,
|
||||
tester.getSize(find.byKey(const ValueKey('create-history-content'))).width,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:gopeed/features/tasks/presentation/widgets/resolve_task_actions.dart';
|
||||
import 'package:gopeed/features/tasks/presentation/widgets/create_task_action_buttons.dart';
|
||||
import 'package:gopeed/l10n/l10n.dart';
|
||||
import 'package:gopeed/shared/theme/app_component_themes.dart';
|
||||
import 'package:gopeed/shared/theme/app_theme.dart';
|
||||
@@ -36,10 +36,14 @@ void main() {
|
||||
content: SizedBox(width: width < 760 ? width - 32 : 720, height: 100),
|
||||
actions: [
|
||||
Flexible(
|
||||
child: ResolveTaskActions(
|
||||
child: CreateTaskActionButtons(
|
||||
submitting: submitting,
|
||||
onCancel: () => cancelled = true,
|
||||
onCreate: () => setState(() => submitting = true),
|
||||
onSubmit: () => setState(() => submitting = true),
|
||||
cancelLabel: context.l10n.cancel,
|
||||
submitLabel: context.l10n.createAction,
|
||||
cancelButtonKey: const ValueKey('resolve-cancel-button'),
|
||||
submitButtonKey: const ValueKey('resolve-create-button'),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -58,6 +62,9 @@ void main() {
|
||||
final createRect = tester.getRect(create);
|
||||
expect(cancelRect.size, createRect.size);
|
||||
expect(cancelRect.center.dy, createRect.center.dy);
|
||||
expect(createRect.left - cancelRect.right, 12);
|
||||
expect((tester.widget<shad.SecondaryButton>(cancel).child as SizedBox).width, 68);
|
||||
expect((tester.widget<AppLoadingButton>(create).child as SizedBox).width, 68);
|
||||
expect(cancelRect.left, greaterThanOrEqualTo(0));
|
||||
expect(createRect.right, lessThanOrEqualTo(width));
|
||||
expect(find.text(appLocalizationsFor(language).createAction), findsOneWidget);
|
||||
|
||||
@@ -2669,9 +2669,9 @@ void main() {
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: ResolveFileTree(
|
||||
files: [
|
||||
FileInfo(path: 'videos', name: 'clip.mp4', size: 1024),
|
||||
FileInfo(path: 'docs', name: 'notes.txt', size: 128),
|
||||
FileInfo(path: 'docs', name: 'manual.pdf', size: 256),
|
||||
FileInfo(path: 'videos', name: 'clip.mp4', size: 0),
|
||||
FileInfo(path: 'docs', name: 'notes.txt', size: 0),
|
||||
FileInfo(path: 'docs', name: 'manual.pdf', size: 0),
|
||||
],
|
||||
initialSelection: const [0, 1, 2],
|
||||
onSelectionChanged: (values) => selected = values,
|
||||
@@ -2708,7 +2708,26 @@ void main() {
|
||||
expect(find.byKey(const ValueKey('resolve-tree-expand-toggle')), findsOneWidget);
|
||||
expect(find.byType(shad.OutlinedContainer), findsOneWidget);
|
||||
expect(find.text('clip.mp4'), findsOneWidget);
|
||||
expect(find.text('Unknown size'), findsOneWidget);
|
||||
expect(tester.widget<Text>(find.text('clip.mp4')).style?.color, AppPalette.light.textPrimary);
|
||||
final baselines = tester
|
||||
.widgetList<Baseline>(
|
||||
find.descendant(
|
||||
of: find.byKey(const ValueKey('resolve-tree-selection-stats')),
|
||||
matching: find.byType(Baseline),
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
expect(baselines, hasLength(2));
|
||||
expect(baselines.first.baseline, baselines.last.baseline);
|
||||
expect(baselines.every((widget) => widget.baselineType == TextBaseline.alphabetic), isTrue);
|
||||
final filtersRect = tester.getRect(find.byKey(const ValueKey('resolve-tree-filters')));
|
||||
final statsRect = tester.getRect(find.byKey(const ValueKey('resolve-tree-selection-stats')));
|
||||
final selectedCountRect = tester.getRect(find.byKey(const ValueKey('resolve-tree-selected-count')));
|
||||
final selectedSizeRect = tester.getRect(find.byKey(const ValueKey('resolve-tree-selected-size')));
|
||||
expect(statsRect.center.dy, closeTo(filtersRect.center.dy, 0.01));
|
||||
expect(selectedCountRect.center.dy, closeTo(selectedSizeRect.center.dy, 0.01));
|
||||
expect(selectedSizeRect.left, greaterThan(selectedCountRect.right));
|
||||
|
||||
await tester.tap(find.byKey(const ValueKey('resolve-tree-expand-toggle')));
|
||||
await tester.pumpAndSettle();
|
||||
@@ -2770,8 +2789,16 @@ void main() {
|
||||
expect(find.text('clip.mp4'), findsOneWidget);
|
||||
expect(selected, [0, 1, 2]);
|
||||
|
||||
tester.view.physicalSize = const Size(360, 620);
|
||||
tester.view.physicalSize = const Size(280, 620);
|
||||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
tester.getRect(find.byKey(const ValueKey('resolve-tree-selection-stats'))).top,
|
||||
greaterThanOrEqualTo(tester.getRect(find.byKey(const ValueKey('resolve-tree-filters'))).bottom),
|
||||
);
|
||||
expect(
|
||||
tester.getRect(find.byKey(const ValueKey('resolve-tree-selected-size'))).top,
|
||||
greaterThanOrEqualTo(tester.getRect(find.byKey(const ValueKey('resolve-tree-selected-count'))).bottom),
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
|
||||