fix didn't show drives on '/' page

This commit is contained in:
csf 2022-10-19 11:24:44 +09:00
parent 0bced44126
commit ec698e6885
2 changed files with 19 additions and 19 deletions

View File

@ -286,8 +286,9 @@ class _FileManagerPageState extends State<FileManagerPage>
rows: filteredEntries.map((entry) {
final sizeStr =
entry.isFile ? readableFileSize(entry.size.toDouble()) : "";
final lastModifiedStr =
"${entry.lastModified().toString().replaceAll(".000", "")} ";
final lastModifiedStr = entry.isDrive
? " "
: "${entry.lastModified().toString().replaceAll(".000", "")} ";
return DataRow(
key: ValueKey(entry.name),
onSelectChanged: (s) {
@ -810,9 +811,19 @@ class _FileManagerPageState extends State<FileManagerPage>
final peerPlatform = (await bind.sessionGetPlatform(
id: _ffi.id, isRemote: !isLocal))
.toLowerCase();
final List<MenuEntryBase> menuItems;
final List<MenuEntryBase> menuItems = [
MenuEntryButton(
childBuilder: (TextStyle? style) => Text(
'/',
style: style,
),
proc: () {
openDirectory('/', isLocal: isLocal);
},
dismissOnClicked: true),
MenuEntryDivider()
];
if (peerPlatform == "windows") {
menuItems = [];
var loadingTag = "";
if (!isLocal) {
loadingTag = _ffi.dialogManager.showLoading("Waiting");
@ -837,19 +848,6 @@ class _FileManagerPageState extends State<FileManagerPage>
_ffi.dialogManager.dismissByTag(loadingTag);
}
}
} else {
menuItems = [
MenuEntryButton(
childBuilder: (TextStyle? style) => Text(
'/',
style: style,
),
proc: () {
openDirectory('/', isLocal: isLocal);
},
dismissOnClicked: true),
MenuEntryDivider()
];
}
mod_menu.showMenu(

View File

@ -1178,11 +1178,13 @@ class SelectedItems {
}
}
// code from file_manager pkg after edit
// edited from [https://github.com/DevsOnFlutter/file_manager/blob/c1bf7f0225b15bcb86eba602c60acd5c4da90dd8/lib/file_manager.dart#L22]
List<Entry> _sortList(List<Entry> list, SortBy sortType, bool ascending) {
if (sortType == SortBy.Name) {
// making list of only folders.
final dirs = list.where((element) => element.isDirectory).toList();
final dirs = list
.where((element) => element.isDirectory || element.isDrive)
.toList();
// sorting folder list by name.
dirs.sort((a, b) => a.name.toLowerCase().compareTo(b.name.toLowerCase()));