update file transfer UI

This commit is contained in:
csf 2022-10-13 19:57:59 +09:00
parent baf437e6f0
commit eaf7fd320c

View File

@ -158,13 +158,13 @@ class _FileManagerPageState extends State<FileManagerPage>
final sortIndex = (SortBy style) { final sortIndex = (SortBy style) {
switch (style) { switch (style) {
case SortBy.Name: case SortBy.Name:
return 1; return 0;
case SortBy.Type: case SortBy.Type:
return 0; return 0;
case SortBy.Modified: case SortBy.Modified:
return 2; return 1;
case SortBy.Size: case SortBy.Size:
return 3; return 2;
} }
}(model.getSortStyle(isLocal)); }(model.getSortStyle(isLocal));
final sortAscending = final sortAscending =
@ -202,16 +202,16 @@ class _FileManagerPageState extends State<FileManagerPage>
showCheckboxColumn: true, showCheckboxColumn: true,
dataRowHeight: 25, dataRowHeight: 25,
headingRowHeight: 30, headingRowHeight: 30,
horizontalMargin: 8,
columnSpacing: 8, columnSpacing: 8,
showBottomBorder: true, showBottomBorder: true,
sortColumnIndex: sortIndex, sortColumnIndex: sortIndex,
sortAscending: sortAscending, sortAscending: sortAscending,
columns: [ columns: [
DataColumn(label: Text(" ")), // icon
DataColumn( DataColumn(
label: Text( label: Text(
translate("Name"), translate("Name"),
), ).marginSymmetric(horizontal: 4),
onSort: (columnIndex, ascending) { onSort: (columnIndex, ascending) {
model.changeSortStyle(SortBy.Name, model.changeSortStyle(SortBy.Name,
isLocal: isLocal, ascending: ascending); isLocal: isLocal, ascending: ascending);
@ -251,19 +251,28 @@ class _FileManagerPageState extends State<FileManagerPage>
selected: selected:
getSelectedItem(isLocal).contains(entry), getSelectedItem(isLocal).contains(entry),
cells: [ cells: [
DataCell(Icon(
entry.isFile
? Icons.feed_outlined
: Icons.folder,
size: 25)),
DataCell( DataCell(
ConstrainedBox( ConstrainedBox(
constraints: constraints:
BoxConstraints(maxWidth: 100), BoxConstraints(maxWidth: 180),
child: Tooltip( child: Tooltip(
message: entry.name, message: entry.name,
child: Text(entry.name, child: Row(children: [
overflow: TextOverflow.ellipsis), Icon(
entry.isFile
? Icons.feed_outlined
: Icons.folder,
size: 20,
color: Theme.of(context)
.iconTheme
.color
?.withOpacity(0.7),
).marginSymmetric(horizontal: 2),
Expanded(
child: Text(entry.name,
overflow:
TextOverflow.ellipsis))
]),
)), onTap: () { )), onTap: () {
if (entry.isDirectory) { if (entry.isDirectory) {
openDirectory(entry.path, isLocal: isLocal); openDirectory(entry.path, isLocal: isLocal);
@ -284,15 +293,17 @@ class _FileManagerPageState extends State<FileManagerPage>
setState(() {}); setState(() {});
} }
}), }),
DataCell(Text( DataCell(FittedBox(
child: Text(
"${entry.lastModified().toString().replaceAll(".000", "")} ", "${entry.lastModified().toString().replaceAll(".000", "")} ",
style: TextStyle( style: TextStyle(
fontSize: 12, color: MyTheme.darkGray), fontSize: 12, color: MyTheme.darkGray),
)), ))),
DataCell(Text( DataCell(Text(
sizeStr, sizeStr,
overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontSize: 12, color: MyTheme.darkGray), fontSize: 10, color: MyTheme.darkGray),
)), )),
]); ]);
}).toList(growable: false), }).toList(growable: false),
@ -724,6 +735,11 @@ class _FileManagerPageState extends State<FileManagerPage>
final locationStatus = final locationStatus =
isLocal ? _locationStatusLocal : _locationStatusRemote; isLocal ? _locationStatusLocal : _locationStatusRemote;
final focusNode = isLocal ? _locationNodeLocal : _locationNodeRemote; final focusNode = isLocal ? _locationNodeLocal : _locationNodeRemote;
final text = locationStatus.value == LocationStatus.pathLocation
? model.getCurrentDir(isLocal).path
: searchTextObs.value;
final textController = TextEditingController(text: text)
..selection = TextSelection.collapsed(offset: text.length);
return Row(children: [ return Row(children: [
Icon( Icon(
locationStatus.value == LocationStatus.pathLocation locationStatus.value == LocationStatus.pathLocation
@ -738,11 +754,7 @@ class _FileManagerPageState extends State<FileManagerPage>
border: InputBorder.none, border: InputBorder.none,
isDense: true, isDense: true,
prefix: Padding(padding: EdgeInsets.only(left: 4.0))), prefix: Padding(padding: EdgeInsets.only(left: 4.0))),
controller: locationStatus.value == LocationStatus.pathLocation controller: textController,
? TextEditingController(text: model.getCurrentDir(isLocal).path)
: TextEditingController(text: searchTextObs.value)
..selection =
TextSelection.collapsed(offset: searchTextObs.value.length),
onSubmitted: (path) { onSubmitted: (path) {
openDirectory(path, isLocal: isLocal); openDirectory(path, isLocal: isLocal);
}, },