fix(ui): refine create task actions and relocate icon sources (#1500)

This commit is contained in:
Levi authored and GitHub committed 2026-09-11 08:00:03 +08:00
1 parent 8f9bac9e6b
commit 08fe4eef4e
64 files changed
+193 -139

No files matched your search

@@ -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),
),
),
),
],
),
);
}
}
+1 -1
View File
@@ -353,7 +353,7 @@
"resolvedFileCount": "{count}",
"resourceHasNoFiles": "ولا توجد في هذا المورد قائمة ملف قابلة للاختيار",
"noFiles": "لا توجد ملفات",
"createHistory": "تاريخ الخلق",
"historyLinks": "روابط السجل",
"noHistory": "لا تاريخ",
"directDownloadDescription": "حل المشاكل وخلق المهام على الفور",
"taskProgress": "التقدم المحرز",
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -353,7 +353,7 @@
"resolvedFileCount": "{count} فایل شناسایی شد",
"resourceHasNoFiles": "منبع هیچ لیست فایل قابل انتخاب ندارد",
"noFiles": "فایل ها",
"createHistory": "ایجاد تاریخ",
"historyLinks": "پیوندهای تاریخچه",
"noHistory": "تاریخ",
"directDownloadDescription": "پیاده سازی و ایجاد وظایف بلافاصله",
"taskProgress": "پیشرفت شغلی",
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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à",
+1 -1
View File
@@ -353,7 +353,7 @@
"resolvedFileCount": "{count} ファイルが解決しました",
"resourceHasNoFiles": "リソースには、選択可能なファイルリストはありません",
"noFiles": "ファイルがない場合",
"createHistory": "歴史を創造する",
"historyLinks": "履歴リンク",
"noHistory": "歴史なし",
"directDownloadDescription": "解決をスキップし、すぐにタスクを作成",
"taskProgress": "タスクの進捗",
+1 -1
View File
@@ -353,7 +353,7 @@
"resolvedFileCount": "{count} 파일 해결",
"resourceHasNoFiles": "리소스에는 선택 가능한 파일 목록이 없습니다",
"noFiles": "파일 없음",
"createHistory": "회사연혁",
"historyLinks": "기록 링크",
"noHistory": "의 역사",
"directDownloadDescription": "재해를 드리며 즉시 업무를 만듭니다",
"taskProgress": "작업 진행",
+1 -1
View File
@@ -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ń",
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -353,7 +353,7 @@
"resolvedFileCount": "{count} файлов, разрешенных",
"resourceHasNoFiles": "Ресурс не имеет выбираемого списка файлов",
"noFiles": "Нет файлов",
"createHistory": "Создаем историю",
"historyLinks": "Ссылки в истории",
"noHistory": "Нет истории",
"directDownloadDescription": "Немедленно пропустите решение и создайте задачи",
"taskProgress": "Прогресс в решении задач",
+1 -1
View File
@@ -353,7 +353,7 @@
"resolvedFileCount": "{count} கோப்புகள் தீர்க்கப்பட்டன",
"resourceHasNoFiles": "வளத்தில் தேர்ந்தெடுக்கக்கூடிய கோப்பு பட்டியல் இல்லை",
"noFiles": "(% 1 மொத்தம்) Items (Folders, Files), Size",
"createHistory": "வரலாற்றை உருவாக்கு",
"historyLinks": "வரலாற்று இணைப்புகள்",
"noHistory": "& வரலாற்றில் கண்டுபிடி... Unlimited (number of lines)",
"directDownloadDescription": "தீர்க்கப்படுவதைத் தவிர்த்து, உடனடியாகப் பணிகளை உருவாக்கவும்",
"taskProgress": "பணி முன்னேற்றம்",
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -353,7 +353,7 @@
"resolvedFileCount": "{count} файли вирішені",
"resourceHasNoFiles": "Ресурс не має вибраного списку файлів",
"noFiles": "Немає файлів",
"createHistory": "Історія",
"historyLinks": "Посилання історії",
"noHistory": "Історія",
"directDownloadDescription": "Вирішити і створювати завдання відразу",
"taskProgress": "Завдання",
+1 -1
View File
@@ -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ụ",
+1 -1
View File
@@ -353,7 +353,7 @@
"resolvedFileCount": "已解析 {count} 个文件",
"resourceHasNoFiles": "该资源没有可选择的文件列表",
"noFiles": "没有文件",
"createHistory": "创建历史",
"historyLinks": "历史链接",
"noHistory": "暂无历史记录",
"directDownloadDescription": "跳过解析并立即创建任务",
"taskProgress": "任务进度",
+1 -1
View File
@@ -353,7 +353,7 @@
"resolvedFileCount": "已解析 {count} 個檔案",
"resourceHasNoFiles": "該資源沒有可選擇的檔案列表",
"noFiles": "沒有檔案",
"createHistory": "建立歷史記錄",
"historyLinks": "歷史連結",
"noHistory": "暫無歷史記錄",
"directDownloadDescription": "跳過解析並立即建立任務",
"taskProgress": "任務進度",