Added a button to select the working directory.
This commit is contained in:
parent
f72e025817
commit
0ffa311d4f
|
@ -106,19 +106,37 @@ class _ManagerState extends State<Manager> with PreferencesMixin {
|
|||
|
||||
Widget _buildVmList() {
|
||||
List<Widget> _widgetList = [];
|
||||
_widgetList.add(TextButton(
|
||||
onPressed: () async {
|
||||
String? result = await FilePicker.platform.getDirectoryPath();
|
||||
if (result != null) {
|
||||
setState(() {
|
||||
Directory.current = result;
|
||||
});
|
||||
_widgetList.add(
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
Directory.current.path,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Theme.of(context).canvasColor,
|
||||
onPrimary: Theme.of(context).brightness == Brightness.dark ? Colors.white70 : Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
onPressed: () async {
|
||||
String? result = await FilePicker.platform.getDirectoryPath();
|
||||
if (result != null) {
|
||||
setState(() {
|
||||
Directory.current = result;
|
||||
});
|
||||
|
||||
savePreference(prefWorkingDirectory, Directory.current.path);
|
||||
_getVms(context);
|
||||
}
|
||||
},
|
||||
child: Text(Directory.current.path)));
|
||||
savePreference(prefWorkingDirectory, Directory.current.path);
|
||||
_getVms(context);
|
||||
}
|
||||
},
|
||||
child: const Icon(Icons.more_horiz),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
List<List<Widget>> rows = _currentVms.map((vm) {
|
||||
return _buildRow(vm);
|
||||
}).toList();
|
||||
|
|
|
@ -24,7 +24,7 @@ class _DownloaderMenuState extends State<DownloaderMenu> with PreferencesMixin {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Expanded(
|
||||
|
@ -47,20 +47,33 @@ class _DownloaderMenuState extends State<DownloaderMenu> with PreferencesMixin {
|
|||
),
|
||||
],
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
var folder = await FilePicker.platform.getDirectoryPath(dialogTitle: "Pick a folder");
|
||||
if (folder != null) {
|
||||
setState(() {
|
||||
Directory.current = folder;
|
||||
});
|
||||
savePreference(prefWorkingDirectory, Directory.current.path);
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
"Working directory : ${Directory.current.path}",
|
||||
style: Theme.of(context).textTheme.subtitle1!.copyWith(color: Colors.white),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"Working directory : ${Directory.current.path}",
|
||||
style: Theme.of(context).textTheme.subtitle1!.copyWith(color: Colors.white),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Theme.of(context).canvasColor,
|
||||
onPrimary: Theme.of(context).brightness == Brightness.dark ? Colors.white70 : Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
onPressed: () async {
|
||||
var folder = await FilePicker.platform.getDirectoryPath(dialogTitle: "Pick a folder");
|
||||
if (folder != null) {
|
||||
setState(() {
|
||||
Directory.current = folder;
|
||||
});
|
||||
savePreference(prefWorkingDirectory, Directory.current.path);
|
||||
}
|
||||
},
|
||||
child: const Icon(Icons.more_horiz),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue