#156 opt.: show error of settings json

This commit is contained in:
lollipopkit
2023-09-07 16:41:38 +08:00
parent 459b647b68
commit 567f1442f5
7 changed files with 63 additions and 46 deletions

View File

@@ -470,7 +470,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 526;
CURRENT_PROJECT_VERSION = 529;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -478,7 +478,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.526;
MARKETING_VERSION = 1.0.529;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -602,7 +602,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 526;
CURRENT_PROJECT_VERSION = 529;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -610,7 +610,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.526;
MARKETING_VERSION = 1.0.529;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -628,7 +628,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 526;
CURRENT_PROJECT_VERSION = 529;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -636,7 +636,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.526;
MARKETING_VERSION = 1.0.529;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -657,7 +657,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 526;
CURRENT_PROJECT_VERSION = 529;
DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
@@ -670,7 +670,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0.526;
MARKETING_VERSION = 1.0.529;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
@@ -696,7 +696,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 526;
CURRENT_PROJECT_VERSION = 529;
DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
@@ -709,7 +709,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0.526;
MARKETING_VERSION = 1.0.529;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -732,7 +732,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 526;
CURRENT_PROJECT_VERSION = 529;
DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
@@ -745,7 +745,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0.526;
MARKETING_VERSION = 1.0.529;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
PRODUCT_NAME = "$(TARGET_NAME)";

View File

@@ -33,6 +33,14 @@ class MyApp extends StatelessWidget {
useMaterial3: true,
brightness: Brightness.dark,
colorSchemeSeed: primaryColor,
/// After upgrading to flutter 3.13,
/// the shadow color of the drawer is white (maybe a bug).
/// TODO: remember to remove it after the bug is fixed.
drawerTheme: const DrawerThemeData(
backgroundColor: Colors.black,
shadowColor: Colors.black12,
),
);
return MaterialApp(
@@ -57,8 +65,6 @@ class MyApp extends StatelessWidget {
ThemeData _getAmoledTheme(ThemeData darkTheme) => darkTheme.copyWith(
scaffoldBackgroundColor: Colors.black,
dialogBackgroundColor: Colors.black,
drawerTheme: const DrawerThemeData(
backgroundColor: Colors.black, shadowColor: Colors.black),
appBarTheme: const AppBarTheme(backgroundColor: Colors.black),
dialogTheme: const DialogTheme(backgroundColor: Colors.black),
bottomSheetTheme:

View File

@@ -2,8 +2,8 @@
class BuildData {
static const String name = "ServerBox";
static const int build = 526;
static const String engine = "3.13.1";
static const String buildAt = "2023-09-05 21:15:22.219124";
static const int modifications = 2;
static const int build = 529;
static const String engine = "3.13.2";
static const String buildAt = "2023-09-06 21:16:27.707712";
static const int modifications = 4;
}

View File

@@ -1,7 +1,6 @@
import 'dart:async';
import 'dart:io';
import 'package:after_layout/after_layout.dart';
import 'package:code_text_field/code_text_field.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
@@ -44,14 +43,16 @@ class EditorPage extends StatefulWidget {
_EditorPageState createState() => _EditorPageState();
}
class _EditorPageState extends State<EditorPage> with AfterLayoutMixin {
late CodeController _controller;
late final _focusNode = FocusNode();
class _EditorPageState extends State<EditorPage> {
final _focusNode = FocusNode();
final _setting = locator<SettingStore>();
late CodeController _controller;
late Map<String, TextStyle> _codeTheme;
late S _s;
late String? _langCode;
late TextStyle _textStyle;
late final _textStyle = TextStyle(fontSize: _setting.editorFontSize.fetch());
String? _langCode;
@override
void initState() {
@@ -62,7 +63,16 @@ class _EditorPageState extends State<EditorPage> with AfterLayoutMixin {
_controller = CodeController(
language: suffix2HighlightMap[_langCode],
);
_textStyle = TextStyle(fontSize: _setting.editorFontSize.fetch());
/// TODO: This is a temporary solution to avoid the loading stuck
Future.delayed(const Duration(milliseconds: 377)).then((value) async {
if (widget.path != null) {
final code = await File(widget.path!).readAsString();
_controller.text = code;
} else if (widget.text != null) {
_controller.text = widget.text!;
}
});
}
@override
@@ -115,7 +125,7 @@ class _EditorPageState extends State<EditorPage> with AfterLayoutMixin {
return CustomAppBar(
centerTitle: true,
title: TwoLineText(
up: widget.title ?? getFileName(widget.path) ?? '',
up: widget.title ?? getFileName(widget.path) ?? _s.unknown,
down: _s.editor,
),
actions: [
@@ -156,16 +166,4 @@ class _EditorPageState extends State<EditorPage> with AfterLayoutMixin {
),
));
}
@override
FutureOr<void> afterFirstLayout(BuildContext context) async {
/// TODO: This is a temporary solution to avoid the loading stuck
await Future.delayed(const Duration(milliseconds: 377));
if (widget.path != null) {
final code = await File(widget.path!).readAsString();
_controller.text = code;
} else if (widget.text != null) {
_controller.text = widget.text!;
}
}
}

View File

@@ -370,6 +370,15 @@ class _HomePageState extends State<HomePage>
if (result == null) {
return;
}
_setting.box.putAll(json.decode(result) as Map<String, dynamic>);
try {
final newSettings = json.decode(result) as Map<String, dynamic>;
_setting.box.putAll(newSettings);
} catch (e) {
showRoundDialog(
context: context,
title: Text(_s.error),
child: Text('${_s.save}:\n$e'),
);
}
}
}

View File

@@ -320,7 +320,11 @@ class _ServerDetailPageState extends State<ServerDetailPage>
style: textSize11,
textScaleFactor: _textFactor,
),
Text(disk.path, style: textSize11, textScaleFactor: _textFactor,)
Text(
disk.path,
style: textSize11,
textScaleFactor: _textFactor,
)
],
),
_buildProgress(disk.usedPercent.toDouble())

View File

@@ -474,9 +474,9 @@
baseConfigurationReference = C1C758C41C4E208965A68933 /* Pods-RunnerTests.debug.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CURRENT_PROJECT_VERSION = 526;
CURRENT_PROJECT_VERSION = 529;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0.526;
MARKETING_VERSION = 1.0.529;
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
@@ -489,9 +489,9 @@
baseConfigurationReference = 15AF97DF993E8968098D6EBE /* Pods-RunnerTests.release.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CURRENT_PROJECT_VERSION = 526;
CURRENT_PROJECT_VERSION = 529;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0.526;
MARKETING_VERSION = 1.0.529;
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
@@ -504,9 +504,9 @@
baseConfigurationReference = 7CFA7DE7FABA75685DFB6948 /* Pods-RunnerTests.profile.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CURRENT_PROJECT_VERSION = 526;
CURRENT_PROJECT_VERSION = 529;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0.526;
MARKETING_VERSION = 1.0.529;
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;