mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
feat: Automatic line wrapping of time (#973)
This commit is contained in:
@@ -177,16 +177,39 @@ extension _UI on _SftpPageState {
|
|||||||
|
|
||||||
Widget _buildItem(SftpName file, {VoidCallback? beforeTap}) {
|
Widget _buildItem(SftpName file, {VoidCallback? beforeTap}) {
|
||||||
final isDir = file.attr.isDirectory;
|
final isDir = file.attr.isDirectory;
|
||||||
final trailing = Text(
|
final double screenWidth = MediaQuery.of(context).size.width;
|
||||||
'${_getTime(file.attr.modifyTime)}\n${file.attr.mode?.str ?? ''}',
|
if (screenWidth < 350) {
|
||||||
style: UIs.textGrey,
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
);
|
|
||||||
return CardX(
|
return CardX(
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
leading: Icon(isDir ? Icons.folder_outlined : Icons.insert_drive_file),
|
leading: Icon(isDir ? Icons.folder_outlined : Icons.insert_drive_file),
|
||||||
title: Text(file.filename),
|
title: Text(file.filename),
|
||||||
trailing: trailing,
|
subtitle: isDir ? Text('${_getTime(file.attr.modifyTime)}\n${file.attr.mode?.str ?? ''}', style: UIs.textGrey) :
|
||||||
|
Text('${(file.attr.size ?? 0).bytes2Str}\n${_getTime(file.attr.modifyTime)}\n${file.attr.mode?.str ?? ''}', style: UIs.textGrey),
|
||||||
|
onTap: () {
|
||||||
|
beforeTap?.call();
|
||||||
|
if (isDir) {
|
||||||
|
_status.path.path = file.filename;
|
||||||
|
_listDir();
|
||||||
|
} else {
|
||||||
|
_onItemPress(file, true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLongPress: () {
|
||||||
|
beforeTap?.call();
|
||||||
|
_onItemPress(file, !isDir);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return CardX(
|
||||||
|
child: ListTile(
|
||||||
|
leading: Icon(isDir ? Icons.folder_outlined : Icons.insert_drive_file),
|
||||||
|
title: Text(file.filename),
|
||||||
|
trailing: Text(
|
||||||
|
'${_getTime(file.attr.modifyTime)}\n${file.attr.mode?.str ?? ''}',
|
||||||
|
style: UIs.textGrey,
|
||||||
|
textAlign: TextAlign.right,
|
||||||
|
),
|
||||||
subtitle: isDir ? null : Text((file.attr.size ?? 0).bytes2Str, style: UIs.textGrey),
|
subtitle: isDir ? null : Text((file.attr.size ?? 0).bytes2Str, style: UIs.textGrey),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
beforeTap?.call();
|
beforeTap?.call();
|
||||||
@@ -204,6 +227,7 @@ extension _UI on _SftpPageState {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension _Actions on _SftpPageState {
|
extension _Actions on _SftpPageState {
|
||||||
|
|||||||
Reference in New Issue
Block a user