opt: entries empty fallback
Signed-off-by: Kingtous <kingtous@qq.com>
This commit is contained in:
parent
eea62352d2
commit
4bd5fe1509
@ -163,28 +163,33 @@ class _FileManagerPageState extends State<FileManagerPage>
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Obx(
|
child: entries.isEmpty
|
||||||
() {
|
? Offstage()
|
||||||
final searchText =
|
: Obx(
|
||||||
isLocal ? _searchTextLocal : _searchTextRemote;
|
() {
|
||||||
final filteredEntries = entries.where((element) {
|
final searchText =
|
||||||
if (searchText.isEmpty) {
|
isLocal ? _searchTextLocal : _searchTextRemote;
|
||||||
return true;
|
final filteredEntries = searchText.isEmpty
|
||||||
} else {
|
? entries.where((element) {
|
||||||
return element.name.contains(searchText.value);
|
if (searchText.isEmpty) {
|
||||||
}
|
return true;
|
||||||
}).toList(growable: false);
|
} else {
|
||||||
return DataTable(
|
return element.name
|
||||||
key: ValueKey(isLocal ? 0 : 1),
|
.contains(searchText.value);
|
||||||
showCheckboxColumn: true,
|
}
|
||||||
dataRowHeight: 25,
|
}).toList(growable: false)
|
||||||
headingRowHeight: 30,
|
: entries;
|
||||||
columnSpacing: 8,
|
return DataTable(
|
||||||
showBottomBorder: true,
|
key: ValueKey(isLocal ? 0 : 1),
|
||||||
sortColumnIndex: sortIndex,
|
showCheckboxColumn: true,
|
||||||
sortAscending: sortAscending,
|
dataRowHeight: 25,
|
||||||
columns: [
|
headingRowHeight: 30,
|
||||||
DataColumn(label: Text(translate(" "))), // icon
|
columnSpacing: 8,
|
||||||
|
showBottomBorder: true,
|
||||||
|
sortColumnIndex: sortIndex,
|
||||||
|
sortAscending: sortAscending,
|
||||||
|
columns: [
|
||||||
|
DataColumn(label: Text(translate(" "))), // icon
|
||||||
DataColumn(
|
DataColumn(
|
||||||
label: Text(
|
label: Text(
|
||||||
translate("Name"),
|
translate("Name"),
|
||||||
@ -264,18 +269,20 @@ class _FileManagerPageState extends State<FileManagerPage>
|
|||||||
.lastModified()
|
.lastModified()
|
||||||
.toString()
|
.toString()
|
||||||
.replaceAll(".000", "") +
|
.replaceAll(".000", "") +
|
||||||
" ",
|
" ",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12, color: MyTheme.darkGray),
|
fontSize: 12,
|
||||||
)),
|
color: MyTheme.darkGray),
|
||||||
DataCell(Text(
|
)),
|
||||||
sizeStr,
|
DataCell(Text(
|
||||||
style: TextStyle(
|
sizeStr,
|
||||||
fontSize: 12, color: MyTheme.darkGray),
|
style: TextStyle(
|
||||||
)),
|
fontSize: 12,
|
||||||
]);
|
color: MyTheme.darkGray),
|
||||||
}).toList(),
|
)),
|
||||||
);
|
]);
|
||||||
|
}).toList(growable: false),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -753,20 +760,21 @@ class _FileManagerPageState extends State<FileManagerPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget buildBread(bool isLocal) {
|
Widget buildBread(bool isLocal) {
|
||||||
final directory = model.getCurrentDir(isLocal);
|
final items = getPathBreadCrumbItems(isLocal, (list) {
|
||||||
print(directory.path);
|
var path = "";
|
||||||
return BreadCrumb(
|
for (var item in list) {
|
||||||
items: getPathBreadCrumbItems(isLocal, (list) {
|
path = PathUtil.join(path, item, model.getCurrentIsWindows(isLocal));
|
||||||
var path = "";
|
}
|
||||||
for (var item in list) {
|
openDirectory(path, isLocal: isLocal);
|
||||||
path = PathUtil.join(path, item, model.getCurrentIsWindows(isLocal));
|
});
|
||||||
}
|
return items.isEmpty
|
||||||
openDirectory(path, isLocal: isLocal);
|
? Offstage()
|
||||||
}),
|
: BreadCrumb(
|
||||||
divider: Text("/").paddingSymmetric(horizontal: 4.0),
|
items: items,
|
||||||
overflow: ScrollableOverflow(
|
divider: Text("/").paddingSymmetric(horizontal: 4.0),
|
||||||
controller: getBreadCrumbScrollController(isLocal)),
|
overflow: ScrollableOverflow(
|
||||||
);
|
controller: getBreadCrumbScrollController(isLocal)),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<BreadCrumbItem> getPathBreadCrumbItems(
|
List<BreadCrumbItem> getPathBreadCrumbItems(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user