mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-02-23 08:34:39 +01:00
opt: settings page
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
|
||||
@@ -23,15 +23,6 @@ Future<bool> shareFiles(BuildContext context, List<String> filePaths) async {
|
||||
return filePaths.isNotEmpty;
|
||||
}
|
||||
|
||||
bool get longPressEnabled {
|
||||
switch (defaultTargetPlatform) {
|
||||
case TargetPlatform.android:
|
||||
case TargetPlatform.iOS:
|
||||
return true;
|
||||
case TargetPlatform.macOS:
|
||||
case TargetPlatform.fuchsia:
|
||||
case TargetPlatform.linux:
|
||||
case TargetPlatform.windows:
|
||||
return false;
|
||||
}
|
||||
void copy(String text) {
|
||||
Clipboard.setData(ClipboardData(text: text));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:toolbox/data/res/terminal_color.dart';
|
||||
import 'package:xterm/ui.dart';
|
||||
import '../../res/terminal_color.dart';
|
||||
|
||||
class TerminalUITheme {
|
||||
final Color cursor;
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 214;
|
||||
static const int build = 215;
|
||||
static const String engine =
|
||||
"Flutter 3.7.0 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision b06b8b2710 (10 days ago) • 2023-01-23 16:55:55 -0800\nEngine • revision b24591ed32\nTools • Dart 2.19.0 • DevTools 2.20.1\n";
|
||||
static const String buildAt = "2023-02-03 12:48:35.264858";
|
||||
static const int modifications = 12;
|
||||
"Flutter 3.7.0 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision b06b8b2710 (13 days ago) • 2023-01-23 16:55:55 -0800\nEngine • revision b24591ed32\nTools • Dart 2.19.0 • DevTools 2.20.1\n";
|
||||
static const String buildAt = "2023-02-05 22:11:13.992594";
|
||||
static const int modifications = 9;
|
||||
}
|
||||
|
||||
@@ -27,5 +27,6 @@ class SettingStore extends PersistentStore {
|
||||
property('termColorIdx', defaultValue: 0);
|
||||
|
||||
/// Max retry count when connect to server
|
||||
StoreProperty<int> get maxRetryCount => property('maxRetryCount', defaultValue: 7);
|
||||
StoreProperty<int> get maxRetryCount =>
|
||||
property('maxRetryCount', defaultValue: 7);
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"loss": MessageLookupByLibrary.simpleMessage("丢包率"),
|
||||
"madeWithLove": m8,
|
||||
"max": MessageLookupByLibrary.simpleMessage("最大"),
|
||||
"maxRetryCount": MessageLookupByLibrary.simpleMessage("连接服务器重试次数"),
|
||||
"maxRetryCount": MessageLookupByLibrary.simpleMessage("服务器尝试重连次数"),
|
||||
"maxRetryCountEqual0": MessageLookupByLibrary.simpleMessage("会无限重试"),
|
||||
"min": MessageLookupByLibrary.simpleMessage("最小"),
|
||||
"ms": MessageLookupByLibrary.simpleMessage("毫秒"),
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
"loss": "丢包率",
|
||||
"madeWithLove": "\n用❤️制作 by {myGithub}",
|
||||
"max": "最大",
|
||||
"maxRetryCount": "连接服务器重试次数",
|
||||
"maxRetryCount": "服务器尝试重连次数",
|
||||
"maxRetryCountEqual0": "会无限重试",
|
||||
"min": "最小",
|
||||
"ms": "毫秒",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_material_color_picker/flutter_material_color_picker.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:toolbox/data/model/ssh/terminal_color.dart';
|
||||
|
||||
import '../../data/model/ssh/terminal_color.dart';
|
||||
import '../../core/update.dart';
|
||||
import '../../core/utils/ui.dart';
|
||||
import '../../data/provider/app.dart';
|
||||
@@ -60,20 +60,52 @@ class _SettingPageState extends State<SettingPage> {
|
||||
title: Text(_s.setting),
|
||||
),
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.all(17),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 17),
|
||||
children: [
|
||||
_buildAppColorPreview(),
|
||||
_buildUpdateInterval(),
|
||||
_buildCheckUpdate(),
|
||||
_buildLaunchPage(),
|
||||
_buildDistLogoSwitch(),
|
||||
_buildTermTheme(),
|
||||
_buildMaxRetry(),
|
||||
].map((e) => RoundRectCard(e)).toList(),
|
||||
// App
|
||||
_buildTitle('App'),
|
||||
_buildApp(),
|
||||
// Server
|
||||
_buildTitle(_s.server),
|
||||
_buildServer(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTitle(String text) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 23, bottom: 17),
|
||||
child: Center(
|
||||
child: Text(
|
||||
text,
|
||||
style: textSize13,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildApp() {
|
||||
return Column(
|
||||
children: [
|
||||
_buildAppColorPreview(),
|
||||
_buildLaunchPage(),
|
||||
_buildCheckUpdate(),
|
||||
].map((e) => RoundRectCard(e)).toList(),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildServer() {
|
||||
return Column(
|
||||
children: [
|
||||
_buildDistLogoSwitch(),
|
||||
_buildUpdateInterval(),
|
||||
_buildTermTheme(),
|
||||
_buildMaxRetry(),
|
||||
].map((e) => RoundRectCard(e)).toList(),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDistLogoSwitch() {
|
||||
return ListTile(
|
||||
title: Text(
|
||||
@@ -126,7 +158,10 @@ class _SettingPageState extends State<SettingPage> {
|
||||
_s.willTakEeffectImmediately,
|
||||
style: textSize13Grey,
|
||||
),
|
||||
trailing: Text('${_updateInterval.toInt()} ${_s.second}'),
|
||||
trailing: Text(
|
||||
'${_updateInterval.toInt()} ${_s.second}',
|
||||
style: textSize13,
|
||||
),
|
||||
children: [
|
||||
Slider(
|
||||
thumbColor: primaryColor,
|
||||
@@ -298,7 +333,10 @@ class _SettingPageState extends State<SettingPage> {
|
||||
style: textSize13,
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
trailing: Text('${_maxRetryCount.toInt()} ${_s.times}'),
|
||||
trailing: Text(
|
||||
'${_maxRetryCount.toInt()} ${_s.times}',
|
||||
style: textSize13,
|
||||
),
|
||||
children: [
|
||||
Slider(
|
||||
thumbColor: primaryColor,
|
||||
|
||||
@@ -6,10 +6,11 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:toolbox/data/model/ssh/terminal_color.dart';
|
||||
import 'package:toolbox/generated/l10n.dart';
|
||||
import 'package:xterm/xterm.dart';
|
||||
import 'package:xterm/xterm.dart' hide TerminalColors;
|
||||
|
||||
import '../../data/model/ssh/terminal_color.dart';
|
||||
import '../../generated/l10n.dart';
|
||||
import '../../core/utils/misc.dart';
|
||||
import '../../core/utils/ui.dart';
|
||||
import '../../core/utils/server.dart';
|
||||
import '../../data/model/server/server_private_info.dart';
|
||||
@@ -132,7 +133,7 @@ class _SSHPageState extends State<SSHPage> {
|
||||
theme: termTheme,
|
||||
deleteDetection: Platform.isIOS,
|
||||
onTapUp: _onTapUp,
|
||||
autofocus: true,
|
||||
autoFocus: true,
|
||||
keyboardAppearance: _isDark ? Brightness.dark : Brightness.light,
|
||||
),
|
||||
);
|
||||
@@ -249,7 +250,7 @@ class _SSHPageState extends State<SSHPage> {
|
||||
_paste();
|
||||
break;
|
||||
case VirtualKeyFunc.copy:
|
||||
_copy(terminalSelected);
|
||||
copy(terminalSelected);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -270,10 +271,6 @@ class _SSHPageState extends State<SSHPage> {
|
||||
return _terminal.buffer.getText(range);
|
||||
}
|
||||
|
||||
void _copy(String text) {
|
||||
Clipboard.setData(ClipboardData(text: text));
|
||||
}
|
||||
|
||||
void _onTapUp(TapUpDetails details, CellOffset offset) {
|
||||
{
|
||||
if (_menuController.isShown) {
|
||||
@@ -319,7 +316,7 @@ class _SSHPageState extends State<SSHPage> {
|
||||
),
|
||||
onPressed: () {
|
||||
_terminalController.setSelection(null);
|
||||
_copy(selected);
|
||||
copy(selected);
|
||||
_menuController.remove();
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user