feat: improve desktop path selection and USB connection recovery
This commit is contained in:
1 parent
5aa575f182
commit
6490665af8
28 files changed
+846
-51
No files matched your search
@@ -3,6 +3,7 @@ import 'package:material_ui/material_ui.dart';
|
||||
import '../data/agent_models.dart';
|
||||
|
||||
import 'agent_model.dart';
|
||||
import 'path_picker.dart';
|
||||
|
||||
class AgentView extends StatefulWidget {
|
||||
const AgentView({super.key, required this.model});
|
||||
@@ -42,6 +43,24 @@ class _AgentViewState extends State<AgentView> {
|
||||
: null,
|
||||
decoration: InputDecoration(
|
||||
labelText: label,
|
||||
suffixIcon: ['configPath', 'admin', 'enroll'].contains(key)
|
||||
? IconButton(
|
||||
tooltip: '选择文件并保存',
|
||||
icon: const Icon(Icons.folder_open),
|
||||
onPressed: m.busy
|
||||
? null
|
||||
: () => m.run(() async {
|
||||
final selected = await pickPath(controller.text);
|
||||
if (selected == null || !mounted) {
|
||||
return;
|
||||
}
|
||||
controller.text = selected;
|
||||
change(selected);
|
||||
await m.savePath?.call(key, selected);
|
||||
m.notice = '文件位置已保存';
|
||||
}),
|
||||
)
|
||||
: null,
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user