mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-01-31 21:34:45 +01:00
fix: Android moveBg during picking file
This commit is contained in:
@@ -6,6 +6,8 @@ import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:plain_notification_token/plain_notification_token.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
import 'package:toolbox/data/provider/app.dart';
|
||||
import 'package:toolbox/locator.dart';
|
||||
|
||||
import '../../view/widget/rebuild.dart';
|
||||
import 'platform.dart';
|
||||
@@ -32,7 +34,10 @@ void copy(String text) {
|
||||
}
|
||||
|
||||
Future<String?> pickOneFile() async {
|
||||
final app = locator<AppProvider>();
|
||||
app.setMoveBg(false);
|
||||
final result = await FilePicker.platform.pickFiles(type: FileType.any);
|
||||
app.setMoveBg(true);
|
||||
return result?.files.single.path;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,15 @@ class AppProvider extends BusyProvider {
|
||||
int? _newestBuild;
|
||||
int? get newestBuild => _newestBuild;
|
||||
|
||||
bool _moveBg = true;
|
||||
bool get moveBg => _moveBg;
|
||||
|
||||
void setNewestBuild(int build) {
|
||||
_newestBuild = build;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void setMoveBg(bool moveBg) {
|
||||
_moveBg = moveBg;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 254;
|
||||
static const int build = 255;
|
||||
static const String engine = "Flutter 3.7.7 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 2ad6cd72c0 (4 weeks ago) • 2023-03-08 09:41:59 -0800\nEngine • revision 1837b5be5f\nTools • Dart 2.19.4 • DevTools 2.20.1\n";
|
||||
static const String buildAt = "2023-04-05 15:01:13.115057";
|
||||
static const int modifications = 3;
|
||||
static const String buildAt = "2023-04-05 15:03:38.565037";
|
||||
static const int modifications = 2;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ 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/data/provider/app.dart';
|
||||
import 'package:toolbox/data/res/misc.dart';
|
||||
|
||||
import '../../core/analysis.dart';
|
||||
@@ -87,9 +88,11 @@ class _MyHomePageState extends State<MyHomePage>
|
||||
}
|
||||
break;
|
||||
case AppLifecycleState.paused:
|
||||
// Keep running in background on Android device
|
||||
if (isAndroid && _setting.bgRun.fetch()!) {
|
||||
// Keep running in background on Android device
|
||||
bgRunChannel.invokeMethod('sendToBackground');
|
||||
if (locator<AppProvider>().moveBg) {
|
||||
bgRunChannel.invokeMethod('sendToBackground');
|
||||
}
|
||||
} else {
|
||||
_serverProvider.setDisconnected();
|
||||
_serverProvider.stopAutoRefresh();
|
||||
|
||||
Reference in New Issue
Block a user