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

View File

@@ -2,9 +2,8 @@
class BuildData { class BuildData {
static const String name = "ServerBox"; static const String name = "ServerBox";
static const int build = 256; static const int build = 260;
static const String engine = 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";
"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-16 22:22:23.410508";
static const String buildAt = "2023-04-05 15:16:00.949501"; static const int modifications = 3;
static const int modifications = 2;
} }

View File

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

View File

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

View File

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

View File

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