This commit is contained in:
lollipopkit
2024-05-14 23:39:17 +08:00
parent 04dfede535
commit ba4abcecfb
25 changed files with 86 additions and 279 deletions

View File

@@ -690,7 +690,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 = 896; CURRENT_PROJECT_VERSION = 897;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -700,7 +700,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.896; MARKETING_VERSION = 1.0.897;
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";
@@ -826,7 +826,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 = 896; CURRENT_PROJECT_VERSION = 897;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -836,7 +836,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.896; MARKETING_VERSION = 1.0.897;
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";
@@ -854,7 +854,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 = 896; CURRENT_PROJECT_VERSION = 897;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -864,7 +864,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.896; MARKETING_VERSION = 1.0.897;
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";
@@ -885,7 +885,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 896; CURRENT_PROJECT_VERSION = 897;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11; GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
@@ -898,7 +898,7 @@
"@executable_path/Frameworks", "@executable_path/Frameworks",
"@executable_path/../../Frameworks", "@executable_path/../../Frameworks",
); );
MARKETING_VERSION = 1.0.896; MARKETING_VERSION = 1.0.897;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
@@ -924,7 +924,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 896; CURRENT_PROJECT_VERSION = 897;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11; GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
@@ -937,7 +937,7 @@
"@executable_path/Frameworks", "@executable_path/Frameworks",
"@executable_path/../../Frameworks", "@executable_path/../../Frameworks",
); );
MARKETING_VERSION = 1.0.896; MARKETING_VERSION = 1.0.897;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
@@ -960,7 +960,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 896; CURRENT_PROJECT_VERSION = 897;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11; GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
@@ -973,7 +973,7 @@
"@executable_path/Frameworks", "@executable_path/Frameworks",
"@executable_path/../../Frameworks", "@executable_path/../../Frameworks",
); );
MARKETING_VERSION = 1.0.896; MARKETING_VERSION = 1.0.897;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
@@ -996,7 +996,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 896; CURRENT_PROJECT_VERSION = 897;
DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
@@ -1008,7 +1008,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.896; MARKETING_VERSION = 1.0.897;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
@@ -1037,7 +1037,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 896; CURRENT_PROJECT_VERSION = 897;
DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
@@ -1049,7 +1049,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.896; MARKETING_VERSION = 1.0.897;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
PRODUCT_NAME = ServerBox; PRODUCT_NAME = ServerBox;
@@ -1075,7 +1075,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 896; CURRENT_PROJECT_VERSION = 897;
DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
@@ -1087,7 +1087,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.896; MARKETING_VERSION = 1.0.897;
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
PRODUCT_NAME = ServerBox; PRODUCT_NAME = ServerBox;

View File

