mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-02-23 16:45:27 +01:00
new & opt
new: support set maxRetryCount of server reconnection opt: server detail UI opt: server provider opt: `ssh` page on Android
This commit is contained in:
@@ -345,7 +345,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
'${ns.speedIn(device: device)} | ${ns.totalIn(device: device)}',
|
||||
style: textSize11,
|
||||
textAlign: TextAlign.center,
|
||||
textScaleFactor: 0.87,
|
||||
textScaleFactor: 0.9,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
@@ -354,7 +354,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
'${ns.speedOut(device: device)} | ${ns.totalOut(device: device)}',
|
||||
style: textSize11,
|
||||
textAlign: TextAlign.right,
|
||||
textScaleFactor: 0.87,
|
||||
textScaleFactor: 0.9,
|
||||
),
|
||||
)
|
||||
],
|
||||
|
||||
@@ -73,7 +73,7 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
||||
[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
_serverProvider.delServer(widget.spi!);
|
||||
_serverProvider.delServer(widget.spi!.id);
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
|
||||
@@ -123,13 +123,12 @@ class _ServerPageState extends State<ServerPage>
|
||||
}
|
||||
|
||||
Widget _buildRealServerCard(ServerStatus ss, String serverName,
|
||||
ServerConnectionState cs, ServerPrivateInfo spi) {
|
||||
ServerState cs, ServerPrivateInfo spi) {
|
||||
final rootDisk = ss.disk.firstWhere((element) => element.loc == '/');
|
||||
|
||||
final topRightStr =
|
||||
getTopRightStr(cs, ss.cpu.temp, ss.uptime, ss.failedInfo);
|
||||
final hasError =
|
||||
cs == ServerConnectionState.failed && ss.failedInfo != null;
|
||||
final hasError = cs == ServerState.failed && ss.failedInfo != null;
|
||||
final style = TextStyle(
|
||||
color: _theme.textTheme.bodyLarge!.color!.withAlpha(100), fontSize: 11);
|
||||
|
||||
@@ -288,12 +287,12 @@ class _ServerPageState extends State<ServerPage>
|
||||
);
|
||||
}
|
||||
|
||||
String getTopRightStr(ServerConnectionState cs, String temp, String upTime,
|
||||
String? failedInfo) {
|
||||
String getTopRightStr(
|
||||
ServerState cs, String temp, String upTime, String? failedInfo) {
|
||||
switch (cs) {
|
||||
case ServerConnectionState.disconnected:
|
||||
case ServerState.disconnected:
|
||||
return _s.disconnected;
|
||||
case ServerConnectionState.connected:
|
||||
case ServerState.connected:
|
||||
if (temp == '') {
|
||||
if (upTime == '') {
|
||||
return _s.serverTabLoading;
|
||||
@@ -307,9 +306,9 @@ class _ServerPageState extends State<ServerPage>
|
||||
return '$temp | $upTime';
|
||||
}
|
||||
}
|
||||
case ServerConnectionState.connecting:
|
||||
case ServerState.connecting:
|
||||
return _s.serverTabConnecting;
|
||||
case ServerConnectionState.failed:
|
||||
case ServerState.failed:
|
||||
if (failedInfo == null) {
|
||||
return _s.serverTabFailed;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
late int _selectedColorValue;
|
||||
late int _launchPageIdx;
|
||||
late int _termThemeIdx;
|
||||
late double _maxRetryCount;
|
||||
late double _updateInterval;
|
||||
|
||||
@override
|
||||
@@ -49,6 +50,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
_launchPageIdx = _setting.launchPage.fetch()!;
|
||||
_termThemeIdx = _setting.termColorIdx.fetch()!;
|
||||
_updateInterval = _setting.serverStatusUpdateInterval.fetch()!.toDouble();
|
||||
_maxRetryCount = _setting.maxRetryCount.fetch()!.toDouble();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -66,6 +68,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
_buildLaunchPage(),
|
||||
_buildDistLogoSwitch(),
|
||||
_buildTermTheme(),
|
||||
_buildMaxRetry(),
|
||||
].map((e) => RoundRectCard(e)).toList(),
|
||||
),
|
||||
);
|
||||
@@ -286,4 +289,48 @@ class _SettingPageState extends State<SettingPage> {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMaxRetry() {
|
||||
return ExpansionTile(
|
||||
textColor: primaryColor,
|
||||
title: Text(
|
||||
_s.maxRetryCount,
|
||||
style: textSize13,
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
trailing: Text('${_maxRetryCount.toInt()} ${_s.times}'),
|
||||
children: [
|
||||
Slider(
|
||||
thumbColor: primaryColor,
|
||||
activeColor: primaryColor.withOpacity(0.7),
|
||||
min: 0,
|
||||
max: 10,
|
||||
value: _maxRetryCount,
|
||||
onChanged: (newValue) {
|
||||
setState(() {
|
||||
_maxRetryCount = newValue;
|
||||
});
|
||||
},
|
||||
onChangeEnd: (val) {
|
||||
_setting.maxRetryCount.put(val.toInt());
|
||||
},
|
||||
label: '${_maxRetryCount.toInt()} ${_s.times}',
|
||||
divisions: 10,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 3,
|
||||
),
|
||||
_maxRetryCount == 0.0
|
||||
? Text(
|
||||
_s.maxRetryCountEqual0,
|
||||
style: const TextStyle(color: Colors.grey, fontSize: 12),
|
||||
textAlign: TextAlign.center,
|
||||
)
|
||||
: const SizedBox(),
|
||||
const SizedBox(
|
||||
height: 13,
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ class _SFTPPageState extends State<SFTPPage> {
|
||||
);
|
||||
|
||||
Widget _buildFileView() {
|
||||
if (_client == null || _si?.cs != ServerConnectionState.connected) {
|
||||
if (_client == null || _si?.cs != ServerState.connected) {
|
||||
return centerCircleLoading;
|
||||
}
|
||||
|
||||
|
||||
@@ -105,14 +105,18 @@ class _SSHPageState extends State<SSHPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final termTheme = _isDark ? termDarkTheme : termLightTheme;
|
||||
return AnnotatedRegion(
|
||||
value: _isDark ? SystemUiOverlayStyle.light : SystemUiOverlayStyle.dark,
|
||||
child: Scaffold(
|
||||
backgroundColor: termTheme.background,
|
||||
body: _buildBody(termTheme.toTerminalTheme(_termColors)),
|
||||
bottomNavigationBar: _buildBottom(termTheme.background),
|
||||
),
|
||||
Widget child = Scaffold(
|
||||
backgroundColor: termTheme.background,
|
||||
body: _buildBody(termTheme.toTerminalTheme(_termColors)),
|
||||
bottomNavigationBar: _buildBottom(termTheme.background),
|
||||
);
|
||||
if (Platform.isIOS) {
|
||||
child = AnnotatedRegion(
|
||||
value: _isDark ? SystemUiOverlayStyle.light : SystemUiOverlayStyle.dark,
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
return child;
|
||||
}
|
||||
|
||||
Widget _buildBody(TerminalTheme termTheme) {
|
||||
|
||||
Reference in New Issue
Block a user