#24 #25 #33 new: sftp file edit

This commit is contained in:
lollipopkit
2023-05-28 18:21:03 +08:00
parent dbabe81e3c
commit 06be4503ca
28 changed files with 329 additions and 173 deletions

View File

@@ -0,0 +1,15 @@
import 'package:dartssh2/dartssh2.dart';
extension SftpFile on SftpFileMode {
String get str {
final user = getRoleMode(userRead, userWrite, userExecute);
final group = getRoleMode(groupRead, groupWrite, groupExecute);
final other = getRoleMode(otherRead, otherWrite, otherExecute);
return '$user$group$other';
}
}
String getRoleMode(bool r, bool w, bool x) {
return '${r ? 'r' : '-'}${w ? 'w' : '-'}${x ? 'x' : '-'}';
}

View File

@@ -7,8 +7,11 @@ class AppRoute {
AppRoute(this.page, this.title);
void go(BuildContext context) {
Future<T?> go<T>(BuildContext context) {
Analysis.recordView(title);
Navigator.push(context, MaterialPageRoute(builder: (context) => page));
return Navigator.push<T>(
context,
MaterialPageRoute(builder: (context) => page),
);
}
}

View File

@@ -67,3 +67,9 @@ String? getFileName(String? path) {
void rebuildAll(BuildContext context) {
RebuildWidget.restartApp(context);
}
String getTime(int? unixMill) {
return DateTime.fromMillisecondsSinceEpoch((unixMill ?? 0) * 1000)
.toString()
.replaceFirst('.000', '');
}