fix(flutter): keep create task advanced options collapsed (#1481)

This commit is contained in:
Levi authored and GitHub committed 2026-09-06 16:43:14 +08:00
1 parent aafd039205
commit 16f2d30476
4 files changed
+170 -151

No files matched your search

@@ -29,6 +29,7 @@ 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_number_input.dart';
import '../../../../shared/widgets/app_path_picker_field.dart';
import '../../../../shared/widgets/app_primary_button.dart';
import '../../../../shared/widgets/app_tooltip.dart';
@@ -177,9 +178,6 @@ class _CreateTaskWindowPageState extends ConsumerState<CreateTaskWindowPage> {
_initialLabels = req.labels == null ? null : Map<String, String>.of(req.labels!);
_applyInitialProxy(req.proxy);
_skipVerifyCert = req.skipVerifyCert;
if (req.proxy != null || req.skipVerifyCert) {
_showAdvanced = true;
}
switch (_parseProtocol(req.url)) {
case _TaskProtocol.http:
if (req.extra is Map) {
@@ -189,7 +187,6 @@ class _CreateTaskWindowPageState extends ConsumerState<CreateTaskWindowPage> {
if (extra.header.isNotEmpty) {
_replaceHttpHeaders(extra.header);
}
_showAdvanced = true;
}
break;
case _TaskProtocol.bt:
@@ -197,7 +194,6 @@ class _CreateTaskWindowPageState extends ConsumerState<CreateTaskWindowPage> {
if (req.extra is Map) {
final extra = ReqExtraBt.fromJson(Map<String, dynamic>.from(req.extra! as Map));
_trackersController.text = extra.trackers.join('\n');
_showAdvanced = true;
}
break;
case _TaskProtocol.ed2k:
@@ -222,13 +218,6 @@ class _CreateTaskWindowPageState extends ConsumerState<CreateTaskWindowPage> {
_autoExtract = extra.autoExtract;
_archivePasswordController.text = extra.archivePassword;
_deleteAfterExtract = extra.deleteAfterExtract;
if (extra.autoTorrent != null ||
extra.deleteTorrentAfterDownload != null ||
extra.autoExtract != null ||
extra.archivePassword.isNotEmpty ||
extra.deleteAfterExtract) {
_showAdvanced = true;
}
}
}
});
@@ -357,7 +346,19 @@ class _CreateTaskWindowPageState extends ConsumerState<CreateTaskWindowPage> {
const SizedBox(height: 16),
_FormRow(
label: context.l10n.connections,
child: _WindowTextField(controller: _connectionsController, hintText: context.l10n.enterCount),
child: Align(
alignment: Alignment.centerLeft,
child: SizedBox(
width: AppDesignTokens.settingsNumberControlWidth,
child: AppNumberInput(
fieldKey: const ValueKey('create-task-connections-input'),
controller: _connectionsController,
min: 1,
max: 256,
hintText: context.l10n.enterCount,
),
),
),
),
const SizedBox(height: 16),
_FormRow(
@@ -434,6 +435,7 @@ class _CreateTaskWindowPageState extends ConsumerState<CreateTaskWindowPage> {
),
),
AnimatedCrossFade(
key: const ValueKey('create-task-advanced-section'),
duration: _advancedExpandDuration,
firstCurve: Curves.easeOutCubic,
secondCurve: Curves.easeInCubic,