mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-01-31 21:34:45 +01:00
fix: import backup
This commit is contained in:
@@ -4,4 +4,6 @@ extension ContextX on BuildContext {
|
||||
void pop<T extends Object?>([T? result]) {
|
||||
Navigator.of(this).pop<T>(result);
|
||||
}
|
||||
|
||||
bool get canPop => Navigator.of(this).canPop();
|
||||
}
|
||||
|
||||
@@ -26,10 +26,10 @@ Future<bool> shareFiles(BuildContext context, List<String> filePaths) async {
|
||||
} else {
|
||||
text = '${filePaths.length} ${S.of(context)!.files}';
|
||||
}
|
||||
_app.setCanMoveBg(false);
|
||||
_app.moveBg = false;
|
||||
// ignore: deprecated_member_use
|
||||
await Share.shareFiles(filePaths, subject: 'ServerBox -> $text');
|
||||
_app.setCanMoveBg(true);
|
||||
_app.moveBg = true;
|
||||
return filePaths.isNotEmpty;
|
||||
}
|
||||
|
||||
@@ -38,9 +38,9 @@ void copy2Clipboard(String text) {
|
||||
}
|
||||
|
||||
Future<String?> pickOneFile() async {
|
||||
_app.setCanMoveBg(false);
|
||||
_app.moveBg = false;
|
||||
final result = await FilePicker.platform.pickFiles(type: FileType.any);
|
||||
_app.setCanMoveBg(true);
|
||||
_app.moveBg = true;
|
||||
return result?.files.single.path;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,13 +39,13 @@ class ServerPrivateInfo {
|
||||
ServerPrivateInfo.fromJson(Map<String, dynamic> json) {
|
||||
name = json["name"].toString();
|
||||
ip = json["ip"].toString();
|
||||
port = int.tryParse(json["port"]) ?? 22;
|
||||
port = json["port"] ?? 22;
|
||||
user = json["user"].toString();
|
||||
pwd = json["authorization"].toString();
|
||||
pubKeyId = json["pubKeyId"]?.toString();
|
||||
id = '$user@$ip:$port';
|
||||
tags = json["tags"]?.cast<String>();
|
||||
alterUrl = json["alterHost"]?.toString();
|
||||
alterUrl = json["alterUrl"]?.toString();
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
@@ -57,7 +57,7 @@ class ServerPrivateInfo {
|
||||
data["authorization"] = pwd;
|
||||
data["pubKeyId"] = pubKeyId;
|
||||
data["tags"] = tags;
|
||||
data["alterHost"] = alterUrl;
|
||||
data["alterUrl"] = alterUrl;
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,15 +4,10 @@ class AppProvider extends BusyProvider {
|
||||
int? _newestBuild;
|
||||
int? get newestBuild => _newestBuild;
|
||||
|
||||
bool _moveBg = true;
|
||||
bool get moveBg => _moveBg;
|
||||
bool moveBg = true;
|
||||
|
||||
void setNewestBuild(int build) {
|
||||
_newestBuild = build;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void setCanMoveBg(bool moveBg) {
|
||||
_moveBg = moveBg;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 397;
|
||||
static const int build = 400;
|
||||
static const String engine = "3.10.6";
|
||||
static const String buildAt = "2023-07-28 20:51:35.807892";
|
||||
static const int modifications = 6;
|
||||
static const String buildAt = "2023-07-31 14:06:15.008140";
|
||||
static const int modifications = 9;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ class _HomePageState extends State<HomePage>
|
||||
WidgetsBindingObserver {
|
||||
final _serverProvider = locator<ServerProvider>();
|
||||
final _setting = locator<SettingStore>();
|
||||
final _app = locator<AppProvider>();
|
||||
|
||||
late final PageController _pageController;
|
||||
|
||||
@@ -90,7 +91,7 @@ class _HomePageState extends State<HomePage>
|
||||
case AppLifecycleState.paused:
|
||||
// Keep running in background on Android device
|
||||
if (isAndroid && _setting.bgRun.fetch()!) {
|
||||
if (locator<AppProvider>().moveBg) {
|
||||
if (_app.moveBg) {
|
||||
bgRunChannel.invokeMethod('sendToBackground');
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -290,11 +290,11 @@ class _SftpPageState extends State<SftpPage> {
|
||||
title: Text(file.filename),
|
||||
trailing: trailing,
|
||||
subtitle: isDir
|
||||
? null
|
||||
: Text(
|
||||
(file.attr.size ?? 0).convertBytes,
|
||||
style: grey,
|
||||
),
|
||||
? null
|
||||
: Text(
|
||||
(file.attr.size ?? 0).convertBytes,
|
||||
style: grey,
|
||||
),
|
||||
onTap: () {
|
||||
if (isDir) {
|
||||
_status.path?.update(file.filename);
|
||||
|
||||
Reference in New Issue
Block a user