mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
15
lib/core/extension/sftpfile.dart
Normal file
15
lib/core/extension/sftpfile.dart
Normal 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' : '-'}';
|
||||
}
|
||||
@@ -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),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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', '');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user