new: support pick ssh term theme
This commit is contained in:
@@ -356,7 +356,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 210;
|
CURRENT_PROJECT_VERSION = 212;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
@@ -364,7 +364,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.210;
|
MARKETING_VERSION = 1.0.212;
|
||||||
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";
|
||||||
@@ -486,7 +486,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 210;
|
CURRENT_PROJECT_VERSION = 212;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
@@ -494,7 +494,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.210;
|
MARKETING_VERSION = 1.0.212;
|
||||||
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";
|
||||||
@@ -510,7 +510,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 210;
|
CURRENT_PROJECT_VERSION = 212;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
@@ -518,7 +518,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.210;
|
MARKETING_VERSION = 1.0.212;
|
||||||
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";
|
||||||
|
|||||||
142
lib/data/model/ssh/terminal_color.dart
Normal file
142
lib/data/model/ssh/terminal_color.dart
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:toolbox/data/res/terminal_color.dart';
|
||||||
|
import 'package:xterm/ui.dart';
|
||||||
|
|
||||||
|
class TerminalUITheme {
|
||||||
|
final Color cursor;
|
||||||
|
final Color selection;
|
||||||
|
final Color foreground;
|
||||||
|
final Color background;
|
||||||
|
final Color searchHitBackground;
|
||||||
|
final Color searchHitBackgroundCurrent;
|
||||||
|
final Color searchHitForeground;
|
||||||
|
|
||||||
|
const TerminalUITheme({
|
||||||
|
required this.cursor,
|
||||||
|
required this.selection,
|
||||||
|
required this.foreground,
|
||||||
|
required this.background,
|
||||||
|
required this.searchHitBackground,
|
||||||
|
required this.searchHitBackgroundCurrent,
|
||||||
|
required this.searchHitForeground,
|
||||||
|
});
|
||||||
|
|
||||||
|
TerminalTheme toTerminalTheme(TerminalColors termColor) {
|
||||||
|
return TerminalTheme(
|
||||||
|
cursor: cursor,
|
||||||
|
selection: selection,
|
||||||
|
foreground: foreground,
|
||||||
|
background: background,
|
||||||
|
black: termColor.black,
|
||||||
|
red: termColor.red,
|
||||||
|
green: termColor.green,
|
||||||
|
yellow: termColor.yellow,
|
||||||
|
blue: termColor.blue,
|
||||||
|
magenta: termColor.magenta,
|
||||||
|
cyan: termColor.cyan,
|
||||||
|
white: termColor.white,
|
||||||
|
brightBlack: termColor.brightBlack,
|
||||||
|
brightRed: termColor.brightRed,
|
||||||
|
brightGreen: termColor.brightGreen,
|
||||||
|
brightYellow: termColor.brightYellow,
|
||||||
|
brightBlue: termColor.brightBlue,
|
||||||
|
brightMagenta: termColor.brightMagenta,
|
||||||
|
brightCyan: termColor.brightCyan,
|
||||||
|
brightWhite: termColor.brightWhite,
|
||||||
|
searchHitBackground: searchHitBackground,
|
||||||
|
searchHitBackgroundCurrent: searchHitBackgroundCurrent,
|
||||||
|
searchHitForeground: searchHitForeground,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class TerminalColors {
|
||||||
|
final TerminalColorsPlatform platform;
|
||||||
|
final Color black = Colors.black;
|
||||||
|
final Color red;
|
||||||
|
final Color green;
|
||||||
|
final Color yellow;
|
||||||
|
final Color blue;
|
||||||
|
// 品红
|
||||||
|
final Color magenta;
|
||||||
|
// 青
|
||||||
|
final Color cyan;
|
||||||
|
final Color white;
|
||||||
|
|
||||||
|
/// Also called grey
|
||||||
|
final Color brightBlack;
|
||||||
|
final Color brightRed;
|
||||||
|
final Color brightGreen;
|
||||||
|
final Color brightYellow;
|
||||||
|
final Color brightBlue;
|
||||||
|
final Color brightMagenta;
|
||||||
|
final Color brightCyan;
|
||||||
|
final Color brightWhite;
|
||||||
|
|
||||||
|
TerminalColors(
|
||||||
|
this.platform,
|
||||||
|
this.red,
|
||||||
|
this.green,
|
||||||
|
this.yellow,
|
||||||
|
this.blue,
|
||||||
|
this.magenta,
|
||||||
|
this.cyan,
|
||||||
|
this.white,
|
||||||
|
this.brightBlack,
|
||||||
|
this.brightRed,
|
||||||
|
this.brightGreen,
|
||||||
|
this.brightYellow,
|
||||||
|
this.brightBlue,
|
||||||
|
this.brightMagenta,
|
||||||
|
this.brightCyan, {
|
||||||
|
this.brightWhite = Colors.white,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
enum TerminalColorsPlatform {
|
||||||
|
macOS,
|
||||||
|
vga,
|
||||||
|
cmd,
|
||||||
|
putty,
|
||||||
|
xterm,
|
||||||
|
ubuntu,
|
||||||
|
;
|
||||||
|
|
||||||
|
String get name {
|
||||||
|
switch (this) {
|
||||||
|
case TerminalColorsPlatform.vga:
|
||||||
|
return 'VGA';
|
||||||
|
case TerminalColorsPlatform.cmd:
|
||||||
|
return 'CMD';
|
||||||
|
case TerminalColorsPlatform.macOS:
|
||||||
|
return 'macOS';
|
||||||
|
case TerminalColorsPlatform.putty:
|
||||||
|
return 'PuTTY';
|
||||||
|
case TerminalColorsPlatform.xterm:
|
||||||
|
return 'xterm';
|
||||||
|
case TerminalColorsPlatform.ubuntu:
|
||||||
|
return 'Ubuntu';
|
||||||
|
default:
|
||||||
|
return 'Unknown';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TerminalColors get colors {
|
||||||
|
switch (this) {
|
||||||
|
case TerminalColorsPlatform.vga:
|
||||||
|
return VGATerminalColor();
|
||||||
|
case TerminalColorsPlatform.cmd:
|
||||||
|
return CMDTerminalColor();
|
||||||
|
case TerminalColorsPlatform.macOS:
|
||||||
|
return MacOSTerminalColor();
|
||||||
|
case TerminalColorsPlatform.putty:
|
||||||
|
return PuttyTerminalColor();
|
||||||
|
case TerminalColorsPlatform.xterm:
|
||||||
|
return XTermTerminalColor();
|
||||||
|
case TerminalColorsPlatform.ubuntu:
|
||||||
|
return UbuntuTerminalColor();
|
||||||
|
default:
|
||||||
|
return MacOSTerminalColor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
class BuildData {
|
class BuildData {
|
||||||
static const String name = "ServerBox";
|
static const String name = "ServerBox";
|
||||||
static const int build = 211;
|
static const int build = 212;
|
||||||
static const String engine =
|
static const String engine =
|
||||||
"Flutter 3.7.0 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision b06b8b2710 (9 days ago) • 2023-01-23 16:55:55 -0800\nEngine • revision b24591ed32\nTools • Dart 2.19.0 • DevTools 2.20.1\n";
|
"Flutter 3.7.0 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision b06b8b2710 (9 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-02 12:40:53.962160";
|
static const String buildAt = "2023-02-02 13:16:45.445785";
|
||||||
static const int modifications = 5;
|
static const int modifications = 3;
|
||||||
}
|
}
|
||||||
|
|||||||
128
lib/data/res/terminal_color.dart
Normal file
128
lib/data/res/terminal_color.dart
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:toolbox/data/model/ssh/terminal_color.dart';
|
||||||
|
|
||||||
|
class VGATerminalColor extends TerminalColors {
|
||||||
|
VGATerminalColor()
|
||||||
|
: super(
|
||||||
|
TerminalColorsPlatform.vga,
|
||||||
|
const Color.fromARGB(255, 170, 0, 0),
|
||||||
|
const Color.fromARGB(255, 0, 170, 0),
|
||||||
|
const Color.fromARGB(255, 170, 85, 0),
|
||||||
|
const Color.fromARGB(255, 0, 0, 170),
|
||||||
|
const Color.fromARGB(255, 170, 0, 170),
|
||||||
|
const Color.fromARGB(255, 0, 170, 170),
|
||||||
|
const Color.fromARGB(255, 170, 170, 170),
|
||||||
|
const Color.fromARGB(255, 85, 85, 85),
|
||||||
|
const Color.fromARGB(255, 255, 85, 85),
|
||||||
|
const Color.fromARGB(255, 85, 255, 85),
|
||||||
|
const Color.fromARGB(255, 255, 255, 85),
|
||||||
|
const Color.fromARGB(255, 85, 85, 255),
|
||||||
|
const Color.fromARGB(255, 255, 85, 255),
|
||||||
|
const Color.fromARGB(255, 85, 255, 255),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class CMDTerminalColor extends TerminalColors {
|
||||||
|
CMDTerminalColor()
|
||||||
|
: super(
|
||||||
|
TerminalColorsPlatform.cmd,
|
||||||
|
const Color.fromARGB(255, 128, 0, 0),
|
||||||
|
const Color.fromARGB(255, 0, 128, 0),
|
||||||
|
const Color.fromARGB(255, 128, 128, 0),
|
||||||
|
const Color.fromARGB(255, 0, 0, 128),
|
||||||
|
const Color.fromARGB(255, 128, 0, 128),
|
||||||
|
const Color.fromARGB(255, 0, 128, 128),
|
||||||
|
const Color.fromARGB(255, 192, 192, 192),
|
||||||
|
const Color.fromARGB(255, 128, 128, 128),
|
||||||
|
const Color.fromARGB(255, 255, 0, 0),
|
||||||
|
const Color.fromARGB(255, 0, 255, 0),
|
||||||
|
const Color.fromARGB(255, 255, 255, 0),
|
||||||
|
const Color.fromARGB(255, 0, 0, 255),
|
||||||
|
const Color.fromARGB(255, 255, 0, 255),
|
||||||
|
const Color.fromARGB(255, 0, 255, 255),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class MacOSTerminalColor extends TerminalColors {
|
||||||
|
MacOSTerminalColor()
|
||||||
|
: super(
|
||||||
|
TerminalColorsPlatform.macOS,
|
||||||
|
const Color.fromARGB(255, 194, 54, 33),
|
||||||
|
const Color.fromARGB(255, 37, 188, 36),
|
||||||
|
const Color.fromARGB(255, 173, 173, 39),
|
||||||
|
const Color.fromARGB(255, 73, 46, 225),
|
||||||
|
const Color.fromARGB(255, 211, 56, 211),
|
||||||
|
const Color.fromARGB(255, 51, 187, 200),
|
||||||
|
const Color.fromARGB(255, 203, 204, 205),
|
||||||
|
const Color.fromARGB(255, 129, 131, 131),
|
||||||
|
const Color.fromARGB(255, 252, 57, 31),
|
||||||
|
const Color.fromARGB(255, 49, 231, 34),
|
||||||
|
const Color.fromARGB(255, 234, 236, 35),
|
||||||
|
const Color.fromARGB(255, 88, 51, 255),
|
||||||
|
const Color.fromARGB(255, 249, 53, 248),
|
||||||
|
const Color.fromARGB(255, 20, 240, 240),
|
||||||
|
brightWhite: const Color.fromARGB(255, 233, 235, 235));
|
||||||
|
}
|
||||||
|
|
||||||
|
class PuttyTerminalColor extends TerminalColors {
|
||||||
|
PuttyTerminalColor()
|
||||||
|
: super(
|
||||||
|
TerminalColorsPlatform.putty,
|
||||||
|
const Color.fromARGB(255, 187, 0, 0),
|
||||||
|
const Color.fromARGB(255, 0, 187, 0),
|
||||||
|
const Color.fromARGB(255, 187, 187, 0),
|
||||||
|
const Color.fromARGB(255, 0, 0, 187),
|
||||||
|
const Color.fromARGB(255, 187, 0, 187),
|
||||||
|
const Color.fromARGB(255, 0, 187, 187),
|
||||||
|
const Color.fromARGB(255, 187, 187, 187),
|
||||||
|
const Color.fromARGB(255, 85, 85, 85),
|
||||||
|
const Color.fromARGB(255, 255, 85, 85),
|
||||||
|
const Color.fromARGB(255, 85, 255, 85),
|
||||||
|
const Color.fromARGB(255, 255, 255, 85),
|
||||||
|
const Color.fromARGB(255, 85, 85, 255),
|
||||||
|
const Color.fromARGB(255, 255, 85, 255),
|
||||||
|
const Color.fromARGB(255, 85, 255, 255),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class XTermTerminalColor extends TerminalColors {
|
||||||
|
XTermTerminalColor()
|
||||||
|
: super(
|
||||||
|
TerminalColorsPlatform.xterm,
|
||||||
|
const Color.fromARGB(255, 205, 0, 0),
|
||||||
|
const Color.fromARGB(255, 0, 205, 0),
|
||||||
|
const Color.fromARGB(255, 205, 205, 0),
|
||||||
|
const Color.fromARGB(255, 0, 0, 238),
|
||||||
|
const Color.fromARGB(255, 205, 0, 205),
|
||||||
|
const Color.fromARGB(255, 0, 205, 205),
|
||||||
|
const Color.fromARGB(255, 229, 229, 229),
|
||||||
|
const Color.fromARGB(255, 127, 127, 127),
|
||||||
|
const Color.fromARGB(255, 255, 0, 0),
|
||||||
|
const Color.fromARGB(255, 0, 255, 0),
|
||||||
|
const Color.fromARGB(255, 255, 255, 0),
|
||||||
|
const Color.fromARGB(255, 92, 92, 255),
|
||||||
|
const Color.fromARGB(255, 255, 0, 255),
|
||||||
|
const Color.fromARGB(255, 0, 255, 255),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class UbuntuTerminalColor extends TerminalColors {
|
||||||
|
UbuntuTerminalColor()
|
||||||
|
: super(
|
||||||
|
TerminalColorsPlatform.ubuntu,
|
||||||
|
const Color.fromARGB(255, 222, 56, 43),
|
||||||
|
const Color.fromARGB(255, 57, 181, 74),
|
||||||
|
const Color.fromARGB(255, 255, 199, 6),
|
||||||
|
const Color.fromARGB(255, 0, 111, 184),
|
||||||
|
const Color.fromARGB(255, 118, 38, 113),
|
||||||
|
const Color.fromARGB(255, 44, 181, 233),
|
||||||
|
const Color.fromARGB(255, 204, 204, 204),
|
||||||
|
const Color.fromARGB(255, 128, 128, 128),
|
||||||
|
const Color.fromARGB(255, 255, 0, 0),
|
||||||
|
const Color.fromARGB(255, 0, 255, 0),
|
||||||
|
const Color.fromARGB(255, 255, 255, 0),
|
||||||
|
const Color.fromARGB(255, 0, 0, 255),
|
||||||
|
const Color.fromARGB(255, 255, 0, 255),
|
||||||
|
const Color.fromARGB(255, 0, 255, 255),
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,53 +1,22 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:xterm/ui.dart';
|
|
||||||
|
|
||||||
const termDarkTheme = TerminalTheme(
|
import '../model/ssh/terminal_color.dart';
|
||||||
|
|
||||||
|
const termDarkTheme = TerminalUITheme(
|
||||||
cursor: Color(0XAAAEAFAD),
|
cursor: Color(0XAAAEAFAD),
|
||||||
selection: Color(0XAAAEAFAD),
|
selection: Color(0XAAAEAFAD),
|
||||||
foreground: Color(0XFFCCCCCC),
|
foreground: Color(0XFFCCCCCC),
|
||||||
background: Colors.black,
|
background: Colors.black,
|
||||||
black: Color(0XFF000000),
|
|
||||||
red: Color(0XFFCD3131),
|
|
||||||
green: Color(0XFF0DBC79),
|
|
||||||
yellow: Color(0XFFE5E510),
|
|
||||||
blue: Color(0XFF2472C8),
|
|
||||||
magenta: Color(0XFFBC3FBC),
|
|
||||||
cyan: Color(0XFF11A8CD),
|
|
||||||
white: Color(0XFFE5E5E5),
|
|
||||||
brightBlack: Color(0XFF666666),
|
|
||||||
brightRed: Color(0XFFF14C4C),
|
|
||||||
brightGreen: Color(0XFF23D18B),
|
|
||||||
brightYellow: Color(0XFFF5F543),
|
|
||||||
brightBlue: Color(0XFF3B8EEA),
|
|
||||||
brightMagenta: Color(0XFFD670D6),
|
|
||||||
brightCyan: Color(0XFF29B8DB),
|
|
||||||
brightWhite: Color(0XFFFFFFFF),
|
|
||||||
searchHitBackground: Color(0XFFFFFF2B),
|
searchHitBackground: Color(0XFFFFFF2B),
|
||||||
searchHitBackgroundCurrent: Color(0XFF31FF26),
|
searchHitBackgroundCurrent: Color(0XFF31FF26),
|
||||||
searchHitForeground: Color(0XFF000000),
|
searchHitForeground: Color(0XFF000000),
|
||||||
);
|
);
|
||||||
|
|
||||||
const termLightTheme = TerminalTheme(
|
const termLightTheme = TerminalUITheme(
|
||||||
cursor: Color(0XFFAEAFAD),
|
cursor: Color(0XFFAEAFAD),
|
||||||
selection: Color(0XFFAEAFAD),
|
selection: Color.fromARGB(102, 174, 175, 173),
|
||||||
foreground: Color(0XFF000000),
|
foreground: Color(0XFF000000),
|
||||||
background: Color(0XFFFFFFFF),
|
background: Color(0XFFFFFFFF),
|
||||||
black: Color(0XFF000000),
|
|
||||||
red: Color(0XFFCD3131),
|
|
||||||
green: Color(0XFF0DBC79),
|
|
||||||
yellow: Color(0XFFE5E510),
|
|
||||||
blue: Color(0XFF2472C8),
|
|
||||||
magenta: Color(0XFFBC3FBC),
|
|
||||||
cyan: Color(0XFF11A8CD),
|
|
||||||
white: Color(0XFFE5E5E5),
|
|
||||||
brightBlack: Color(0XFF666666),
|
|
||||||
brightRed: Color(0XFFF14C4C),
|
|
||||||
brightGreen: Color(0XFF23D18B),
|
|
||||||
brightYellow: Color(0XFFF5F543),
|
|
||||||
brightBlue: Color(0XFF3B8EEA),
|
|
||||||
brightMagenta: Color(0XFFD670D6),
|
|
||||||
brightCyan: Color(0XFF29B8DB),
|
|
||||||
brightWhite: Color(0XFFFFFFFF),
|
|
||||||
searchHitBackground: Color(0XFFFFFF2B),
|
searchHitBackground: Color(0XFFFFFF2B),
|
||||||
searchHitBackgroundCurrent: Color(0XFF31FF26),
|
searchHitBackgroundCurrent: Color(0XFF31FF26),
|
||||||
searchHitForeground: Color(0XFF000000),
|
searchHitForeground: Color(0XFF000000),
|
||||||
|
|||||||
@@ -22,4 +22,6 @@ class SettingStore extends PersistentStore {
|
|||||||
/// First time to use SSH term
|
/// First time to use SSH term
|
||||||
StoreProperty<bool> get firstTimeUseSshTerm =>
|
StoreProperty<bool> get firstTimeUseSshTerm =>
|
||||||
property('firstTimeUseSshTerm', defaultValue: true);
|
property('firstTimeUseSshTerm', defaultValue: true);
|
||||||
|
|
||||||
|
StoreProperty<int> get termColorIdx => property('termColorIdx', defaultValue: 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
final messages = _notInlinedMessages(_notInlinedMessages);
|
final messages = _notInlinedMessages(_notInlinedMessages);
|
||||||
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
|
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
|
||||||
"aboutThanks": MessageLookupByLibrary.simpleMessage(
|
"aboutThanks": MessageLookupByLibrary.simpleMessage(
|
||||||
"\nAll rights reserved.\n\nThanks to the following people who participated in the test."),
|
"\n\nThanks to the following people who participated in the test."),
|
||||||
"addAServer": MessageLookupByLibrary.simpleMessage("add a server"),
|
"addAServer": MessageLookupByLibrary.simpleMessage("add a server"),
|
||||||
"addOne": MessageLookupByLibrary.simpleMessage("Add one"),
|
"addOne": MessageLookupByLibrary.simpleMessage("Add one"),
|
||||||
"addPrivateKey":
|
"addPrivateKey":
|
||||||
@@ -242,6 +242,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"sureNoPwd": MessageLookupByLibrary.simpleMessage(
|
"sureNoPwd": MessageLookupByLibrary.simpleMessage(
|
||||||
"Are you sure to use no password?"),
|
"Are you sure to use no password?"),
|
||||||
"sureToDeleteServer": m14,
|
"sureToDeleteServer": m14,
|
||||||
|
"termTheme": MessageLookupByLibrary.simpleMessage("Terminal theme"),
|
||||||
"ttl": MessageLookupByLibrary.simpleMessage("ttl"),
|
"ttl": MessageLookupByLibrary.simpleMessage("ttl"),
|
||||||
"unknown": MessageLookupByLibrary.simpleMessage("unknown"),
|
"unknown": MessageLookupByLibrary.simpleMessage("unknown"),
|
||||||
"unknownError": MessageLookupByLibrary.simpleMessage("Unknown error"),
|
"unknownError": MessageLookupByLibrary.simpleMessage("Unknown error"),
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
final messages = _notInlinedMessages(_notInlinedMessages);
|
final messages = _notInlinedMessages(_notInlinedMessages);
|
||||||
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
|
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
|
||||||
"aboutThanks":
|
"aboutThanks":
|
||||||
MessageLookupByLibrary.simpleMessage("\n保留所有权利。\n\n感谢以下参与软件测试的各位。"),
|
MessageLookupByLibrary.simpleMessage("\n\n感谢以下参与软件测试的各位。"),
|
||||||
"addAServer": MessageLookupByLibrary.simpleMessage("添加服务器"),
|
"addAServer": MessageLookupByLibrary.simpleMessage("添加服务器"),
|
||||||
"addOne": MessageLookupByLibrary.simpleMessage("前去新增"),
|
"addOne": MessageLookupByLibrary.simpleMessage("前去新增"),
|
||||||
"addPrivateKey": MessageLookupByLibrary.simpleMessage("添加一个私钥"),
|
"addPrivateKey": MessageLookupByLibrary.simpleMessage("添加一个私钥"),
|
||||||
@@ -210,6 +210,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"sureDelete": m13,
|
"sureDelete": m13,
|
||||||
"sureNoPwd": MessageLookupByLibrary.simpleMessage("确认使用无密码?"),
|
"sureNoPwd": MessageLookupByLibrary.simpleMessage("确认使用无密码?"),
|
||||||
"sureToDeleteServer": m14,
|
"sureToDeleteServer": m14,
|
||||||
|
"termTheme": MessageLookupByLibrary.simpleMessage("终端主题"),
|
||||||
"ttl": MessageLookupByLibrary.simpleMessage("缓存时间"),
|
"ttl": MessageLookupByLibrary.simpleMessage("缓存时间"),
|
||||||
"unknown": MessageLookupByLibrary.simpleMessage("未知"),
|
"unknown": MessageLookupByLibrary.simpleMessage("未知"),
|
||||||
"unknownError": MessageLookupByLibrary.simpleMessage("未知错误"),
|
"unknownError": MessageLookupByLibrary.simpleMessage("未知错误"),
|
||||||
|
|||||||
@@ -50,10 +50,10 @@ class S {
|
|||||||
return Localizations.of<S>(context, S);
|
return Localizations.of<S>(context, S);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `\nAll rights reserved.\n\nThanks to the following people who participated in the test.`
|
/// `\n\nThanks to the following people who participated in the test.`
|
||||||
String get aboutThanks {
|
String get aboutThanks {
|
||||||
return Intl.message(
|
return Intl.message(
|
||||||
'\nAll rights reserved.\n\nThanks to the following people who participated in the test.',
|
'\n\nThanks to the following people who participated in the test.',
|
||||||
name: 'aboutThanks',
|
name: 'aboutThanks',
|
||||||
desc: '',
|
desc: '',
|
||||||
args: [],
|
args: [],
|
||||||
@@ -1381,6 +1381,16 @@ class S {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// `Terminal theme`
|
||||||
|
String get termTheme {
|
||||||
|
return Intl.message(
|
||||||
|
'Terminal theme',
|
||||||
|
name: 'termTheme',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// `ttl`
|
/// `ttl`
|
||||||
String get ttl {
|
String get ttl {
|
||||||
return Intl.message(
|
return Intl.message(
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"aboutThanks": "\nAll rights reserved.\n\nThanks to the following people who participated in the test.",
|
"aboutThanks": "\n\nThanks to the following people who participated in the test.",
|
||||||
"addAServer": "add a server",
|
"addAServer": "add a server",
|
||||||
"addOne": "Add one",
|
"addOne": "Add one",
|
||||||
"addPrivateKey": "Add private key",
|
"addPrivateKey": "Add private key",
|
||||||
@@ -132,6 +132,7 @@
|
|||||||
"sureDelete": "Are you sure to delete [{name}]?",
|
"sureDelete": "Are you sure to delete [{name}]?",
|
||||||
"sureNoPwd": "Are you sure to use no password?",
|
"sureNoPwd": "Are you sure to use no password?",
|
||||||
"sureToDeleteServer": "Are you sure to delete server [{server}]?",
|
"sureToDeleteServer": "Are you sure to delete server [{server}]?",
|
||||||
|
"termTheme": "Terminal theme",
|
||||||
"ttl": "ttl",
|
"ttl": "ttl",
|
||||||
"unknown": "unknown",
|
"unknown": "unknown",
|
||||||
"unknownError": "Unknown error",
|
"unknownError": "Unknown error",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"aboutThanks": "\n保留所有权利。\n\n感谢以下参与软件测试的各位。",
|
"aboutThanks": "\n\n感谢以下参与软件测试的各位。",
|
||||||
"addAServer": "添加服务器",
|
"addAServer": "添加服务器",
|
||||||
"addOne": "前去新增",
|
"addOne": "前去新增",
|
||||||
"addPrivateKey": "添加一个私钥",
|
"addPrivateKey": "添加一个私钥",
|
||||||
@@ -132,6 +132,7 @@
|
|||||||
"sureDelete": "确定删除[{name}]?",
|
"sureDelete": "确定删除[{name}]?",
|
||||||
"sureNoPwd": "确认使用无密码?",
|
"sureNoPwd": "确认使用无密码?",
|
||||||
"sureToDeleteServer": "你确定要删除服务器 [{server}] 吗?",
|
"sureToDeleteServer": "你确定要删除服务器 [{server}] 吗?",
|
||||||
|
"termTheme": "终端主题",
|
||||||
"ttl": "缓存时间",
|
"ttl": "缓存时间",
|
||||||
"unknown": "未知",
|
"unknown": "未知",
|
||||||
"unknownError": "未知错误",
|
"unknownError": "未知错误",
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: width,
|
width: width,
|
||||||
child: Text(
|
child: Text(
|
||||||
'${ns.speedIn(device: device)}\n${ns.totalIn(device: device)}',
|
'${ns.speedIn(device: device)} | ${ns.totalIn(device: device)}',
|
||||||
style: textSize11,
|
style: textSize11,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
textScaleFactor: 0.87,
|
textScaleFactor: 0.87,
|
||||||
@@ -351,7 +351,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: width,
|
width: width,
|
||||||
child: Text(
|
child: Text(
|
||||||
'${ns.speedOut(device: device)}\n${ns.totalOut(device: device)}',
|
'${ns.speedOut(device: device)} | ${ns.totalOut(device: device)}',
|
||||||
style: textSize11,
|
style: textSize11,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
textScaleFactor: 0.87,
|
textScaleFactor: 0.87,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_material_color_picker/flutter_material_color_picker.dart';
|
import 'package:flutter_material_color_picker/flutter_material_color_picker.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:toolbox/data/model/ssh/terminal_color.dart';
|
||||||
|
|
||||||
import '../../core/update.dart';
|
import '../../core/update.dart';
|
||||||
import '../../core/utils/ui.dart';
|
import '../../core/utils/ui.dart';
|
||||||
@@ -24,20 +25,19 @@ class SettingPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _SettingPageState extends State<SettingPage> {
|
class _SettingPageState extends State<SettingPage> {
|
||||||
late final SettingStore _setting;
|
late final SettingStore _setting;
|
||||||
late int _selectedColorValue;
|
|
||||||
late int _launchPageIdx;
|
|
||||||
late final ServerProvider _serverProvider;
|
late final ServerProvider _serverProvider;
|
||||||
late MediaQueryData _media;
|
late MediaQueryData _media;
|
||||||
late ThemeData _theme;
|
|
||||||
late S _s;
|
late S _s;
|
||||||
|
|
||||||
var _updateInterval = 5.0;
|
late int _selectedColorValue;
|
||||||
|
late int _launchPageIdx;
|
||||||
|
late int _termThemeIdx;
|
||||||
|
late double _updateInterval;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
_media = MediaQuery.of(context);
|
_media = MediaQuery.of(context);
|
||||||
_theme = Theme.of(context);
|
|
||||||
_s = S.of(context);
|
_s = S.of(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,6 +47,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
_serverProvider = locator<ServerProvider>();
|
_serverProvider = locator<ServerProvider>();
|
||||||
_setting = locator<SettingStore>();
|
_setting = locator<SettingStore>();
|
||||||
_launchPageIdx = _setting.launchPage.fetch()!;
|
_launchPageIdx = _setting.launchPage.fetch()!;
|
||||||
|
_termThemeIdx = _setting.termColorIdx.fetch()!;
|
||||||
_updateInterval = _setting.serverStatusUpdateInterval.fetch()!.toDouble();
|
_updateInterval = _setting.serverStatusUpdateInterval.fetch()!.toDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,6 +65,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
_buildCheckUpdate(),
|
_buildCheckUpdate(),
|
||||||
_buildLaunchPage(),
|
_buildLaunchPage(),
|
||||||
_buildDistLogoSwitch(),
|
_buildDistLogoSwitch(),
|
||||||
|
_buildTermTheme(),
|
||||||
].map((e) => RoundRectCard(e)).toList(),
|
].map((e) => RoundRectCard(e)).toList(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -218,10 +220,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
contentPadding: EdgeInsets.zero,
|
contentPadding: EdgeInsets.zero,
|
||||||
title: Text(
|
title: Text(
|
||||||
tabTitleName(context, tabs.indexOf(e)),
|
tabTitleName(context, tabs.indexOf(e)),
|
||||||
style: TextStyle(
|
style: textSize13,
|
||||||
fontSize: 14,
|
|
||||||
color: _theme.textTheme.bodyMedium!.color!.withAlpha(177),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
trailing: _buildRadio(tabs.indexOf(e)),
|
trailing: _buildRadio(tabs.indexOf(e)),
|
||||||
),
|
),
|
||||||
@@ -242,4 +241,49 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildTermTheme() {
|
||||||
|
return ExpansionTile(
|
||||||
|
textColor: primaryColor,
|
||||||
|
childrenPadding: const EdgeInsets.only(left: 17),
|
||||||
|
title: Text(
|
||||||
|
_s.termTheme,
|
||||||
|
style: textSize13,
|
||||||
|
),
|
||||||
|
trailing: Text(
|
||||||
|
TerminalColorsPlatform.values[_termThemeIdx].name,
|
||||||
|
style: textSize13,
|
||||||
|
),
|
||||||
|
children: _buildTermThemeRadioList(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Widget> _buildTermThemeRadioList() {
|
||||||
|
return TerminalColorsPlatform.values
|
||||||
|
.map(
|
||||||
|
(e) => ListTile(
|
||||||
|
contentPadding: EdgeInsets.zero,
|
||||||
|
title: Text(
|
||||||
|
e.name,
|
||||||
|
style: textSize13,
|
||||||
|
),
|
||||||
|
trailing: _buildTermThemeRadio(e),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
Radio _buildTermThemeRadio(TerminalColorsPlatform platform) {
|
||||||
|
return Radio<int>(
|
||||||
|
value: platform.index,
|
||||||
|
groupValue: _termThemeIdx,
|
||||||
|
onChanged: (int? value) {
|
||||||
|
setState(() {
|
||||||
|
value ??= 0;
|
||||||
|
_termThemeIdx = value!;
|
||||||
|
_setting.termColorIdx.put(value!);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import 'package:flutter/foundation.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:toolbox/data/model/ssh/terminal_color.dart';
|
||||||
import 'package:toolbox/generated/l10n.dart';
|
import 'package:toolbox/generated/l10n.dart';
|
||||||
import 'package:xterm/xterm.dart';
|
import 'package:xterm/xterm.dart';
|
||||||
|
|
||||||
@@ -17,6 +18,7 @@ import '../../data/provider/virtual_keyboard.dart';
|
|||||||
import '../../data/res/color.dart';
|
import '../../data/res/color.dart';
|
||||||
import '../../data/res/terminal_theme.dart';
|
import '../../data/res/terminal_theme.dart';
|
||||||
import '../../data/res/virtual_key.dart';
|
import '../../data/res/virtual_key.dart';
|
||||||
|
import '../../data/store/setting.dart';
|
||||||
import '../../locator.dart';
|
import '../../locator.dart';
|
||||||
|
|
||||||
class SSHPage extends StatefulWidget {
|
class SSHPage extends StatefulWidget {
|
||||||
@@ -36,6 +38,7 @@ class _SSHPageState extends State<SSHPage> {
|
|||||||
final TerminalController _terminalController = TerminalController();
|
final TerminalController _terminalController = TerminalController();
|
||||||
final ContextMenuController _menuController = ContextMenuController();
|
final ContextMenuController _menuController = ContextMenuController();
|
||||||
late TextStyle _menuTextStyle;
|
late TextStyle _menuTextStyle;
|
||||||
|
late TerminalColors _termColors;
|
||||||
late S _s;
|
late S _s;
|
||||||
|
|
||||||
var _isDark = false;
|
var _isDark = false;
|
||||||
@@ -43,6 +46,7 @@ class _SSHPageState extends State<SSHPage> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
_termColors = TerminalColorsPlatform.values[locator<SettingStore>().termColorIdx.fetch()!].colors;
|
||||||
initTerminal();
|
initTerminal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +106,7 @@ class _SSHPageState extends State<SSHPage> {
|
|||||||
final termTheme = _isDark ? termDarkTheme : termLightTheme;
|
final termTheme = _isDark ? termDarkTheme : termLightTheme;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: termTheme.background,
|
backgroundColor: termTheme.background,
|
||||||
body: _buildBody(termTheme),
|
body: _buildBody(termTheme.toTerminalTheme(_termColors)),
|
||||||
bottomNavigationBar: _buildBottom(),
|
bottomNavigationBar: _buildBottom(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 181 KiB After Width: | Height: | Size: 235 KiB |
Reference in New Issue
Block a user