@@ -14,19 +14,20 @@ See the License for the specific language governing permissions and
1414limitations under the License.
1515*/
1616
17- //credits: @HrX03 for API https://github.com/HrX03/Flux
18-
1917import 'dart:io' ;
2018
2119import 'package:collection/collection.dart' ;
20+ import 'package:files/backend/utils.dart' ;
2221import 'package:flutter/material.dart' ;
2322import 'package:windows_path_provider/windows_path_provider.dart' ;
2423import 'package:xdg_directories/xdg_directories.dart' ;
2524
2625class FolderProvider {
2726 final List <BuiltinFolder > _folders;
27+ final List <SideDestination > _destinations;
2828
2929 List <BuiltinFolder > get folders => List .from (_folders);
30+ List <SideDestination > get destinations => List .from (_destinations);
3031
3132 static Future <FolderProvider > init () async {
3233 final List <BuiltinFolder > folders = [];
@@ -71,10 +72,19 @@ class FolderProvider {
7172 throw Exception ("Platform not supported" );
7273 }
7374
74- return FolderProvider ._(folders);
75+ final List <SideDestination > destinations = [
76+ for (final BuiltinFolder element in folders)
77+ SideDestination (
78+ _icons[element.type]! ,
79+ Utils .getEntityName (element.directory.path),
80+ element.directory.path,
81+ ),
82+ ];
83+
84+ return FolderProvider ._(folders, destinations);
7585 }
7686
77- const FolderProvider ._(this ._folders);
87+ const FolderProvider ._(this ._folders, this ._destinations );
7888
7989 IconData getIconForType (FolderType type) {
8090 return _icons[type]! ;
@@ -110,6 +120,14 @@ class BuiltinFolder {
110120 const BuiltinFolder (this .type, this .directory);
111121}
112122
123+ class SideDestination {
124+ final IconData icon;
125+ final String label;
126+ final String path;
127+
128+ const SideDestination (this .icon, this .label, this .path);
129+ }
130+
113131const Map <FolderType , IconData > _icons = {
114132 FolderType .home: Icons .home_filled,
115133 FolderType .desktop: Icons .desktop_windows,
0 commit comments