mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.
This commit is contained in:
@@ -470,7 +470,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CURRENT_PROJECT_VERSION = 417;
|
||||
CURRENT_PROJECT_VERSION = 422;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||
@@ -478,7 +478,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.417;
|
||||
MARKETING_VERSION = 1.0.422;
|
||||
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 = 417;
|
||||
CURRENT_PROJECT_VERSION = 422;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||
@@ -610,7 +610,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.417;
|
||||
MARKETING_VERSION = 1.0.422;
|
||||
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 = 417;
|
||||
CURRENT_PROJECT_VERSION = 422;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||
@@ -636,7 +636,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.417;
|
||||
MARKETING_VERSION = 1.0.422;
|
||||
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 = 417;
|
||||
CURRENT_PROJECT_VERSION = 422;
|
||||
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.417;
|
||||
MARKETING_VERSION = 1.0.422;
|
||||
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 = 417;
|
||||
CURRENT_PROJECT_VERSION = 422;
|
||||
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.417;
|
||||
MARKETING_VERSION = 1.0.422;
|
||||
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 = 417;
|
||||
CURRENT_PROJECT_VERSION = 422;
|
||||
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.417;
|
||||
MARKETING_VERSION = 1.0.422;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
||||
@@ -22,8 +22,8 @@ enum AppShellFuncType {
|
||||
case AppShellFuncType.status:
|
||||
return 'status';
|
||||
case AppShellFuncType.docker:
|
||||
/// `dockeR` -> avoid conflict with `docker` command
|
||||
/// 以防止循环递归
|
||||
// `dockeR` -> avoid conflict with `docker` command
|
||||
// 以防止循环递归
|
||||
return 'dockeR';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,14 @@ import 'package:toolbox/locator.dart';
|
||||
|
||||
final _dockerNotFound = RegExp(r'command not found|Unknown command');
|
||||
final _versionReg = RegExp(r'(Version:)\s+([0-9]+\.[0-9]+\.[0-9]+)');
|
||||
final _editionReg = RegExp(r'(Client:)\s+(.+-.+)');
|
||||
// eg: `Docker Engine - Community`
|
||||
final _editionReg = RegExp(r'Docker Engine - [a-zA-Z]+');
|
||||
final _dockerPrefixReg = RegExp(r'(sudo )?docker ');
|
||||
|
||||
final _logger = Logger('DOCKER');
|
||||
|
||||
class DockerProvider extends BusyProvider {
|
||||
final dockerStore = locator<DockerStore>();
|
||||
final _dockerStore = locator<DockerStore>();
|
||||
|
||||
SSHClient? client;
|
||||
String? userName;
|
||||
@@ -36,8 +37,12 @@ class DockerProvider extends BusyProvider {
|
||||
String? runLog;
|
||||
bool isRequestingPwd = false;
|
||||
|
||||
void init(SSHClient client, String userName, PwdRequestFunc onPwdReq,
|
||||
String hostId) {
|
||||
void init(
|
||||
SSHClient client,
|
||||
String userName,
|
||||
PwdRequestFunc onPwdReq,
|
||||
String hostId,
|
||||
) {
|
||||
this.client = client;
|
||||
this.userName = userName;
|
||||
this.onPwdReq = onPwdReq;
|
||||
@@ -77,29 +82,22 @@ class DockerProvider extends BusyProvider {
|
||||
|
||||
// Parse docker version
|
||||
final verRaw = DockerCmdType.version.find(segments);
|
||||
try {
|
||||
version = _versionReg.firstMatch(verRaw)?.group(2);
|
||||
edition = _editionReg.firstMatch(verRaw)?.group(2);
|
||||
} catch (e) {
|
||||
error = DockerErr(
|
||||
type: DockerErrType.invalidVersion,
|
||||
message: '$verRaw\n\n$e',
|
||||
);
|
||||
rethrow;
|
||||
}
|
||||
edition = _editionReg.firstMatch(verRaw)?.group(0);
|
||||
|
||||
// Parse docker ps
|
||||
final psRaw = DockerCmdType.ps.find(segments);
|
||||
try {
|
||||
final lines = psRaw.split('\n');
|
||||
lines.removeWhere((element) => element.isEmpty);
|
||||
lines.removeAt(0);
|
||||
if (lines.isNotEmpty) lines.removeAt(0);
|
||||
items = lines.map((e) => DockerPsItem.fromRawString(e)).toList();
|
||||
} catch (e) {
|
||||
error = DockerErr(
|
||||
type: DockerErrType.parsePsItem,
|
||||
message: '$psRaw\n\n$e',
|
||||
message: '$psRaw\n-\n$e',
|
||||
);
|
||||
_logger.warning('parse docker ps: $psRaw', e);
|
||||
rethrow;
|
||||
} finally {
|
||||
setBusyState(false);
|
||||
@@ -110,13 +108,14 @@ class DockerProvider extends BusyProvider {
|
||||
try {
|
||||
final imageLines = imageRaw.split('\n');
|
||||
imageLines.removeWhere((element) => element.isEmpty);
|
||||
imageLines.removeAt(0);
|
||||
if (imageLines.isNotEmpty) imageLines.removeAt(0);
|
||||
images = imageLines.map((e) => DockerImage.fromRawStr(e)).toList();
|
||||
} catch (e) {
|
||||
error = DockerErr(
|
||||
type: DockerErrType.parseImages,
|
||||
message: '$imageRaw\n\n$e',
|
||||
message: '$imageRaw\n-\n$e',
|
||||
);
|
||||
_logger.warning('parse docker images: $imageRaw', e);
|
||||
rethrow;
|
||||
} finally {
|
||||
setBusyState(false);
|
||||
@@ -139,8 +138,10 @@ class DockerProvider extends BusyProvider {
|
||||
} catch (e) {
|
||||
error = DockerErr(
|
||||
type: DockerErrType.parseStats,
|
||||
message: '$statsRaw\n\n$e',
|
||||
message: '$statsRaw\n-\n$e',
|
||||
);
|
||||
_logger.warning('parse docker stats: $statsRaw', e);
|
||||
rethrow;
|
||||
} finally {
|
||||
setBusyState(false);
|
||||
}
|
||||
@@ -205,7 +206,7 @@ class DockerProvider extends BusyProvider {
|
||||
|
||||
// judge whether to use DOCKER_HOST
|
||||
String _wrap(String cmd) {
|
||||
final dockerHost = dockerStore.getDockerHost(hostId!);
|
||||
final dockerHost = _dockerStore.getDockerHost(hostId!);
|
||||
if (dockerHost == null || dockerHost.isEmpty) {
|
||||
return cmd.withLangExport;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 417;
|
||||
static const int build = 422;
|
||||
static const String engine = "3.10.6";
|
||||
static const String buildAt = "2023-08-05 13:35:14.889342";
|
||||
static const int modifications = 3;
|
||||
static const String buildAt = "2023-08-05 17:05:26.027438";
|
||||
static const int modifications = 10;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import '../model/app/shell_func.dart';
|
||||
import 'build_data.dart';
|
||||
|
||||
const seperator = 'SrvBox';
|
||||
const seperator = 'SrvBoxSep';
|
||||
const serverBoxDir = r'$HOME/.config/server_box';
|
||||
const shellPath = '$serverBoxDir/mobile_app.sh';
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:toolbox/core/extension/navigator.dart';
|
||||
import 'package:toolbox/data/provider/debug.dart';
|
||||
|
||||
class DebugPage extends StatefulWidget {
|
||||
@@ -14,7 +15,11 @@ class _DebugPageState extends State<DebugPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Logs'),
|
||||
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,
|
||||
),
|
||||
body: _buildTerminal(context),
|
||||
|
||||
@@ -239,7 +239,7 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
||||
size: 37,
|
||||
),
|
||||
const SizedBox(height: 27),
|
||||
_buildErr(_docker.error!),
|
||||
Text(_docker.error?.message ?? _s.unknownError),
|
||||
const SizedBox(height: 27),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(17),
|
||||
@@ -250,7 +250,7 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
||||
);
|
||||
}
|
||||
if (_docker.items == null || _docker.images == null) {
|
||||
Future.delayed(const Duration(milliseconds: 177), () {
|
||||
Future.delayed(const Duration(milliseconds: 37), () {
|
||||
if (mounted) {
|
||||
_docker.refresh();
|
||||
}
|
||||
@@ -258,40 +258,37 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
||||
return centerLoading;
|
||||
}
|
||||
|
||||
final items = <Widget>[];
|
||||
items.addAll([
|
||||
final items = <Widget>[
|
||||
_buildLoading(),
|
||||
_buildVersion(
|
||||
_docker.edition ?? _s.unknown,
|
||||
_docker.version ?? _s.unknown,
|
||||
),
|
||||
_buildVersion(),
|
||||
_buildPsHeader(),
|
||||
_buildPsItems(),
|
||||
_buildImages(),
|
||||
_buildImageHeader(),
|
||||
_buildImageItems(),
|
||||
_buildEditHost(),
|
||||
].map((e) => RoundRectCard(e)));
|
||||
items.add(const SizedBox(height: 37));
|
||||
const SizedBox(height: 37),
|
||||
].map((e) => RoundRectCard(e));
|
||||
return ListView(
|
||||
padding: const EdgeInsets.all(7),
|
||||
children: items,
|
||||
children: items.toList(),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildImages() {
|
||||
if (_docker.images == null) {
|
||||
return nil;
|
||||
}
|
||||
final items = _docker.images!.map(_buildImageItem).toList();
|
||||
items.insert(
|
||||
0,
|
||||
ListTile(
|
||||
Widget _buildImageHeader() {
|
||||
return ListTile(
|
||||
title: Text(_s.imagesList),
|
||||
subtitle: Text(
|
||||
_s.dockerImagesFmt(_docker.images!.length),
|
||||
style: grey,
|
||||
),
|
||||
),
|
||||
);
|
||||
return Column(children: items);
|
||||
}
|
||||
|
||||
Widget _buildImageItems() {
|
||||
if (_docker.images == null) {
|
||||
return nil;
|
||||
}
|
||||
return Column(children: _docker.images!.map(_buildImageItem).toList());
|
||||
}
|
||||
|
||||
Widget _buildImageItem(DockerImage e) {
|
||||
@@ -355,69 +352,6 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildEditHost() {
|
||||
final children = <Widget>[];
|
||||
if (_docker.items!.isEmpty && _docker.images!.isEmpty) {
|
||||
children.add(Padding(
|
||||
padding: const EdgeInsets.fromLTRB(17, 17, 17, 0),
|
||||
child: Text(
|
||||
_s.dockerEmptyRunningItems,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
));
|
||||
}
|
||||
children.add(
|
||||
TextButton(
|
||||
onPressed: _showEditHostDialog,
|
||||
child: Text(_s.dockerEditHost),
|
||||
),
|
||||
);
|
||||
return Column(
|
||||
children: children,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _showEditHostDialog() async {
|
||||
await showRoundDialog(
|
||||
context: context,
|
||||
title: Text(_s.dockerEditHost),
|
||||
child: Input(
|
||||
maxLines: 1,
|
||||
controller:
|
||||
TextEditingController(text: 'unix:///run/user/1000/docker.sock'),
|
||||
onSubmitted: (value) {
|
||||
locator<DockerStore>().setDockerHost(widget.spi.id, value.trim());
|
||||
_docker.refresh();
|
||||
context.pop();
|
||||
},
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => context.pop(),
|
||||
child: Text(_s.cancel),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildErr(DockerErr err) {
|
||||
var errStr = '';
|
||||
switch (err.type) {
|
||||
case DockerErrType.noClient:
|
||||
errStr = _s.noClient;
|
||||
break;
|
||||
case DockerErrType.notInstalled:
|
||||
errStr = _s.dockerNotInstalled;
|
||||
break;
|
||||
case DockerErrType.invalidVersion:
|
||||
errStr = _s.invalidVersion;
|
||||
break;
|
||||
default:
|
||||
errStr = err.message ?? _s.unknown;
|
||||
}
|
||||
return Text(errStr);
|
||||
}
|
||||
|
||||
Widget _buildSolution(DockerErr err) {
|
||||
switch (err.type) {
|
||||
case DockerErrType.notInstalled:
|
||||
@@ -432,43 +366,58 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
||||
text: _s.invalidVersionHelp(appHelpUrl),
|
||||
replace: 'Github',
|
||||
);
|
||||
default:
|
||||
return Text(_s.unknownError);
|
||||
|
||||
/// TODO: Add solution for these cases.
|
||||
case DockerErrType.parseImages:
|
||||
return const Text('Parse images error');
|
||||
case DockerErrType.parsePsItem:
|
||||
return const Text('Parse ps item error');
|
||||
case DockerErrType.parseStats:
|
||||
return const Text('Parse stats error');
|
||||
case DockerErrType.unknown:
|
||||
return const Text('Unknown error');
|
||||
case DockerErrType.cmdNoPrefix:
|
||||
return const Text('Cmd no prefix');
|
||||
case DockerErrType.segmentsNotMatch:
|
||||
return const Text('Segments not match');
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildVersion(String edition, String version) {
|
||||
Widget _buildVersion() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(17),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [Text(edition), Text(version)],
|
||||
children: [
|
||||
Text(_docker.edition ?? _s.unknown),
|
||||
Text(_docker.version ?? _s.unknown),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPsItems() {
|
||||
final items = _docker.items!.map(_buildPsItem).toList();
|
||||
items.insert(
|
||||
0,
|
||||
ListTile(
|
||||
Widget _buildPsHeader() {
|
||||
return ListTile(
|
||||
title: Text(_s.containerStatus),
|
||||
subtitle: Text(_buildSubtitle(_docker.items!), style: grey),
|
||||
),
|
||||
subtitle: Text(_buildPsCardSubtitle(_docker.items!), style: grey),
|
||||
);
|
||||
// Bottom padding
|
||||
items.add(height13);
|
||||
}
|
||||
|
||||
Widget _buildPsItems() {
|
||||
if (_docker.items == null) {
|
||||
return nil;
|
||||
}
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: items,
|
||||
children: _docker.items!.map(_buildPsItem).toList(),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPsItem(DockerPsItem item) {
|
||||
return ListTile(
|
||||
title: Text(item.name),
|
||||
title: Text(item.image),
|
||||
subtitle: Text(
|
||||
'${item.image}\n${item.status}',
|
||||
'${item.name} - ${item.status}',
|
||||
style: textSize13Grey,
|
||||
),
|
||||
trailing: _buildMoreBtn(item, _docker.isBusy),
|
||||
@@ -554,7 +503,7 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
||||
);
|
||||
}
|
||||
|
||||
String _buildSubtitle(List<DockerPsItem> running) {
|
||||
String _buildPsCardSubtitle(List<DockerPsItem> running) {
|
||||
final runningCount = running.where((element) => element.running).length;
|
||||
final stoped = running.length - runningCount;
|
||||
if (stoped == 0) {
|
||||
@@ -562,4 +511,49 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
||||
}
|
||||
return _s.dockerStatusRunningAndStoppedFmt(runningCount, stoped);
|
||||
}
|
||||
|
||||
Widget _buildEditHost() {
|
||||
final children = <Widget>[];
|
||||
if (_docker.items!.isEmpty && _docker.images!.isEmpty) {
|
||||
children.add(Padding(
|
||||
padding: const EdgeInsets.fromLTRB(17, 17, 17, 0),
|
||||
child: Text(
|
||||
_s.dockerEmptyRunningItems,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
));
|
||||
}
|
||||
children.add(
|
||||
TextButton(
|
||||
onPressed: _showEditHostDialog,
|
||||
child: Text(_s.dockerEditHost),
|
||||
),
|
||||
);
|
||||
return Column(
|
||||
children: children,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _showEditHostDialog() async {
|
||||
await showRoundDialog(
|
||||
context: context,
|
||||
title: Text(_s.dockerEditHost),
|
||||
child: Input(
|
||||
maxLines: 1,
|
||||
controller:
|
||||
TextEditingController(text: 'unix:///run/user/1000/docker.sock'),
|
||||
onSubmitted: (value) {
|
||||
locator<DockerStore>().setDockerHost(widget.spi.id, value.trim());
|
||||
_docker.refresh();
|
||||
context.pop();
|
||||
},
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => context.pop(),
|
||||
child: Text(_s.cancel),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ class _ServerPageState extends State<ServerPage>
|
||||
Row(
|
||||
children: [
|
||||
_buildTopRightText(ss, cs),
|
||||
width7,
|
||||
width13,
|
||||
_buildSSHBtn(spi),
|
||||
_buildMoreBtn(spi),
|
||||
],
|
||||
@@ -240,17 +240,17 @@ class _ServerPageState extends State<ServerPage>
|
||||
ss.uptime,
|
||||
ss.failedInfo,
|
||||
);
|
||||
final hasError = cs == ServerState.failed && ss.failedInfo != null;
|
||||
return hasError
|
||||
? GestureDetector(
|
||||
if (cs == ServerState.failed && ss.failedInfo != null) {
|
||||
return GestureDetector(
|
||||
onTap: () => showRoundDialog(
|
||||
context: context,
|
||||
title: Text(_s.error),
|
||||
child: Text(ss.failedInfo ?? _s.unknownError),
|
||||
child: SingleChildScrollView(
|
||||
child: Text(ss.failedInfo!),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () =>
|
||||
copy2Clipboard(ss.failedInfo ?? _s.unknownError),
|
||||
onPressed: () => copy2Clipboard(ss.failedInfo!),
|
||||
child: Text(_s.copy),
|
||||
)
|
||||
],
|
||||
@@ -260,8 +260,9 @@ class _ServerPageState extends State<ServerPage>
|
||||
style: textSize12Grey,
|
||||
textScaleFactor: 1.0,
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
);
|
||||
}
|
||||
return Text(
|
||||
topRightStr,
|
||||
style: textSize12Grey,
|
||||
textScaleFactor: 1.0,
|
||||
@@ -281,6 +282,7 @@ class _ServerPageState extends State<ServerPage>
|
||||
Widget _buildMoreBtn(ServerPrivateInfo spi) {
|
||||
return PopupMenu(
|
||||
items: ServerTabMenuType.values.map((e) => e.build(_s)).toList(),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
onSelected: (ServerTabMenuType value) async {
|
||||
switch (value) {
|
||||
case ServerTabMenuType.pkg:
|
||||
|
||||
@@ -154,11 +154,11 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
),
|
||||
onLongPress: () {
|
||||
if (!isDir) return;
|
||||
showDirActionDialog(file);
|
||||
_showDirActionDialog(file);
|
||||
},
|
||||
onTap: () async {
|
||||
if (!isDir) {
|
||||
await showFileActionDialog(file);
|
||||
await _showFileActionDialog(file);
|
||||
return;
|
||||
}
|
||||
_path!.update(fileName);
|
||||
@@ -169,7 +169,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> showDirActionDialog(FileSystemEntity file) async {
|
||||
Future<void> _showDirActionDialog(FileSystemEntity file) async {
|
||||
showRoundDialog(
|
||||
context: context,
|
||||
child: Column(
|
||||
@@ -178,7 +178,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
ListTile(
|
||||
onTap: () {
|
||||
context.pop();
|
||||
showRenameDialog(file);
|
||||
_showRenameDialog(file);
|
||||
},
|
||||
title: Text(_s.rename),
|
||||
leading: const Icon(Icons.abc),
|
||||
@@ -186,7 +186,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
ListTile(
|
||||
onTap: () {
|
||||
context.pop();
|
||||
showDeleteDialog(file);
|
||||
_showDeleteDialog(file);
|
||||
},
|
||||
title: Text(_s.delete),
|
||||
leading: const Icon(Icons.delete),
|
||||
@@ -196,7 +196,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> showFileActionDialog(FileSystemEntity file) async {
|
||||
Future<void> _showFileActionDialog(FileSystemEntity file) async {
|
||||
final fileName = file.path.split('/').last;
|
||||
if (widget.isPickFile) {
|
||||
await showRoundDialog(
|
||||
@@ -252,7 +252,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
title: Text(_s.rename),
|
||||
onTap: () {
|
||||
context.pop();
|
||||
showRenameDialog(file);
|
||||
_showRenameDialog(file);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
@@ -260,7 +260,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
title: Text(_s.delete),
|
||||
onTap: () {
|
||||
context.pop();
|
||||
showDeleteDialog(file);
|
||||
_showDeleteDialog(file);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
@@ -319,7 +319,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
);
|
||||
}
|
||||
|
||||
void showRenameDialog(FileSystemEntity file) {
|
||||
void _showRenameDialog(FileSystemEntity file) {
|
||||
final fileName = file.path.split('/').last;
|
||||
showRoundDialog(
|
||||
context: context,
|
||||
@@ -342,7 +342,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
);
|
||||
}
|
||||
|
||||
void showDeleteDialog(FileSystemEntity file) {
|
||||
void _showDeleteDialog(FileSystemEntity file) {
|
||||
final fileName = file.path.split('/').last;
|
||||
showRoundDialog(
|
||||
context: context,
|
||||
|
||||
@@ -475,9 +475,9 @@
|
||||
baseConfigurationReference = C1C758C41C4E208965A68933 /* Pods-RunnerTests.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CURRENT_PROJECT_VERSION = 417;
|
||||
CURRENT_PROJECT_VERSION = 422;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0.417;
|
||||
MARKETING_VERSION = 1.0.422;
|
||||
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 = 417;
|
||||
CURRENT_PROJECT_VERSION = 422;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0.417;
|
||||
MARKETING_VERSION = 1.0.422;
|
||||
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 = 417;
|
||||
CURRENT_PROJECT_VERSION = 422;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0.417;
|
||||
MARKETING_VERSION = 1.0.422;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
|
||||
Reference in New Issue
Block a user