@@ -2,7 +2,6 @@ import 'package:dynamic_color/dynamic_color.dart';
import 'package:fl_lib/fl_lib.dart'; import 'package:fl_lib/fl_lib.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:toolbox/core/utils/ui.dart';
import 'package:toolbox/data/res/build_data.dart'; import 'package:toolbox/data/res/build_data.dart';
import 'package:toolbox/data/res/rebuild.dart'; import 'package:toolbox/data/res/rebuild.dart';
import 'package:toolbox/data/res/store.dart'; import 'package:toolbox/data/res/store.dart';
@@ -84,11 +83,7 @@ class MyApp extends StatelessWidget {
} }
void _setup(BuildContext context) async { void _setup(BuildContext context) async {
setTransparentNavigationBar(context); SystemUIs.setTransparentNavigationBar(context);
Analysis.init(
'https://countly.lolli.tech',
'0772e65c696709f879d87db77ae1a811259e3eb9',
);
} }
ThemeData _getAmoledTheme(ThemeData darkTheme) => darkTheme.copyWith( ThemeData _getAmoledTheme(ThemeData darkTheme) => darkTheme.copyWith(

View File

@@ -1,7 +1,9 @@
import 'package:fl_lib/fl_lib.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:toolbox/data/model/server/private_key_info.dart'; import 'package:toolbox/data/model/server/private_key_info.dart';
import 'package:toolbox/data/model/server/server_private_info.dart'; import 'package:toolbox/data/model/server/server_private_info.dart';
import 'package:toolbox/data/res/provider.dart';
import 'package:toolbox/data/res/store.dart'; import 'package:toolbox/data/res/store.dart';
import 'package:toolbox/view/page/backup.dart'; import 'package:toolbox/view/page/backup.dart';
import 'package:toolbox/view/page/container.dart'; import 'package:toolbox/view/page/container.dart';
@@ -21,7 +23,6 @@ import 'package:toolbox/view/page/setting/seq/virt_key.dart';
import 'package:toolbox/view/page/storage/local.dart'; import 'package:toolbox/view/page/storage/local.dart';
import '../data/model/server/snippet.dart'; import '../data/model/server/snippet.dart';
import '../view/page/debug.dart';
import '../view/page/editor.dart'; import '../view/page/editor.dart';
import '../view/page/process.dart'; import '../view/page/process.dart';
import '../view/page/server/edit.dart'; import '../view/page/server/edit.dart';
@@ -150,7 +151,14 @@ class AppRoutes {
} }
static AppRoutes debug({Key? key}) { static AppRoutes debug({Key? key}) {
return AppRoutes(DebugPage(key: key), 'debug'); return AppRoutes(
DebugPage(
key: key,
notifier: Pros.debug.widgets,
onClear: Pros.debug.clear,
),
'debug',
);
} }
static AppRoutes docker({Key? key, required ServerPrivateInfo spi}) { static AppRoutes docker({Key? key, required ServerPrivateInfo spi}) {

View File

@@ -1,7 +1,6 @@
import 'package:fl_lib/fl_lib.dart'; import 'package:fl_lib/fl_lib.dart';
import 'package:plain_notification_token/plain_notification_token.dart'; import 'package:plain_notification_token/plain_notification_token.dart';
Future<String?> getToken() async { Future<String?> getToken() async {
if (isIOS) { if (isIOS) {
final plainNotificationToken = PlainNotificationToken(); final plainNotificationToken = PlainNotificationToken();
@@ -14,10 +13,3 @@ Future<String?> getToken() async {
} }
return null; return null;
} }
String? getFileName(String? path) {
if (path == null || path.isEmpty) {
return null;
}
return path.split('/').last;
}

View File

@@ -1,48 +0,0 @@
import 'dart:async';
import 'dart:io';
import 'package:fl_lib/fl_lib.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:toolbox/core/utils/misc.dart';
import 'package:url_launcher/url_launcher.dart';
Future<bool> openUrl(String url) async {
return await launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication);
}
void setTransparentNavigationBar(BuildContext context) {
if (isAndroid) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle(
systemNavigationBarColor: Colors.transparent,
systemNavigationBarContrastEnforced: true),
);
}
}
Future<void> loadFontFile(String localPath) async {
if (localPath.isEmpty) return;
final name = getFileName(localPath);
if (name == null) return;
final file = File(localPath);
if (!await file.exists()) return;
final fontLoader = FontLoader(name);
fontLoader.addFont(file.readAsBytes().byteData);
await fontLoader.load();
}
void switchStatusBar({required bool hide}) {
if (hide) {
SystemChrome.setEnabledSystemUIMode(
SystemUiMode.immersiveSticky,
overlays: [],
);
} else {
SystemChrome.setEnabledSystemUIMode(
SystemUiMode.edgeToEdge,
overlays: [SystemUiOverlay.top, SystemUiOverlay.bottom],
);
}
}

View File

@@ -1,4 +1,3 @@
import 'package:fl_lib/fl_lib.dart'; import 'package:fl_lib/fl_lib.dart';
/// raw dat from server: /// raw dat from server:

View File

@@ -1,56 +0,0 @@
import 'package:fl_lib/fl_lib.dart';
import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
import '../../data/res/misc.dart';
const _level2Color = {
'INFO': Colors.blue,
'WARNING': Colors.yellow,
};
class DebugProvider extends ChangeNotifier {
final widgets = <Widget>[];
void addLog(LogRecord record) {
final color = _level2Color[record.level.name] ?? Colors.blue;
widgets.add(Text.rich(TextSpan(
children: [
TextSpan(
text: '[${DateTime.now().hourMinute}][${record.loggerName}]',
style: const TextStyle(color: Colors.cyan),
),
TextSpan(
text: '[${record.level}]',
style: TextStyle(color: color),
),
TextSpan(
text: record.error == null
? '\n${record.message}'
: '\n${record.message}: ${record.error}',
style: const TextStyle(color: Colors.white),
),
],
)));
if (record.stackTrace != null) {
widgets.add(SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Text(
'${record.stackTrace}',
style: const TextStyle(color: Colors.white),
),
));
}
widgets.add(UIs.height13);
if (widgets.length > Miscs.maxDebugLogLines) {
widgets.removeRange(0, widgets.length - Miscs.maxDebugLogLines);
}
notifyListeners();
}
void clear() {
widgets.clear();
notifyListeners();
}
}

