readd: paste in ssh

This commit is contained in:
lollipopkit
2023-04-17 12:55:47 +08:00
parent bf22309fe5
commit 9e503e4901
6 changed files with 60 additions and 57 deletions

View File

@@ -359,7 +359,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 256;
CURRENT_PROJECT_VERSION = 260;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -367,7 +367,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.256;
MARKETING_VERSION = 1.0.260;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -490,7 +490,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 256;
CURRENT_PROJECT_VERSION = 260;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -498,7 +498,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.256;
MARKETING_VERSION = 1.0.260;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -515,7 +515,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 256;
CURRENT_PROJECT_VERSION = 260;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -523,7 +523,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.256;
MARKETING_VERSION = 1.0.260;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";

View File

@@ -2,9 +2,8 @@
class BuildData {
static const String name = "ServerBox";
static const int build = 256;
static const String engine =
"Flutter 3.7.7 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 2ad6cd72c0 (4 weeks ago) • 2023-03-08 09:41:59 -0800\nEngine • revision 1837b5be5f\nTools • Dart 2.19.4 • DevTools 2.20.1\n";
static const String buildAt = "2023-04-05 15:16:00.949501";
static const int modifications = 2;
static const int build = 260;
static const String engine = "Flutter 3.7.7 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 2ad6cd72c0 (6 weeks ago) • 2023-03-08 09:41:59 -0800\nEngine • revision 1837b5be5f\nTools • Dart 2.19.4 • DevTools 2.20.1\n";
static const String buildAt = "2023-04-16 22:22:23.410508";
static const int modifications = 3;
}

View File

