#65 new: custom keyboard type

This commit is contained in:
lollipopkit
2023-06-23 16:59:27 +08:00
parent 743e5bfbff
commit f0b31a9b08
15 changed files with 139 additions and 39 deletions

View File

@@ -606,6 +606,18 @@ abstract class S {
/// **'Key Auth'**
String get keyAuth;
/// No description provided for @keyboardCompatibility.
///
/// In en, this message translates to:
/// **'Possible to improve input method compatibility'**
String get keyboardCompatibility;
/// No description provided for @keyboardType.
///
/// In en, this message translates to:
/// **'Keyborad type'**
String get keyboardType;
/// No description provided for @language.
///
/// In en, this message translates to:

View File

@@ -279,6 +279,12 @@ class SDe extends S {
@override
String get keyAuth => 'Schlüsselauthentifzierung';
@override
String get keyboardCompatibility => 'Possible to improve input method compatibility';
@override
String get keyboardType => 'Keyborad type';
@override
String get language => 'Sprache';

View File

@@ -279,6 +279,12 @@ class SEn extends S {
@override
String get keyAuth => 'Key Auth';
@override
String get keyboardCompatibility => 'Possible to improve input method compatibility';
@override
String get keyboardType => 'Keyborad type';
@override
String get language => 'Language';

View File

@@ -279,6 +279,12 @@ class SZh extends S {
@override
String get keyAuth => '密钥认证';
@override
String get keyboardCompatibility => '可能会改善输入法兼容性';
@override
String get keyboardType => '键盘类型';
@override
String get language => '语言';
@@ -901,6 +907,12 @@ class SZhTw extends SZh {
@override
String get keyAuth => '密鑰認證';
@override
String get keyboardCompatibility => '可能會改善輸入法兼容性';
@override
String get keyboardType => '鍵盤類型';
@override
String get language => '語言';

View File

@@ -360,7 +360,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 361;
CURRENT_PROJECT_VERSION = 362;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -368,7 +368,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.361;
MARKETING_VERSION = 1.0.362;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -491,7 +491,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 361;
CURRENT_PROJECT_VERSION = 362;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -499,7 +499,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.361;
MARKETING_VERSION = 1.0.362;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -516,7 +516,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 361;
CURRENT_PROJECT_VERSION = 362;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -524,7 +524,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.361;
MARKETING_VERSION = 1.0.362;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";

View File

@@ -2,8 +2,8 @@
class BuildData {
static const String name = "ServerBox";
static const int build = 361;
static const int build = 362;
static const String engine = "3.10.0";
static const String buildAt = "2023-06-21 18:31:01.595350";
static const int modifications = 2;
static const String buildAt = "2023-06-23 16:49:18.940704";
static const int modifications = 14;
}

View File

@@ -1,3 +1,4 @@
import 'package:flutter/material.dart';
import 'package:toolbox/core/persistant_store.dart';
import 'package:toolbox/core/utils/platform.dart';
@@ -72,4 +73,7 @@ class SettingStore extends PersistentStore {
StoreProperty<bool> get fullScreenJitter =>
property('fullScreenJitter', defaultValue: true);
StoreProperty<int> get keyboardType =>
property('keyboardType', defaultValue: TextInputType.text.index);
}

View File

@@ -85,6 +85,8 @@
"isBusy": "Is busy now",
"keepForeground": "Keep app foreground!",
"keyAuth": "Key Auth",
"keyboardCompatibility": "Possible to improve input method compatibility",
"keyboardType": "Keyborad type",
"language": "Language",
"languageName": "English",
"lastTry": "Last try",

View File

@@ -85,6 +85,8 @@
"isBusy": "当前正忙",
"keepForeground": "请保持应用处于前台!",
"keyAuth": "密钥认证",
"keyboardCompatibility": "可能会改善输入法兼容性",
"keyboardType": "键盘类型",
"language": "语言",
"languageName": "简体中文",
"lastTry": "最后尝试",

View File

@@ -82,6 +82,8 @@
"isBusy": "當前正忙",
"keepForeground": "請保持應用處於前台!",
"keyAuth": "密鑰認證",
"keyboardCompatibility": "可能會改善輸入法兼容性",
"keyboardType": "鍵盤類型",
"language": "語言",
"languageName": "繁體中文",
"lastTry": "最後嘗試",

View File

@@ -292,12 +292,12 @@ class _HomePageState extends State<HomePage>
@override
Future<void> afterFirstLayout(BuildContext context) async {
doUpdate(context);
await GetIt.I.allReady();
await _serverProvider.loadLocalData();
await _serverProvider.refreshData();
await doUpdate(context);
if (!Analysis.enabled) {
await Analysis.init();
Analysis.init();
}
}
}

View File

@@ -100,6 +100,7 @@ class _ProcessPageState extends State<ProcessPage> {
} else {
child = ListView.builder(
itemCount: _result.procs.length,
padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 7),
itemBuilder: (ctx, idx) {
final proc = _result.procs[idx];
return _buildListItem(proc);

View File

@@ -35,13 +35,13 @@ class SettingPage extends StatefulWidget {
}
class _SettingPageState extends State<SettingPage> {
final themeKey = GlobalKey<PopupMenuButtonState<int>>();
final startPageKey = GlobalKey<PopupMenuButtonState<int>>();
final updateIntervalKey = GlobalKey<PopupMenuButtonState<int>>();
final maxRetryKey = GlobalKey<PopupMenuButtonState<int>>();
final fontSizeKey = GlobalKey<PopupMenuButtonState<double>>();
final localeKey = GlobalKey<PopupMenuButtonState<String>>();
final editorThemeKey = GlobalKey<PopupMenuButtonState<String>>();
final _themeKey = GlobalKey<PopupMenuButtonState<int>>();
final _startPageKey = GlobalKey<PopupMenuButtonState<int>>();
final _updateIntervalKey = GlobalKey<PopupMenuButtonState<int>>();
final _maxRetryKey = GlobalKey<PopupMenuButtonState<int>>();
final _localeKey = GlobalKey<PopupMenuButtonState<String>>();
final _editorThemeKey = GlobalKey<PopupMenuButtonState<String>>();
final _keyboardTypeKey = GlobalKey<PopupMenuButtonState<int>>();
late final SettingStore _setting;
late final ServerProvider _serverProvider;
@@ -56,6 +56,7 @@ class _SettingPageState extends State<SettingPage> {
final _fontSize = ValueNotifier(0.0);
final _localeCode = ValueNotifier('');
final _editorTheme = ValueNotifier('');
final _keyboardType = ValueNotifier(0);
final _pushToken = ValueNotifier<String?>(null);
@@ -79,6 +80,7 @@ class _SettingPageState extends State<SettingPage> {
_selectedColorValue.value = _setting.primaryColor.fetch()!;
_fontSize.value = _setting.termFontSize.fetch()!;
_editorTheme.value = _setting.editorTheme.fetch()!;
_keyboardType.value = _setting.keyboardType.fetch()!;
}
@override
@@ -157,6 +159,7 @@ class _SettingPageState extends State<SettingPage> {
_buildFont(),
_buildTermFontSize(),
_buildSSHVirtualKeyAutoOff(),
_buildKeyboardType(),
].map((e) => RoundRectCard(e)).toList(),
);
}
@@ -212,12 +215,12 @@ class _SettingPageState extends State<SettingPage> {
style: grey,
),
onTap: () {
updateIntervalKey.currentState?.showButtonMenu();
_updateIntervalKey.currentState?.showButtonMenu();
},
trailing: ValueBuilder(
listenable: _updateInterval,
build: () => PopupMenuButton(
key: updateIntervalKey,
key: _updateIntervalKey,
itemBuilder: (_) => items,
initialValue: _updateInterval.value,
onSelected: (int val) {
@@ -291,12 +294,12 @@ class _SettingPageState extends State<SettingPage> {
_s.launchPage,
),
onTap: () {
startPageKey.currentState?.showButtonMenu();
_startPageKey.currentState?.showButtonMenu();
},
trailing: ValueBuilder(
listenable: _launchPageIdx,
build: () => PopupMenuButton(
key: startPageKey,
key: _startPageKey,
itemBuilder: (BuildContext context) => items,
initialValue: _launchPageIdx.value,
onSelected: (int idx) {
@@ -335,11 +338,11 @@ class _SettingPageState extends State<SettingPage> {
),
subtitle: Text(help, style: grey),
onTap: () {
maxRetryKey.currentState?.showButtonMenu();
_maxRetryKey.currentState?.showButtonMenu();
},
trailing: ValueBuilder(
build: () => PopupMenuButton(
key: maxRetryKey,
key: _maxRetryKey,
itemBuilder: (BuildContext context) => items,
initialValue: _maxRetryCount.value,
onSelected: (int val) {
@@ -374,12 +377,12 @@ class _SettingPageState extends State<SettingPage> {
_s.themeMode,
),
onTap: () {
themeKey.currentState?.showButtonMenu();
_themeKey.currentState?.showButtonMenu();
},
trailing: ValueBuilder(
listenable: _nightMode,
build: () => PopupMenuButton(
key: themeKey,
key: _themeKey,
itemBuilder: (BuildContext context) => items,
initialValue: _nightMode.value,
onSelected: (int idx) {
@@ -601,12 +604,12 @@ class _SettingPageState extends State<SettingPage> {
return ListTile(
title: Text(_s.language),
onTap: () {
localeKey.currentState?.showButtonMenu();
_localeKey.currentState?.showButtonMenu();
},
trailing: ValueBuilder(
listenable: _localeCode,
build: () => PopupMenuButton(
key: localeKey,
key: _localeKey,
itemBuilder: (BuildContext context) => items,
initialValue: _localeCode.value,
onSelected: (String idx) {
@@ -644,7 +647,7 @@ class _SettingPageState extends State<SettingPage> {
trailing: ValueBuilder(
listenable: _editorTheme,
build: () => PopupMenuButton(
key: editorThemeKey,
key: _editorThemeKey,
itemBuilder: (BuildContext context) => items,
initialValue: _editorTheme.value,
onSelected: (String idx) {
@@ -658,7 +661,7 @@ class _SettingPageState extends State<SettingPage> {
),
),
onTap: () {
editorThemeKey.currentState?.showButtonMenu();
_editorThemeKey.currentState?.showButtonMenu();
},
);
}
@@ -681,4 +684,54 @@ class _SettingPageState extends State<SettingPage> {
trailing: buildSwitch(context, _setting.fullScreenJitter),
);
}
Widget _buildKeyboardType() {
const List<String> names = <String>[
'text',
'multiline',
'number',
'phone',
'datetime',
'emailAddress',
'url',
'visiblePassword',
'name',
'address',
'none',
];
if (names.length != TextInputType.values.length) {
throw 'names.length != TextInputType.values.length';
}
final items = TextInputType.values.map(
(key) {
return PopupMenuItem<int>(
value: key.index,
child: Text(names[key.index]),
);
},
).toList();
return ListTile(
title: Text(_s.keyboardType),
subtitle: Text(_s.keyboardCompatibility, style: grey),
trailing: ValueBuilder(
listenable: _keyboardType,
build: () => PopupMenuButton<int>(
key: _keyboardTypeKey,
itemBuilder: (BuildContext context) => items,
initialValue: _keyboardType.value,
onSelected: (idx) {
_keyboardType.value = idx;
_setting.keyboardType.put(idx);
},
child: Text(
names[_keyboardType.value],
style: textSize15,
),
),
),
onTap: () {
_keyboardTypeKey.currentState?.showButtonMenu();
},
);
}
}

View File

@@ -48,6 +48,7 @@ class _SSHPageState extends State<SSHPage> {
late S _s;
late TerminalStyle _terminalStyle;
late TerminalTheme _terminalTheme;
late TextInputType _keyboardType;
var _isDark = false;
@@ -60,6 +61,7 @@ class _SSHPageState extends State<SSHPage> {
fontSize: _setting.termFontSize.fetch()!,
);
_terminalStyle = TerminalStyle.fromTextStyle(textStyle);
_keyboardType = TextInputType.values[_setting.keyboardType.fetch()!];
initTerminal();
}
@@ -96,8 +98,6 @@ class _SSHPageState extends State<SSHPage> {
}
Widget _buildBody() {
final keyboardType =
isIOS ? TextInputType.emailAddress : TextInputType.visiblePassword;
return SizedBox(
height: _media.size.height -
_virtualKeyboardHeight -
@@ -106,7 +106,7 @@ class _SSHPageState extends State<SSHPage> {
child: TerminalView(
_terminal,
controller: _terminalController,
keyboardType: keyboardType,
keyboardType: _keyboardType,
textStyle: _terminalStyle,
theme: _terminalTheme,
deleteDetection: isIOS,

View File

@@ -475,9 +475,9 @@
baseConfigurationReference = C1C758C41C4E208965A68933 /* Pods-RunnerTests.debug.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CURRENT_PROJECT_VERSION = 361;
CURRENT_PROJECT_VERSION = 362;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0.361;
MARKETING_VERSION = 1.0.362;
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
@@ -490,9 +490,9 @@
baseConfigurationReference = 15AF97DF993E8968098D6EBE /* Pods-RunnerTests.release.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CURRENT_PROJECT_VERSION = 361;
CURRENT_PROJECT_VERSION = 362;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0.361;
MARKETING_VERSION = 1.0.362;
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
@@ -505,9 +505,9 @@
baseConfigurationReference = 7CFA7DE7FABA75685DFB6948 /* Pods-RunnerTests.profile.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CURRENT_PROJECT_VERSION = 361;
CURRENT_PROJECT_VERSION = 362;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0.361;
MARKETING_VERSION = 1.0.362;
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;