View File

@@ -2,9 +2,9 @@
class BuildData { class BuildData {
static const String name = "ServerBox"; static const String name = "ServerBox";
static const int build = 896; static const int build = 897;
static const String engine = "3.19.6"; static const String engine = "3.19.6";
static const String buildAt = "2024-05-12 15:46:37"; static const String buildAt = "2024-05-14 22:32:07";
static const int modifications = 3; static const int modifications = 12;
static const int script = 47; static const int script = 47;
} }

View File

@@ -1,5 +1,5 @@
import 'package:fl_lib/fl_lib.dart';
import 'package:toolbox/data/provider/app.dart'; import 'package:toolbox/data/provider/app.dart';
import 'package:toolbox/data/provider/debug.dart';
import 'package:toolbox/data/provider/private_key.dart'; import 'package:toolbox/data/provider/private_key.dart';
import 'package:toolbox/data/provider/server.dart'; import 'package:toolbox/data/provider/server.dart';
import 'package:toolbox/data/provider/sftp.dart'; import 'package:toolbox/data/provider/sftp.dart';
@@ -7,7 +7,7 @@ import 'package:toolbox/data/provider/snippet.dart';
abstract final class Pros { abstract final class Pros {
static final app = AppProvider(); static final app = AppProvider();
static final debug = DebugProvider(); static final debug = DebugProvider(maxLines: 177);
static final key = PrivateKeyProvider(); static final key = PrivateKeyProvider();
static final server = ServerProvider(); static final server = ServerProvider();
static final sftp = SftpProvider(); static final sftp = SftpProvider();

View File

@@ -4,4 +4,5 @@ abstract final class Urls {
static const myGithub = 'https://github.com/lollipopkit'; static const myGithub = 'https://github.com/lollipopkit';
static const appHelp = '$myGithub/flutter_server_box#-help'; static const appHelp = '$myGithub/flutter_server_box#-help';
static const appWiki = '$myGithub/flutter_server_box/wiki'; static const appWiki = '$myGithub/flutter_server_box/wiki';
static const analysis = 'https://countly.lolli.tech';
} }

View File

@@ -2,7 +2,6 @@ import 'package:fl_lib/fl_lib.dart';
import 'package:toolbox/data/model/container/type.dart'; import 'package:toolbox/data/model/container/type.dart';
import 'package:toolbox/data/res/store.dart'; import 'package:toolbox/data/res/store.dart';
const _keyConfig = 'providerConfig'; const _keyConfig = 'providerConfig';
class ContainerStore extends PersistentStore { class ContainerStore extends PersistentStore {

View File

@@ -10,23 +10,21 @@ import 'package:hive_flutter/hive_flutter.dart';
import 'package:logging/logging.dart'; import 'package:logging/logging.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:toolbox/app.dart';
import 'package:toolbox/core/utils/sync/icloud.dart'; import 'package:toolbox/core/utils/sync/icloud.dart';
import 'package:toolbox/core/utils/sync/webdav.dart'; import 'package:toolbox/core/utils/sync/webdav.dart';
import 'package:toolbox/core/utils/ui.dart';
import 'package:toolbox/data/model/app/menu/server_func.dart'; import 'package:toolbox/data/model/app/menu/server_func.dart';
import 'package:toolbox/data/model/app/net_view.dart';
import 'package:toolbox/data/model/app/version_related.dart'; import 'package:toolbox/data/model/app/version_related.dart';
import 'package:toolbox/data/model/server/custom.dart'; import 'package:toolbox/data/model/server/custom.dart';
import 'package:toolbox/data/model/server/private_key_info.dart';
import 'package:toolbox/data/model/server/server_private_info.dart';
import 'package:toolbox/data/model/server/snippet.dart';
import 'package:toolbox/data/model/ssh/virtual_key.dart';
import 'package:toolbox/data/res/build_data.dart'; import 'package:toolbox/data/res/build_data.dart';
import 'package:toolbox/data/res/provider.dart'; import 'package:toolbox/data/res/provider.dart';
import 'package:toolbox/data/res/store.dart'; import 'package:toolbox/data/res/store.dart';
import 'package:window_manager/window_manager.dart'; import 'package:toolbox/data/res/url.dart';
import 'app.dart';
import 'data/model/app/net_view.dart';
import 'data/model/server/private_key_info.dart';
import 'data/model/server/server_private_info.dart';
import 'data/model/server/snippet.dart';
import 'data/model/ssh/virtual_key.dart';
Future<void> main() async { Future<void> main() async {
_runInZone(() async { _runInZone(() async {
@@ -71,11 +69,11 @@ Future<void> _initApp() async {
// Base of all data. // Base of all data.
await _initDb(); await _initDb();
_initDesktopWindow(); _setupDebug();
_setupLogger(); SystemUIs.initDesktopWindow(Stores.setting.hideTitleBar.fetch());
// Load font // Load font
loadFontFile(Stores.setting.fontPath.fetch()); FontUtils.loadFrom(Stores.setting.fontPath.fetch());
if (isAndroid) { if (isAndroid) {
// SharedPreferences is only used on Android for saving home widgets settings. // SharedPreferences is only used on Android for saving home widgets settings.
@@ -119,7 +117,7 @@ Future<void> _initDb() async {
Pros.key.load(); Pros.key.load();
} }
void _setupLogger() { void _setupDebug() {
Logger.root.level = Level.ALL; Logger.root.level = Level.ALL;
Logger.root.onRecord.listen((record) { Logger.root.onRecord.listen((record) {
Pros.debug.addLog(record); Pros.debug.addLog(record);
@@ -127,25 +125,10 @@ void _setupLogger() {
if (record.error != null) print(record.error); if (record.error != null) print(record.error);
if (record.stackTrace != null) print(record.stackTrace); if (record.stackTrace != null) print(record.stackTrace);
}); });
if (Stores.setting.collectUsage.fetch()) {
Analysis.init(Urls.analysis, '0772e65c696709f879d87db77ae1a811259e3eb9');
} }
void _initDesktopWindow() async {
if (!isDesktop) return;
await windowManager.ensureInitialized();
await CustomAppBar.updateTitlebarHeight(Stores.setting.hideTitleBar.fetch());
final windowOptions = WindowOptions(
center: true,
backgroundColor: Colors.transparent,
skipTaskbar: false,
titleBarStyle: CustomAppBar.drawTitlebar ? TitleBarStyle.hidden : null,
minimumSize: const Size(300, 300),
);
windowManager.waitUntilReadyToShow(windowOptions, () async {
await windowManager.show();
await windowManager.focus();
});
} }
Future<void> _doVersionRelated() async { Future<void> _doVersionRelated() async {

View File

@@ -1,55 +0,0 @@
import 'package:fl_lib/fl_lib.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:toolbox/data/provider/debug.dart';
import 'package:toolbox/data/res/provider.dart';
class DebugPage extends StatelessWidget {
const DebugPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: CustomAppBar(
leading: IconButton(
onPressed: () => context.pop(),
icon: const Icon(Icons.arrow_back, color: Colors.white),
),
title: const Text('Logs', style: TextStyle(color: Colors.white)),
backgroundColor: Colors.black,
actions: [
IconButton(
onPressed: () => Pros.debug.clear(),
icon: const Icon(Icons.delete, color: Colors.white),
),
],
),
body: _buildTerminal(context),
backgroundColor: Colors.black,
);
}
Widget _buildTerminal(BuildContext context) {
return Container(
padding: const EdgeInsets.all(10),
color: Colors.black,
child: DefaultTextStyle(
style: const TextStyle(
color: Colors.white,
),
child: ChangeNotifierProvider.value(
value: Pros.debug,
child: Consumer<DebugProvider>(
builder: (_, provider, __) {
return ListView(
key: ValueKey(provider.widgets.length),
children: provider.widgets,
);
},
),
),
),
);
}
}

View File

@@ -9,7 +9,6 @@ import 'package:flutter_highlight/theme_map.dart';
import 'package:flutter_highlight/themes/a11y-light.dart'; import 'package:flutter_highlight/themes/a11y-light.dart';
import 'package:flutter_highlight/themes/monokai.dart'; import 'package:flutter_highlight/themes/monokai.dart';
import 'package:toolbox/core/extension/context/locale.dart'; import 'package:toolbox/core/extension/context/locale.dart';
import 'package:toolbox/core/utils/misc.dart';
import 'package:toolbox/data/res/highlight.dart'; import 'package:toolbox/data/res/highlight.dart';
import 'package:toolbox/data/res/store.dart'; import 'package:toolbox/data/res/store.dart';
@@ -118,7 +117,7 @@ class _EditorPageState extends State<EditorPage> {
return CustomAppBar( return CustomAppBar(
centerTitle: true, centerTitle: true,
title: TwoLineText( title: TwoLineText(
up: widget.title ?? getFileName(widget.path) ?? l10n.unknown, up: widget.title ?? widget.path?.getFileName() ?? l10n.unknown,
down: l10n.editor, down: l10n.editor,
), ),
actions: [ actions: [

View File

@@ -10,7 +10,6 @@ import 'package:toolbox/core/channel/home_widget.dart';
import 'package:toolbox/core/extension/build.dart'; import 'package:toolbox/core/extension/build.dart';
import 'package:toolbox/core/extension/context/locale.dart'; import 'package:toolbox/core/extension/context/locale.dart';
import 'package:toolbox/core/route.dart'; import 'package:toolbox/core/route.dart';
import 'package:toolbox/core/utils/ui.dart';
import 'package:toolbox/data/model/app/github_id.dart'; import 'package:toolbox/data/model/app/github_id.dart';
import 'package:toolbox/data/model/app/tab.dart'; import 'package:toolbox/data/model/app/tab.dart';
import 'package:toolbox/data/res/build_data.dart'; import 'package:toolbox/data/res/build_data.dart';
@@ -48,7 +47,7 @@ class _HomePageState extends State<HomePage>
@override @override
void initState() { void initState() {
super.initState(); super.initState();
switchStatusBar(hide: false); SystemUIs.switchStatusBar(hide: false);
WidgetsBinding.instance.addObserver(this); WidgetsBinding.instance.addObserver(this);
_selectIndex.value = Stores.setting.launchPage.fetch(); _selectIndex.value = Stores.setting.launchPage.fetch();
// avoid index out of range // avoid index out of range
@@ -286,11 +285,11 @@ class _HomePageState extends State<HomePage>
child: _buildAboutContent(), child: _buildAboutContent(),
actions: [ actions: [
TextButton( TextButton(
onPressed: () => openUrl(Urls.appWiki), onPressed: () => Urls.appWiki.launch(),
child: const Text('Wiki'), child: const Text('Wiki'),
), ),
TextButton( TextButton(
onPressed: () => openUrl(Urls.appHelp), onPressed: () => Urls.appHelp.launch(),
child: Text(l10n.feedback), child: Text(l10n.feedback),
), ),
TextButton( TextButton(

View File

@@ -5,7 +5,6 @@ import 'package:flutter/material.dart';
import 'package:icons_plus/icons_plus.dart'; import 'package:icons_plus/icons_plus.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:toolbox/core/extension/context/locale.dart'; import 'package:toolbox/core/extension/context/locale.dart';
import 'package:toolbox/core/utils/ui.dart';
import 'package:toolbox/data/model/app/shell_func.dart'; import 'package:toolbox/data/model/app/shell_func.dart';
import 'package:toolbox/data/model/server/custom.dart'; import 'package:toolbox/data/model/server/custom.dart';
import 'package:toolbox/data/model/server/wol_cfg.dart'; import 'package:toolbox/data/model/server/wol_cfg.dart';
@@ -456,7 +455,7 @@ class _ServerEditPageState extends State<ServerEditPage> {
), ),
title: Text(l10n.doc), title: Text(l10n.doc),
trailing: const Icon(Icons.open_in_new, size: 17), trailing: const Icon(Icons.open_in_new, size: 17),
onTap: () => openUrl(l10n.customCmdDocUrl), onTap: () => l10n.customCmdDocUrl.launch(),
).cardx, ).cardx,
]; ];
} }

View File

@@ -13,7 +13,6 @@ import 'package:toolbox/data/res/store.dart';
import 'package:toolbox/data/res/url.dart'; import 'package:toolbox/data/res/url.dart';
import '../../../core/route.dart'; import '../../../core/route.dart';
import '../../../core/utils/misc.dart';
import '../../../data/model/app/net_view.dart'; import '../../../data/model/app/net_view.dart';
import '../../../data/provider/app.dart'; import '../../../data/provider/app.dart';
import '../../../data/res/build_data.dart'; import '../../../data/res/build_data.dart';
@@ -424,7 +423,7 @@ class _SettingPageState extends State<SettingPage> {
} }
Widget _buildFont() { Widget _buildFont() {
final fontName = getFileName(_setting.fontPath.fetch()); final fontName = _setting.fontPath.fetch().getFileName();
return ListTile( return ListTile(
leading: const Icon(MingCute.font_fill), leading: const Icon(MingCute.font_fill),
title: Text(l10n.font), title: Text(l10n.font),

View File

@@ -4,7 +4,6 @@ import 'package:toolbox/core/extension/context/locale.dart';
import 'package:toolbox/data/model/app/server_detail_card.dart'; import 'package:toolbox/data/model/app/server_detail_card.dart';
import 'package:toolbox/data/res/store.dart'; import 'package:toolbox/data/res/store.dart';
class ServerDetailOrderPage extends StatefulWidget { class ServerDetailOrderPage extends StatefulWidget {
const ServerDetailOrderPage({super.key}); const ServerDetailOrderPage({super.key});

View File

@@ -19,7 +19,6 @@ import 'package:xterm/core.dart';
import 'package:xterm/ui.dart' hide TerminalThemes; import 'package:xterm/ui.dart' hide TerminalThemes;
import '../../../core/route.dart'; import '../../../core/route.dart';
import '../../../core/utils/misc.dart';
import '../../../data/model/server/server_private_info.dart'; import '../../../data/model/server/server_private_info.dart';
import '../../../data/model/ssh/virtual_key.dart'; import '../../../data/model/ssh/virtual_key.dart';
import '../../../data/res/terminal.dart'; import '../../../data/res/terminal.dart';
@@ -509,7 +508,7 @@ class _SSHPageState extends State<SSHPage> with AutomaticKeepAliveClientMixin {
} }
void _initStoredCfg() { void _initStoredCfg() {
final fontFamilly = getFileName(Stores.setting.fontPath.fetch()); final fontFamilly = Stores.setting.fontPath.fetch().getFileName();
final textSize = Stores.setting.termFontSize.fetch(); final textSize = Stores.setting.termFontSize.fetch();
final textStyle = TextStyle( final textStyle = TextStyle(
fontFamily: fontFamilly, fontFamily: fontFamilly,

View File

@@ -10,7 +10,6 @@ import 'package:toolbox/data/res/provider.dart';
import 'package:toolbox/view/widget/omit_start_text.dart'; import 'package:toolbox/view/widget/omit_start_text.dart';
import '../../../core/route.dart'; import '../../../core/route.dart';
import '../../../core/utils/misc.dart';
import '../../../data/model/app/path_with_prefix.dart'; import '../../../data/model/app/path_with_prefix.dart';
class LocalStoragePage extends StatefulWidget { class LocalStoragePage extends StatefulWidget {
@@ -134,7 +133,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
onPressed: () async { onPressed: () async {
final path = await Pfs.pickFilePath(); final path = await Pfs.pickFilePath();
if (path == null) return; if (path == null) return;
final name = getFileName(path) ?? 'imported'; final name = path.getFileName() ?? 'imported';
await File(path).copy(_path!.path.joinPath(name)); await File(path).copy(_path!.path.joinPath(name));
setState(() {}); setState(() {});
}, },

View File

@@ -22,9 +22,8 @@ class PopupMenu<T> extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return PopupMenuButton<T>( return PopupMenuButton<T>(
itemBuilder: (_) => items itemBuilder: (_) =>
.map((e) => PopupMenuItem(value: e, child: builder(e))) items.map((e) => PopupMenuItem(value: e, child: builder(e))).toList(),
.toList(),
onSelected: onSelected, onSelected: onSelected,
initialValue: initialValue, initialValue: initialValue,
padding: padding, padding: padding,

View File

@@ -471,7 +471,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 896; CURRENT_PROJECT_VERSION = 897;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "Server Box"; INFOPLIST_KEY_CFBundleDisplayName = "Server Box";
@@ -481,7 +481,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 10.15; MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 1.0.896; MARKETING_VERSION = 1.0.897;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "Server Box"; PRODUCT_NAME = "Server Box";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
@@ -608,7 +608,7 @@
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 896; CURRENT_PROJECT_VERSION = 897;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "Server Box"; INFOPLIST_KEY_CFBundleDisplayName = "Server Box";
@@ -618,7 +618,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 10.15; MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 1.0.896; MARKETING_VERSION = 1.0.897;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "Server Box"; PRODUCT_NAME = "Server Box";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
@@ -638,7 +638,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "3rd Party Mac Developer Application"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "3rd Party Mac Developer Application";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 896; CURRENT_PROJECT_VERSION = 897;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=macosx*]" = BA88US33G6; "DEVELOPMENT_TEAM[sdk=macosx*]" = BA88US33G6;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
@@ -649,7 +649,7 @@
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MACOSX_DEPLOYMENT_TARGET = 10.15; MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 1.0.896; MARKETING_VERSION = 1.0.897;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "Server Box"; PRODUCT_NAME = "Server Box";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";

View File

@@ -34,7 +34,7 @@ packages:
source: hosted source: hosted
version: "2.0.2" version: "2.0.2"
archive: archive:
dependency: "direct main" dependency: transitive
description: description:
name: archive name: archive
sha256: ecf4273855368121b1caed0d10d4513c7241dfc813f7d3c8933b36622ae9b265 sha256: ecf4273855368121b1caed0d10d4513c7241dfc813f7d3c8933b36622ae9b265
@@ -154,7 +154,7 @@ packages:
source: hosted source: hosted
version: "2.0.3" version: "2.0.3"
choice: choice:
dependency: "direct main" dependency: transitive
description: description:
name: choice name: choice
sha256: "52d07065e8056beba5b26cff7786134cbfa24927b1f5bf60a05d50058597b2d9" sha256: "52d07065e8056beba5b26cff7786134cbfa24927b1f5bf60a05d50058597b2d9"
@@ -349,7 +349,7 @@ packages:
source: hosted source: hosted
version: "7.0.0" version: "7.0.0"
file_picker: file_picker:
dependency: "direct main" dependency: transitive
description: description:
name: file_picker name: file_picker
sha256: "29c90806ac5f5fb896547720b73b17ee9aed9bba540dc5d91fe29f8c5745b10a" sha256: "29c90806ac5f5fb896547720b73b17ee9aed9bba540dc5d91fe29f8c5745b10a"
@@ -377,7 +377,7 @@ packages:
description: description:
path: "." path: "."
ref: main ref: main
resolved-ref: ff02a5d2b808a77f2f54528aece6b958cdc209a5 resolved-ref: d6f282b4883615cc5a31b5f3a720b6a74d5285f4
url: "https://github.com/lollipopkit/fl_lib" url: "https://github.com/lollipopkit/fl_lib"
source: git source: git
version: "0.0.1" version: "0.0.1"

View File

@@ -7,7 +7,6 @@ environment:
sdk: ">=3.0.0" sdk: ">=3.0.0"
dependencies: dependencies:
archive: ^3.3.8
flutter: flutter:
sdk: flutter sdk: flutter
flutter_localizations: flutter_localizations:
@@ -35,7 +34,6 @@ dependencies:
git: git:
ref: a343bc2fdc11fbc7dbfc1f170692426a6fe01cb9 ref: a343bc2fdc11fbc7dbfc1f170692426a6fe01cb9
url: https://github.com/lollipopkit/xterm.dart url: https://github.com/lollipopkit/xterm.dart
file_picker: ^8.0.1
plain_notification_token: ^0.0.4 plain_notification_token: ^0.0.4
highlight: ^0.7.0 highlight: ^0.7.0
flutter_highlight: ^0.7.0 flutter_highlight: ^0.7.0
@@ -47,7 +45,6 @@ dependencies:
git: git:
ref: master ref: master
url: https://github.com/lollipopkit/watch_connectivity url: https://github.com/lollipopkit/watch_connectivity
choice: ^2.0.0
#flutter_secure_storage: ^9.0.0 #flutter_secure_storage: ^9.0.0
xml: ^6.4.2 # for parsing nvidia-smi xml: ^6.4.2 # for parsing nvidia-smi
flutter_displaymode: ^0.6.0 flutter_displaymode: ^0.6.0