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() {
|
Widget _buildVmList() {
|
||||||
List<Widget> _widgetList = [];
|
List<Widget> _widgetList = [];
|
||||||
_widgetList.add(TextButton(
|
_widgetList.add(
|
||||||
onPressed: () async {
|
Row(
|
||||||
String? result = await FilePicker.platform.getDirectoryPath();
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
if (result != null) {
|
children: [
|
||||||
setState(() {
|
Text(
|
||||||
Directory.current = result;
|
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);
|
savePreference(prefWorkingDirectory, Directory.current.path);
|
||||||
_getVms(context);
|
_getVms(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Text(Directory.current.path)));
|
child: const Icon(Icons.more_horiz),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
List<List<Widget>> rows = _currentVms.map((vm) {
|
List<List<Widget>> rows = _currentVms.map((vm) {
|
||||||
return _buildRow(vm);
|
return _buildRow(vm);
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|
|
@ -47,20 +47,33 @@ class _DownloaderMenuState extends State<DownloaderMenu> with PreferencesMixin {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
InkWell(
|
Row(
|
||||||
onTap: () async {
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
var folder = await FilePicker.platform.getDirectoryPath(dialogTitle: "Pick a folder");
|
children: [
|
||||||
if (folder != null) {
|
Text(
|
||||||
setState(() {
|
"Working directory : ${Directory.current.path}",
|
||||||
Directory.current = folder;
|
style: Theme.of(context).textTheme.subtitle1!.copyWith(color: Colors.white),
|
||||||
});
|
),
|
||||||
savePreference(prefWorkingDirectory, Directory.current.path);
|
const SizedBox(
|
||||||
}
|
width: 8,
|
||||||
},
|
),
|
||||||
child: Text(
|
ElevatedButton(
|
||||||
"Working directory : ${Directory.current.path}",
|
style: ElevatedButton.styleFrom(
|
||||||
style: Theme.of(context).textTheme.subtitle1!.copyWith(color: Colors.white),
|
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