mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-02-01 05:45:04 +01:00
opt.: android only arm64 & ssh tab page
This commit is contained in:
9
lib/core/extension/listx.dart
Normal file
9
lib/core/extension/listx.dart
Normal file
@@ -0,0 +1,9 @@
|
||||
extension ListX<T> on List<T> {
|
||||
List<T> joinWith(T item, [bool self = true]) {
|
||||
final list = self ? this : List<T>.from(this);
|
||||
for (var i = length - 1; i > 0; i--) {
|
||||
list.insert(i, item);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -2,14 +2,14 @@ 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);
|
||||
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) {
|
||||
String _getRoleMode(bool r, bool w, bool x) {
|
||||
return '${r ? 'r' : '-'}${w ? 'w' : '-'}${x ? 'x' : '-'}';
|
||||
}
|
||||
|
||||
@@ -37,10 +37,14 @@ Future<void> loadFontFile(String localPath) async {
|
||||
|
||||
void switchStatusBar({required bool hide}) {
|
||||
if (hide) {
|
||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky,
|
||||
overlays: []);
|
||||
SystemChrome.setEnabledSystemUIMode(
|
||||
SystemUiMode.immersiveSticky,
|
||||
overlays: [],
|
||||
);
|
||||
} else {
|
||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge,
|
||||
overlays: [SystemUiOverlay.top, SystemUiOverlay.bottom]);
|
||||
SystemChrome.setEnabledSystemUIMode(
|
||||
SystemUiMode.edgeToEdge,
|
||||
overlays: [SystemUiOverlay.top, SystemUiOverlay.bottom],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,8 +33,7 @@ enum ShellFunc {
|
||||
|
||||
/// Issue #168
|
||||
/// Use `sh` for compatibility
|
||||
static final installShellCmd =
|
||||
"""
|
||||
static final installShellCmd = """
|
||||
mkdir -p $_homeVar/$_srvBoxDir
|
||||
cat << 'EOF' > $_installShellPath
|
||||
${ShellFunc.allScript}
|
||||
@@ -135,8 +134,7 @@ fi''';
|
||||
|
||||
static final String allScript = () {
|
||||
final sb = StringBuffer();
|
||||
sb.write(
|
||||
'''
|
||||
sb.write('''
|
||||
#!/bin/sh
|
||||
# Script for ServerBox app v1.0.${BuildData.build}
|
||||
# DO NOT delete this file while app is running
|
||||
@@ -155,8 +153,7 @@ userId=\$(id -u)
|
||||
''');
|
||||
// Write each func
|
||||
for (final func in values) {
|
||||
sb.write(
|
||||
'''
|
||||
sb.write('''
|
||||
${func.name}() {
|
||||
${func._cmd.split('\n').map((e) => '\t$e').join('\n')}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 649;
|
||||
static const int build = 653;
|
||||
static const String engine = "3.16.0";
|
||||
static const String buildAt = "2023-11-23 22:29:30";
|
||||
static const int modifications = 11;
|
||||
static const int script = 29;
|
||||
static const String buildAt = "2023-11-27 19:18:56";
|
||||
static const int modifications = 3;
|
||||
static const int script = 30;
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ class SettingStore extends PersistentStore {
|
||||
|
||||
/// Server func btns display name
|
||||
late final serverFuncBtnsDisplayName =
|
||||
StoreProperty(box, 'serverFuncBtnsDisplayName', true);
|
||||
StoreProperty(box, 'serverFuncBtnsDisplayName', false);
|
||||
|
||||
// Never show these settings for users
|
||||
//
|
||||
|
||||
@@ -581,9 +581,6 @@ class _ServerPageState extends State<ServerPage>
|
||||
if (failedInfo == null) {
|
||||
return l10n.serverTabFailed;
|
||||
}
|
||||
if (failedInfo.contains('encypted')) {
|
||||
return l10n.serverTabPlzSave;
|
||||
}
|
||||
return failedInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ class _ServerDetailOrderPageState extends State<ServerDetailOrderPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: CustomAppBar(
|
||||
title: Text(l10n.serverOrder),
|
||||
title: Text(l10n.serverDetailOrder),
|
||||
),
|
||||
body: _buildBody(),
|
||||
);
|
||||
|
||||
@@ -41,8 +41,7 @@ class _ServerOrderPageState extends State<ServerOrderPage> {
|
||||
}),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 7, vertical: 3),
|
||||
buildDefaultDragHandles: false,
|
||||
itemBuilder: (_, index) =>
|
||||
_buildItem(index, Pros.server.serverOrder[index]),
|
||||
itemBuilder: (_, idx) => _buildItem(idx, Pros.server.serverOrder[idx]),
|
||||
itemCount: Pros.server.serverOrder.length,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ class _SSHTabPageState extends State<SSHTabPage>
|
||||
late final _tabIds = <String, Widget>{
|
||||
l10n.add: _buildAddPage(),
|
||||
};
|
||||
final _tabKeys = <String, GlobalKey>{};
|
||||
late var _tabController = TabController(
|
||||
length: _tabIds.length,
|
||||
vsync: this,
|
||||
@@ -34,6 +33,7 @@ class _SSHTabPageState extends State<SSHTabPage>
|
||||
controller: _tabController,
|
||||
tabs: _tabIds.keys.map(_buildTabItem).toList(),
|
||||
isScrollable: true,
|
||||
tabAlignment: TabAlignment.start,
|
||||
dividerColor: Colors.transparent,
|
||||
),
|
||||
body: _buildBody(),
|
||||
@@ -75,7 +75,6 @@ class _SSHTabPageState extends State<SSHTabPage>
|
||||
}
|
||||
_tabIds.remove(e);
|
||||
_refreshTabs();
|
||||
//_tabKeys[e]?.currentState?.dispose();
|
||||
},
|
||||
),
|
||||
],
|
||||
@@ -107,7 +106,6 @@ class _SSHTabPageState extends State<SSHTabPage>
|
||||
spi: spi,
|
||||
pop: false,
|
||||
);
|
||||
_tabKeys[name] = key;
|
||||
_refreshTabs();
|
||||
_tabController.animateTo(_tabIds.length - 1);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user