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 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:quickgui/src/globals.dart';
|
||||||
import 'package:quickgui/src/model/operating_system.dart';
|
import 'package:quickgui/src/model/operating_system.dart';
|
||||||
import 'package:quickgui/src/model/option.dart';
|
import 'package:quickgui/src/model/option.dart';
|
||||||
import 'package:quickgui/src/model/version.dart';
|
import 'package:quickgui/src/model/version.dart';
|
||||||
|
@ -32,6 +33,7 @@ class _DownloaderState extends State<Downloader> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
Directory.current = gCurrentDirectoy;
|
||||||
_progressStream = progressStream();
|
_progressStream = progressStream();
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
@ -127,7 +129,7 @@ class _DownloaderState extends State<Downloader> {
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 32),
|
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 'dart:io';
|
||||||
|
|
||||||
|
import 'package:file_picker/file_picker.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:quickgui/src/globals.dart';
|
||||||
import 'package:quickgui/src/widgets/home_page_buttons.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);
|
const MainPage({Key? key, required this.title}) : super(key: key);
|
||||||
|
|
||||||
final String title;
|
final String title;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MainPage> createState() => _MainPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MainPageState extends State<MainPage> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
//Directory.current = '/home/yannick';
|
//Directory.current = '/home/yannick';
|
||||||
|
@ -50,10 +57,20 @@ class MainPage extends StatelessWidget {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Text(
|
InkWell(
|
||||||
"Working directory : ${Directory.current.absolute.path}",
|
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),
|
style: Theme.of(context).textTheme.subtitle1!.copyWith(color: Colors.white),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -40,6 +40,7 @@ dependencies:
|
||||||
path: plugins/window_size
|
path: plugins/window_size
|
||||||
quiver: ^3.0.1+1
|
quiver: ^3.0.1+1
|
||||||
tuple: ^2.0.0
|
tuple: ^2.0.0
|
||||||
|
file_picker: ^4.1.6
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|
Loading…
Reference in New Issue