@@ -9,17 +9,18 @@ var virtualKeys = [
VirtualKey('Home', key: TerminalKey.home),
VirtualKey('Up', key: TerminalKey.arrowUp, icon: Icons.arrow_upward),
VirtualKey('End', key: TerminalKey.end),
// VirtualKey(
// 'Del',
// key: TerminalKey.delete,
// ),
//VirtualKey('Paste', func: VirtualKeyFunc.paste, icon: Icons.paste),
VirtualKey(
'Del',
key: TerminalKey.delete,
icon: Icons.backspace,
),
VirtualKey('Snippet', func: VirtualKeyFunc.snippet, icon: Icons.code),
VirtualKey('Tab', key: TerminalKey.tab),
VirtualKey('Ctrl', key: TerminalKey.control, toggleable: true),
VirtualKey('Left', key: TerminalKey.arrowLeft, icon: Icons.arrow_back),
VirtualKey('Down', key: TerminalKey.arrowDown, icon: Icons.arrow_downward),
VirtualKey('Right', key: TerminalKey.arrowRight, icon: Icons.arrow_forward),
VirtualKey('Paste', func: VirtualKeyFunc.paste, icon: Icons.paste),
VirtualKey(
'IME',
func: VirtualKeyFunc.toggleIME,

View File

@@ -42,6 +42,9 @@ class _SSHPageState extends State<SSHPage> {
late TextStyle _menuTextStyle;
late TerminalColors _termColors;
late S _s;
late TerminalStyle _terminalStyle;
late TerminalUITheme _termUITheme;
late TerminalTheme _terminalTheme;
var _isDark = false;
@@ -50,6 +53,8 @@ class _SSHPageState extends State<SSHPage> {
super.initState();
final termColorIdx = _setting.termColorIdx.fetch()!;
_termColors = TerminalColorsPlatform.values[termColorIdx].colors;
final ts = TextStyle(fontFamily: getFileName(_setting.fontPath.fetch()));
_terminalStyle = TerminalStyle.fromTextStyle(ts);
initTerminal();
}
@@ -60,6 +65,8 @@ class _SSHPageState extends State<SSHPage> {
_media = MediaQuery.of(context);
_menuTextStyle = TextStyle(color: contentColor.resolve(context));
_s = S.of(context)!;
_termUITheme = _isDark ? termDarkTheme : termLightTheme;
_terminalTheme = _termUITheme.toTerminalTheme(_termColors);
}
@override
@@ -125,11 +132,10 @@ class _SSHPageState extends State<SSHPage> {
@override
Widget build(BuildContext context) {
final termTheme = _isDark ? termDarkTheme : termLightTheme;
Widget child = Scaffold(
backgroundColor: termTheme.background,
body: _buildBody(termTheme.toTerminalTheme(_termColors)),
bottomNavigationBar: _buildBottom(termTheme.background),
backgroundColor: _termUITheme.background,
body: _buildBody(),
bottomNavigationBar: _buildBottom(),
);
if (isIOS) {
child = AnnotatedRegion(
@@ -140,7 +146,7 @@ class _SSHPageState extends State<SSHPage> {
return child;
}
Widget _buildBody(TerminalTheme termTheme) {
Widget _buildBody() {
return SizedBox(
height: _media.size.height -
_virtualKeyboardHeight -
@@ -150,9 +156,8 @@ class _SSHPageState extends State<SSHPage> {
_terminal,
controller: _terminalController,
keyboardType: TextInputType.visiblePassword,
textStyle: TerminalStyle.fromTextStyle(
TextStyle(fontFamily: getFileName(_setting.fontPath.fetch()))),
theme: termTheme,
textStyle: _terminalStyle,
theme: _terminalTheme,
deleteDetection: isIOS,
onTapUp: _onTapUp,
autoFocus: true,
@@ -161,14 +166,14 @@ class _SSHPageState extends State<SSHPage> {
);
}
Widget _buildBottom(Color bgColor) {
Widget _buildBottom() {
return SafeArea(
child: AnimatedPadding(
padding: _media.viewInsets,
duration: const Duration(milliseconds: 23),
curve: Curves.fastOutSlowIn,
child: Container(
color: bgColor,
color: _termUITheme.background,
height: _virtualKeyboardHeight,
child: Consumer<VirtualKeyboard>(
builder: (_, __, ___) => _buildVirtualKey(),
@@ -218,7 +223,7 @@ class _SSHPageState extends State<SSHPage> {
item.text,
style: TextStyle(
color: selected ? primaryColor : null,
fontSize: 17,
fontSize: 15,
),
);
@@ -306,27 +311,27 @@ class _SSHPageState extends State<SSHPage> {
}
final selected = terminalSelected;
if (selected.trim().isEmpty) {
_menuController.show(
context: context,
contextMenuBuilder: (context) {
return TextSelectionToolbar(
anchorAbove: details.globalPosition,
anchorBelow: details.globalPosition,
children: [
TextButton(
child: Text(
_s.paste,
style: _menuTextStyle,
),
onPressed: () async {
_paste();
_menuController.remove();
},
)
],
);
},
);
// _menuController.show(
// context: context,
// contextMenuBuilder: (context) {
// return TextSelectionToolbar(
// anchorAbove: details.globalPosition,
// anchorBelow: details.globalPosition,
// children: [
// TextButton(
// child: Text(
// _s.paste,
// style: _menuTextStyle,
// ),
// onPressed: () async {
// _paste();
// _menuController.remove();
// },
// )
// ],
// );
// },
// );
return;
}
_menuController.show(

View File

@@ -1006,11 +1006,9 @@ packages:
xterm:
dependency: "direct main"
description:
path: "."
ref: master
resolved-ref: "8039a582d855428cec49b23641bcfcafd6682574"
url: "https://github.com/lollipopkit/xterm.dart"
source: git
path: "../xterm.dart"
relative: true
source: path
version: "3.4.1"
yaml:
dependency: transitive

View File

@@ -57,10 +57,10 @@ dependencies:
share_plus_web: ^3.1.0
# xterm: ^3.4.1
xterm:
# path: ../xterm.dart
git:
ref: master
url: https://github.com/lollipopkit/xterm.dart
path: ../xterm.dart
# git:
# ref: master
# url: https://github.com/lollipopkit/xterm.dart
file_picker: ^5.2.5
plain_notification_token: ^0.0.4