mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
new: import local file & rm local dir
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 = 414;
|
||||
CURRENT_PROJECT_VERSION = 416;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||
@@ -478,7 +478,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.414;
|
||||
MARKETING_VERSION = 1.0.416;
|
||||
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 = 414;
|
||||
CURRENT_PROJECT_VERSION = 416;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||
@@ -610,7 +610,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.414;
|
||||
MARKETING_VERSION = 1.0.416;
|
||||
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 = 414;
|
||||
CURRENT_PROJECT_VERSION = 416;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||
@@ -636,7 +636,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.414;
|
||||
MARKETING_VERSION = 1.0.416;
|
||||
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 = 414;
|
||||
CURRENT_PROJECT_VERSION = 416;
|
||||
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.414;
|
||||
MARKETING_VERSION = 1.0.416;
|
||||
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 = 414;
|
||||
CURRENT_PROJECT_VERSION = 416;
|
||||
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.414;
|
||||
MARKETING_VERSION = 1.0.416;
|
||||
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 = 414;
|
||||
CURRENT_PROJECT_VERSION = 416;
|
||||
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.414;
|
||||
MARKETING_VERSION = 1.0.416;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
||||
@@ -38,6 +38,9 @@ enum DockerErrType {
|
||||
invalidVersion,
|
||||
cmdNoPrefix,
|
||||
segmentsNotMatch,
|
||||
parsePsItem,
|
||||
parseImages,
|
||||
parseStats,
|
||||
}
|
||||
|
||||
class DockerErr extends Err<DockerErrType> {
|
||||
|
||||
@@ -80,7 +80,10 @@ class DockerProvider extends BusyProvider {
|
||||
version = _versionReg.firstMatch(verRaw)?.group(2);
|
||||
edition = _editionReg.firstMatch(verRaw)?.group(2);
|
||||
} catch (e) {
|
||||
error = DockerErr(type: DockerErrType.unknown, message: e.toString());
|
||||
error = DockerErr(
|
||||
type: DockerErrType.invalidVersion,
|
||||
message: '$verRaw\n\n$e',
|
||||
);
|
||||
rethrow;
|
||||
}
|
||||
|
||||
@@ -92,7 +95,10 @@ class DockerProvider extends BusyProvider {
|
||||
lines.removeAt(0);
|
||||
items = lines.map((e) => DockerPsItem.fromRawString(e)).toList();
|
||||
} catch (e) {
|
||||
error = DockerErr(type: DockerErrType.unknown, message: e.toString());
|
||||
error = DockerErr(
|
||||
type: DockerErrType.parsePsItem,
|
||||
message: '$psRaw\n\n$e',
|
||||
);
|
||||
rethrow;
|
||||
} finally {
|
||||
setBusyState(false);
|
||||
@@ -106,7 +112,10 @@ class DockerProvider extends BusyProvider {
|
||||
imageLines.removeAt(0);
|
||||
images = imageLines.map((e) => DockerImage.fromRawStr(e)).toList();
|
||||
} catch (e) {
|
||||
error = DockerErr(type: DockerErrType.unknown, message: e.toString());
|
||||
error = DockerErr(
|
||||
type: DockerErrType.parseImages,
|
||||
message: '$imageRaw\n\n$e',
|
||||
);
|
||||
rethrow;
|
||||
} finally {
|
||||
setBusyState(false);
|
||||
@@ -127,7 +136,10 @@ class DockerProvider extends BusyProvider {
|
||||
item.parseStats(statsLine);
|
||||
}
|
||||
} catch (e) {
|
||||
error = DockerErr(type: DockerErrType.unknown, message: e.toString());
|
||||
error = DockerErr(
|
||||
type: DockerErrType.parseStats,
|
||||
message: '$statsRaw\n\n$e',
|
||||
);
|
||||
} finally {
|
||||
setBusyState(false);
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 414;
|
||||
static const int build = 416;
|
||||
static const String engine = "3.10.6";
|
||||
static const String buildAt = "2023-08-05 12:11:05.935203";
|
||||
static const int modifications = 5;
|
||||
static const String buildAt = "2023-08-05 12:53:08.311867";
|
||||
static const int modifications = 6;
|
||||
}
|
||||
|
||||
@@ -79,8 +79,16 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
key: UniqueKey(),
|
||||
child: _buildBody(),
|
||||
),
|
||||
bottomNavigationBar: SafeArea(
|
||||
child: _buildPath(),
|
||||
bottomNavigationBar: SafeArea(child: _buildPath()),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () async {
|
||||
final path = await pickOneFile();
|
||||
if (path == null) return;
|
||||
final name = getFileName(path) ?? 'imported';
|
||||
await File(path).copy(pathJoin(_path!.path, name));
|
||||
setState(() {});
|
||||
},
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -107,6 +115,11 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
final dir = Directory(_path!.path);
|
||||
final files = dir.listSync();
|
||||
final canGoBack = _path!.canBack;
|
||||
if (files.isEmpty) {
|
||||
return const Center(
|
||||
child: Text('~'),
|
||||
);
|
||||
}
|
||||
return ListView.builder(
|
||||
itemCount: canGoBack ? files.length + 1 : files.length,
|
||||
padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 7),
|
||||
@@ -139,6 +152,10 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
.substring(0, stat.modified.toString().length - 4),
|
||||
style: grey,
|
||||
),
|
||||
onLongPress: () {
|
||||
if (!isDir) return;
|
||||
showDirActionDialog(file);
|
||||
},
|
||||
onTap: () async {
|
||||
if (!isDir) {
|
||||
await showFileActionDialog(file);
|
||||
@@ -152,6 +169,33 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> showDirActionDialog(FileSystemEntity file) async {
|
||||
showRoundDialog(
|
||||
context: context,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ListTile(
|
||||
onTap: () {
|
||||
context.pop();
|
||||
showRenameDialog(file);
|
||||
},
|
||||
title: Text(_s.rename),
|
||||
leading: const Icon(Icons.abc),
|
||||
),
|
||||
ListTile(
|
||||
onTap: () {
|
||||
context.pop();
|
||||
showDeleteDialog(file);
|
||||
},
|
||||
title: Text(_s.delete),
|
||||
leading: const Icon(Icons.delete),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> showFileActionDialog(FileSystemEntity file) async {
|
||||
final fileName = file.path.split('/').last;
|
||||
if (widget.isPickFile) {
|
||||
@@ -189,13 +233,13 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
);
|
||||
return;
|
||||
}
|
||||
final f = File(file.absolute.path);
|
||||
final result = await AppRoute(
|
||||
EditorPage(
|
||||
path: file.absolute.path,
|
||||
),
|
||||
'sftp dled editor',
|
||||
).go<String>(context);
|
||||
final f = File(file.absolute.path);
|
||||
if (result != null) {
|
||||
f.writeAsString(result);
|
||||
showSnackBar(context, Text(_s.saved));
|
||||
@@ -208,19 +252,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
title: Text(_s.rename),
|
||||
onTap: () {
|
||||
context.pop();
|
||||
showRoundDialog(
|
||||
context: context,
|
||||
title: Text(_s.rename),
|
||||
child: Input(
|
||||
controller: TextEditingController(text: fileName),
|
||||
onSubmitted: (p0) {
|
||||
context.pop();
|
||||
final newPath = '${file.parent.path}/$p0';
|
||||
file.renameSync(newPath);
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
);
|
||||
showRenameDialog(file);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
@@ -228,25 +260,7 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
title: Text(_s.delete),
|
||||
onTap: () {
|
||||
context.pop();
|
||||
showRoundDialog(
|
||||
context: context,
|
||||
title: Text(_s.delete),
|
||||
child: Text(_s.sureDelete(fileName)),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => context.pop(),
|
||||
child: Text(_s.cancel),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
file.deleteSync();
|
||||
setState(() {});
|
||||
context.pop();
|
||||
},
|
||||
child: Text(_s.ok),
|
||||
),
|
||||
],
|
||||
);
|
||||
showDeleteDialog(file);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
@@ -304,4 +318,55 @@ class _LocalStoragePageState extends State<LocalStoragePage> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void showRenameDialog(FileSystemEntity file) {
|
||||
final fileName = file.path.split('/').last;
|
||||
showRoundDialog(
|
||||
context: context,
|
||||
title: Text(_s.rename),
|
||||
child: Input(
|
||||
controller: TextEditingController(text: fileName),
|
||||
onSubmitted: (p0) {
|
||||
context.pop();
|
||||
final newPath = '${file.parent.path}/$p0';
|
||||
try {
|
||||
file.renameSync(newPath);
|
||||
} catch (e) {
|
||||
showSnackBar(context, Text('${_s.failed}:\n$e'));
|
||||
return;
|
||||
}
|
||||
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void showDeleteDialog(FileSystemEntity file) {
|
||||
final fileName = file.path.split('/').last;
|
||||
showRoundDialog(
|
||||
context: context,
|
||||
title: Text(_s.delete),
|
||||
child: Text(_s.sureDelete(fileName)),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => context.pop(),
|
||||
child: Text(_s.cancel),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
try {
|
||||
file.deleteSync(recursive: true);
|
||||
} catch (e) {
|
||||
showSnackBar(context, Text('${_s.failed}:\n$e'));
|
||||
return;
|
||||
}
|
||||
setState(() {});
|
||||
},
|
||||
child: Text(_s.ok),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -475,9 +475,9 @@
|
||||
baseConfigurationReference = C1C758C41C4E208965A68933 /* Pods-RunnerTests.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CURRENT_PROJECT_VERSION = 414;
|
||||
CURRENT_PROJECT_VERSION = 416;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0.414;
|
||||
MARKETING_VERSION = 1.0.416;
|
||||
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 = 414;
|
||||
CURRENT_PROJECT_VERSION = 416;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0.414;
|
||||
MARKETING_VERSION = 1.0.416;
|
||||
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 = 414;
|
||||
CURRENT_PROJECT_VERSION = 416;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0.414;
|
||||
MARKETING_VERSION = 1.0.416;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
|
||||
Reference in New Issue
Block a user