mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-14 20:33:41 +00:00
fix(ui): reuse shared file path picker for script settings (#1496)
This commit is contained in:
5 files changed
+87
-15
No files matched your search
@@ -122,7 +122,7 @@ Future<String?> showTextSettingDialog(
|
||||
required String fieldLabel,
|
||||
String initialValue = '',
|
||||
bool requireHttpUrl = false,
|
||||
Future<String?> Function()? pickPath,
|
||||
bool pickFile = false,
|
||||
Future<void> Function(String value)? onTest,
|
||||
}) async {
|
||||
final controller = TextEditingController(text: initialValue);
|
||||
@@ -189,16 +189,12 @@ Future<String?> showTextSettingDialog(
|
||||
children: [
|
||||
Text(fieldLabel, style: TextStyle(color: palette.textSecondary, fontSize: 12)),
|
||||
const SizedBox(height: 6),
|
||||
if (pickPath == null)
|
||||
if (!pickFile)
|
||||
AppTextField(controller: controller)
|
||||
else
|
||||
AppPathPickerField(
|
||||
AppPathPickerField.file(
|
||||
controller: controller,
|
||||
desktopWidth: AppDesignTokens.settingsFormControlWidth,
|
||||
onPick: () async {
|
||||
final path = await pickPath();
|
||||
if (path != null && path.isNotEmpty) controller.text = path;
|
||||
},
|
||||
),
|
||||
if (validationMessage != null || testMessage != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
|
||||
Reference in new issue
Block a user