File tree Expand file tree Collapse file tree 9 files changed +92
-6
lines changed
Expand file tree Collapse file tree 9 files changed +92
-6
lines changed Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <projectDescription >
3+ <name >android</name >
4+ <comment >Project android created by Buildship.</comment >
5+ <projects >
6+ </projects >
7+ <buildSpec >
8+ <buildCommand >
9+ <name >org.eclipse.buildship.core.gradleprojectbuilder</name >
10+ <arguments >
11+ </arguments >
12+ </buildCommand >
13+ </buildSpec >
14+ <natures >
15+ <nature >org.eclipse.buildship.core.gradleprojectnature</nature >
16+ </natures >
17+ </projectDescription >
Original file line number Diff line number Diff line change 1+ arguments =
2+ auto.sync =false
3+ build.scans.enabled =false
4+ connection.gradle.distribution =GRADLE_DISTRIBUTION(WRAPPER)
5+ connection.project.dir =
6+ eclipse.preferences.version =1
7+ gradle.user.home =
8+ java.home =C\:/Program Files/Java/jdk-14.0.1
9+ jvm.arguments =
10+ offline.mode =false
11+ override.workspace.settings =true
12+ show.console.view =true
13+ show.executions.view =true
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <classpath >
3+ <classpathentry kind =" con" path =" org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-14/" />
4+ <classpathentry kind =" con" path =" org.eclipse.buildship.core.gradleclasspathcontainer" />
5+ <classpathentry kind =" output" path =" bin/default" />
6+ </classpath >
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <projectDescription >
3+ <name >app</name >
4+ <comment >Project app created by Buildship.</comment >
5+ <projects >
6+ </projects >
7+ <buildSpec >
8+ <buildCommand >
9+ <name >org.eclipse.jdt.core.javabuilder</name >
10+ <arguments >
11+ </arguments >
12+ </buildCommand >
13+ <buildCommand >
14+ <name >org.eclipse.buildship.core.gradleprojectbuilder</name >
15+ <arguments >
16+ </arguments >
17+ </buildCommand >
18+ </buildSpec >
19+ <natures >
20+ <nature >org.eclipse.jdt.core.javanature</nature >
21+ <nature >org.eclipse.buildship.core.gradleprojectnature</nature >
22+ </natures >
23+ </projectDescription >
Original file line number Diff line number Diff line change 1+ connection.project.dir =..
2+ eclipse.preferences.version =1
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ class HomePage extends StatelessWidget {
2727 Widget build (BuildContext context) {
2828 return WillPopScope (
2929 onWillPop: () async {
30- return true ;
30+ return await controller. goToParentDirectory () ;
3131 },
3232 child: Scaffold (
3333 appBar: AppBar (
@@ -41,7 +41,11 @@ class HomePage extends StatelessWidget {
4141 ],
4242 leading: IconButton (
4343 icon: Icon (Icons .arrow_back),
44- onPressed: () {},
44+ onPressed: () async {
45+ if (! (await controller.goToParentDirectory ())) {
46+ Navigator .pop (context);
47+ }
48+ },
4549 ),
4650 ),
4751 body: Container (
Original file line number Diff line number Diff line change 11import 'dart:io' ;
22
3+ import 'package:file_manager/file_manager.dart' ;
34import 'package:flutter/material.dart' ;
45
56class FileManagerController extends ChangeNotifier {
@@ -18,6 +19,26 @@ class FileManagerController extends ChangeNotifier {
1819 notifyListeners ();
1920 }
2021
22+ Future <bool > goToParentDirectory () async {
23+ List <Directory > storageList = (await getStorageList ())! ;
24+ bool willNotGoToParent = storageList
25+ .where ((element) => element.path == Directory (_path).path)
26+ .isEmpty;
27+ print (Directory (_path).parent);
28+ if (! willNotGoToParent) {
29+ openDirectory (Directory (_path).parent);
30+ }
31+ return willNotGoToParent;
32+ }
33+
34+ // List<FileSystemEntity> sort(SortBy sort, List<FileSystemEntity> entitys) {
35+ // if (sort == SortBy.name) {
36+ // entitys
37+ // .sort((a, b) => a.path.toLowerCase().compareTo(b.path.toLowerCase()));
38+ // return entitys;
39+ // } else if (sort == SortBy.date) {}
40+ // }
41+
2142 /// Open directory by providing Directory.
2243 void openDirectory (FileSystemEntity entity) {
2344 if (entity is Directory ) {
Original file line number Diff line number Diff line change 11enum SortBy {
22 name,
33 date,
4- }
4+ }
Original file line number Diff line number Diff line change @@ -95,13 +95,13 @@ class _FileManagerState extends State<FileManager> {
9595 return FutureBuilder <List <Directory >?>(
9696 future: getStorageList (),
9797 builder: (context, snapshot) {
98- print (snapshot.data);
9998 if (snapshot.hasData) {
10099 path.value = snapshot.data! [0 ].path;
101100 return body (context);
102101 } else if (snapshot.hasError) {
103- print (snapshot.error);
104- return errorPage (snapshot.error.toString ());
102+ // print(snapshot.error);
103+ throw Exception (snapshot.error.toString ());
104+ // return errorPage(snapshot.error.toString());
105105 } else {
106106 return loadingScreenWidget ();
107107 }
You can’t perform that action at this time.
0 commit comments