mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt. for performance
This commit is contained in:
@@ -360,7 +360,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CURRENT_PROJECT_VERSION = 347;
|
||||
CURRENT_PROJECT_VERSION = 353;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||
@@ -368,7 +368,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.347;
|
||||
MARKETING_VERSION = 1.0.353;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
@@ -491,7 +491,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CURRENT_PROJECT_VERSION = 347;
|
||||
CURRENT_PROJECT_VERSION = 353;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||
@@ -499,7 +499,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.347;
|
||||
MARKETING_VERSION = 1.0.353;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
@@ -516,7 +516,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CURRENT_PROJECT_VERSION = 347;
|
||||
CURRENT_PROJECT_VERSION = 353;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||
@@ -524,7 +524,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.347;
|
||||
MARKETING_VERSION = 1.0.353;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
|
||||
@@ -103,7 +103,7 @@ void setTransparentNavigationBar(BuildContext context) {
|
||||
String tabTitleName(BuildContext context, AppTab tab) {
|
||||
final s = S.of(context)!;
|
||||
switch (tab) {
|
||||
case AppTab.servers:
|
||||
case AppTab.server:
|
||||
return s.server;
|
||||
case AppTab.snippet:
|
||||
return s.convert;
|
||||
|
||||
@@ -1 +1,21 @@
|
||||
enum AppTab { servers, snippet, ping }
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:toolbox/view/page/ping.dart';
|
||||
import 'package:toolbox/view/page/server/tab.dart';
|
||||
import 'package:toolbox/view/page/snippet/list.dart';
|
||||
|
||||
enum AppTab {
|
||||
server,
|
||||
snippet,
|
||||
ping;
|
||||
|
||||
Widget get page {
|
||||
switch (this) {
|
||||
case server:
|
||||
return const ServerPage();
|
||||
case snippet:
|
||||
return const SnippetListPage();
|
||||
case ping:
|
||||
return const PingPage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 347;
|
||||
static const int build = 353;
|
||||
static const String engine = "3.10.3";
|
||||
static const String buildAt = "2023-06-04 22:37:44.679072";
|
||||
static const int modifications = 7;
|
||||
static const String buildAt = "2023-06-05 17:15:25.298942";
|
||||
static const int modifications = 6;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ const backendUrl = 'https://res.lolli.tech';
|
||||
const baseUrl = '$backendUrl/serverbox';
|
||||
const joinQQGroupUrl = 'https://jq.qq.com/?_wv=1027&k=G0hUmPAq';
|
||||
const myGithub = 'https://github.com/lollipopkit';
|
||||
const issueUrl = '$myGithub/flutter_server_box/issues';
|
||||
const appHelpUrl = '$myGithub/flutter_server_box#-help';
|
||||
|
||||
// Thanks
|
||||
const thanksMap = {
|
||||
|
||||
@@ -24,14 +24,6 @@ class SettingStore extends PersistentStore {
|
||||
StoreProperty<int> get storeVersion =>
|
||||
property('storeVersion', defaultValue: 0);
|
||||
|
||||
// Show logo on server detail page
|
||||
StoreProperty<bool> get showDistLogo =>
|
||||
property('showDistLogo', defaultValue: true);
|
||||
|
||||
// First time to use SSH term
|
||||
StoreProperty<bool> get firstTimeUseSshTerm =>
|
||||
property('firstTimeUseSshTerm', defaultValue: true);
|
||||
|
||||
StoreProperty<int> get termColorIdx =>
|
||||
property('termColorIdx', defaultValue: 0);
|
||||
|
||||
|
||||
@@ -419,7 +419,7 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
||||
return Text(_s.waitConnection);
|
||||
case DockerErrType.invalidVersion:
|
||||
return UrlText(
|
||||
text: _s.invalidVersionHelp(issueUrl),
|
||||
text: _s.invalidVersionHelp(appHelpUrl),
|
||||
replace: 'Github',
|
||||
);
|
||||
default:
|
||||
|
||||
@@ -2,11 +2,11 @@ import 'package:after_layout/after_layout.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:toolbox/core/extension/navigator.dart';
|
||||
import 'package:toolbox/data/model/app/tab.dart';
|
||||
import 'package:toolbox/data/provider/app.dart';
|
||||
import 'package:toolbox/data/res/misc.dart';
|
||||
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||
import 'package:toolbox/view/widget/value_notifier.dart';
|
||||
|
||||
import '../../core/analysis.dart';
|
||||
import '../../core/route.dart';
|
||||
@@ -23,12 +23,9 @@ import '../widget/url_text.dart';
|
||||
import 'backup.dart';
|
||||
import 'convert.dart';
|
||||
import 'debug.dart';
|
||||
import 'ping.dart';
|
||||
import 'private_key/list.dart';
|
||||
import 'server/tab.dart';
|
||||
import 'setting.dart';
|
||||
import 'sftp/local.dart';
|
||||
import 'snippet/list.dart';
|
||||
|
||||
class HomePage extends StatefulWidget {
|
||||
const HomePage({Key? key}) : super(key: key);
|
||||
@@ -47,19 +44,19 @@ class _HomePageState extends State<HomePage>
|
||||
|
||||
late final PageController _pageController;
|
||||
|
||||
late int _selectIndex;
|
||||
final _selectIndex = ValueNotifier(0);
|
||||
late S _s;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
_selectIndex = _setting.launchPage.fetch()!;
|
||||
_selectIndex.value = _setting.launchPage.fetch()!;
|
||||
// avoid index out of range
|
||||
if (_selectIndex >= AppTab.values.length || _selectIndex < 0) {
|
||||
_selectIndex = 0;
|
||||
if (_selectIndex.value >= AppTab.values.length || _selectIndex.value < 0) {
|
||||
_selectIndex.value = 0;
|
||||
}
|
||||
_pageController = PageController(initialPage: _selectIndex);
|
||||
_pageController = PageController(initialPage: _selectIndex.value);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -120,34 +117,27 @@ class _HomePageState extends State<HomePage>
|
||||
),
|
||||
],
|
||||
),
|
||||
body: PageView(
|
||||
physics: const ClampingScrollPhysics(),
|
||||
body: PageView.builder(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
controller: _pageController,
|
||||
onPageChanged: (index) {
|
||||
setState(() {
|
||||
_selectIndex = index;
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
});
|
||||
},
|
||||
children: const [ServerPage(), SnippetListPage(), PingPage()],
|
||||
itemBuilder: (_, index) => AppTab.values[index].page,
|
||||
),
|
||||
bottomNavigationBar: _buildBottomBar(context),
|
||||
bottomNavigationBar:
|
||||
ValueBuilder(listenable: _selectIndex, build: _buildBottomBar),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBottomBar(BuildContext context) {
|
||||
Widget _buildBottomBar() {
|
||||
return NavigationBar(
|
||||
selectedIndex: _selectIndex,
|
||||
selectedIndex: _selectIndex.value,
|
||||
animationDuration: const Duration(milliseconds: 250),
|
||||
onDestinationSelected: (int index) {
|
||||
setState(() {
|
||||
_selectIndex = index;
|
||||
_selectIndex.value = index;
|
||||
_pageController.animateToPage(
|
||||
index,
|
||||
duration: const Duration(milliseconds: 677),
|
||||
curve: Curves.fastLinearToSlowEaseIn,
|
||||
);
|
||||
});
|
||||
},
|
||||
labelBehavior: NavigationDestinationLabelBehavior.onlyShowSelected,
|
||||
destinations: [
|
||||
@@ -189,9 +179,7 @@ class _HomePageState extends State<HomePage>
|
||||
style: textSize13,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.07,
|
||||
),
|
||||
const SizedBox(height: 37),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 17),
|
||||
child: Column(
|
||||
@@ -264,17 +252,13 @@ class _HomePageState extends State<HomePage>
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => openUrl(issueUrl),
|
||||
onPressed: () => openUrl(appHelpUrl),
|
||||
child: Text(_s.feedback),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => showLicensePage(context: context),
|
||||
child: Text(_s.license),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => context.pop(),
|
||||
child: Text(_s.close),
|
||||
)
|
||||
],
|
||||
);
|
||||
},
|
||||
@@ -288,20 +272,9 @@ class _HomePageState extends State<HomePage>
|
||||
}
|
||||
|
||||
Widget _buildIcon() {
|
||||
return Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxHeight: 53, maxWidth: 53),
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxHeight: 83, maxWidth: 83),
|
||||
return ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxHeight: 57, maxWidth: 57),
|
||||
child: appIcon,
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -82,10 +82,10 @@ class _PingPageState extends State<PingPage>
|
||||
);
|
||||
}
|
||||
|
||||
void _doPing() {
|
||||
Future<void> _doPing() async {
|
||||
context.pop();
|
||||
try {
|
||||
doPing();
|
||||
await doPing();
|
||||
} catch (e) {
|
||||
showRoundDialog(
|
||||
context: context,
|
||||
|
||||
@@ -97,12 +97,7 @@ class _PrivateKeyEditPageState extends State<PrivateKeyEditPage>
|
||||
}
|
||||
FocusScope.of(context).unfocus();
|
||||
setState(() {
|
||||
_loading = const SizedBox(
|
||||
height: 50,
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
);
|
||||
_loading = centerSizedLoading;
|
||||
});
|
||||
final info = PrivateKeyInfo(name, key, '');
|
||||
try {
|
||||
|
||||
@@ -14,7 +14,7 @@ import '../../../data/provider/server.dart';
|
||||
import '../../../data/res/ui.dart';
|
||||
import '../../../data/store/private_key.dart';
|
||||
import '../../../locator.dart';
|
||||
import '../../widget/tag.dart';
|
||||
import '../../widget/tag_editor.dart';
|
||||
import '../private_key/edit.dart';
|
||||
|
||||
class ServerEditPage extends StatefulWidget {
|
||||
|
||||
@@ -17,12 +17,10 @@ import '../../../data/provider/server.dart';
|
||||
import '../../../data/res/color.dart';
|
||||
import '../../../data/model/app/menu.dart';
|
||||
import '../../../data/res/ui.dart';
|
||||
import '../../../data/res/url.dart';
|
||||
import '../../../data/store/setting.dart';
|
||||
import '../../../locator.dart';
|
||||
import '../../widget/popup_menu.dart';
|
||||
import '../../widget/round_rect_card.dart';
|
||||
import '../../widget/url_text.dart';
|
||||
import '../docker.dart';
|
||||
import '../pkg.dart';
|
||||
import '../sftp/remote.dart';
|
||||
@@ -303,29 +301,7 @@ class _ServerPageState extends State<ServerPage>
|
||||
Icons.terminal,
|
||||
size: 21,
|
||||
),
|
||||
onTap: () async {
|
||||
if (_settingStore.firstTimeUseSshTerm.fetch()!) {
|
||||
await showRoundDialog(
|
||||
context: context,
|
||||
child: UrlText(
|
||||
text: _s.sshTip(issueUrl),
|
||||
replace: 'Github Issue',
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
_settingStore.firstTimeUseSshTerm.put(false);
|
||||
context.pop();
|
||||
AppRoute(SSHPage(spi: spi), 'ssh page').go(context);
|
||||
},
|
||||
child: Text(_s.ok),
|
||||
)
|
||||
],
|
||||
);
|
||||
} else {
|
||||
AppRoute(SSHPage(spi: spi), 'ssh page').go(context);
|
||||
}
|
||||
},
|
||||
onTap: () => AppRoute(SSHPage(spi: spi), 'ssh page').go(context),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +142,6 @@ class _SettingPageState extends State<SettingPage> {
|
||||
Widget _buildServer() {
|
||||
return Column(
|
||||
children: [
|
||||
_buildDistLogoSwitch(),
|
||||
_buildUpdateInterval(),
|
||||
_buildMaxRetry(),
|
||||
_buildDiskIgnorePath(),
|
||||
@@ -168,19 +167,6 @@ class _SettingPageState extends State<SettingPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDistLogoSwitch() {
|
||||
return ListTile(
|
||||
title: Text(
|
||||
_s.showDistLogo,
|
||||
),
|
||||
subtitle: Text(
|
||||
_s.onServerDetailPage,
|
||||
style: grey,
|
||||
),
|
||||
trailing: buildSwitch(context, _setting.showDistLogo),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCheckUpdate() {
|
||||
return Consumer<AppProvider>(
|
||||
builder: (_, app, __) {
|
||||
|
||||
@@ -475,9 +475,9 @@
|
||||
baseConfigurationReference = C1C758C41C4E208965A68933 /* Pods-RunnerTests.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CURRENT_PROJECT_VERSION = 347;
|
||||
CURRENT_PROJECT_VERSION = 353;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0.347;
|
||||
MARKETING_VERSION = 1.0.353;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
@@ -490,9 +490,9 @@
|
||||
baseConfigurationReference = 15AF97DF993E8968098D6EBE /* Pods-RunnerTests.release.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CURRENT_PROJECT_VERSION = 347;
|
||||
CURRENT_PROJECT_VERSION = 353;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0.347;
|
||||
MARKETING_VERSION = 1.0.353;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
@@ -505,9 +505,9 @@
|
||||
baseConfigurationReference = 7CFA7DE7FABA75685DFB6948 /* Pods-RunnerTests.profile.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CURRENT_PROJECT_VERSION = 347;
|
||||
CURRENT_PROJECT_VERSION = 353;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0.347;
|
||||
MARKETING_VERSION = 1.0.353;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
|
||||
Reference in New Issue
Block a user