Target directory can be changed.
This commit is contained in:
parent
334cd71b37
commit
08c2152145
|
@ -3,6 +3,7 @@ import 'dart:convert';
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:quickgui/src/globals.dart';
|
||||
import 'package:quickgui/src/model/operating_system.dart';
|
||||
import 'package:quickgui/src/model/option.dart';
|
||||
import 'package:quickgui/src/model/version.dart';
|
||||
|
@ -32,6 +33,7 @@ class _DownloaderState extends State<Downloader> {
|
|||
|
||||
@override
|
||||
void initState() {
|
||||
Directory.current = gCurrentDirectoy;
|
||||
_progressStream = progressStream();
|
||||
super.initState();
|
||||
}
|
||||
|
@ -127,7 +129,7 @@ class _DownloaderState extends State<Downloader> {
|
|||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 32),
|
||||
child: Text("Target folder : ${Directory.current}"),
|
||||
child: Text("Target folder : $gCurrentDirectoy"),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
|
|
@ -1,13 +1,20 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:quickgui/src/globals.dart';
|
||||
import 'package:quickgui/src/widgets/home_page_buttons.dart';
|
||||
|
||||
class MainPage extends StatelessWidget {
|
||||
class MainPage extends StatefulWidget {
|
||||
const MainPage({Key? key, required this.title}) : super(key: key);
|
||||
|
||||
final String title;
|
||||
|
||||
@override
|
||||
State<MainPage> createState() => _MainPageState();
|
||||
}
|
||||
|
||||
class _MainPageState extends State<MainPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
//Directory.current = '/home/yannick';
|
||||
|
@ -50,9 +57,19 @@ class MainPage extends StatelessWidget {
|
|||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
"Working directory : ${Directory.current.absolute.path}",
|
||||
style: Theme.of(context).textTheme.subtitle1!.copyWith(color: Colors.white),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
var folder = await FilePicker.platform.getDirectoryPath(dialogTitle: "Pick a folder");
|
||||
if (folder != null) {
|
||||
setState(() {
|
||||
gCurrentDirectoy = Directory(folder);
|
||||
});
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
"Working directory : ${gCurrentDirectoy.path}",
|
||||
style: Theme.of(context).textTheme.subtitle1!.copyWith(color: Colors.white),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -40,6 +40,7 @@ dependencies:
|
|||
path: plugins/window_size
|
||||
quiver: ^3.0.1+1
|
||||
tuple: ^2.0.0
|
||||
file_picker: ^4.1.6
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
Loading…
Reference in New Issue