mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
fix: moveBg during share
This commit is contained in:
@@ -12,6 +12,8 @@ import 'package:toolbox/locator.dart';
|
||||
import '../../view/widget/rebuild.dart';
|
||||
import 'platform.dart';
|
||||
|
||||
final _app = locator<AppProvider>();
|
||||
|
||||
Future<bool> shareFiles(BuildContext context, List<String> filePaths) async {
|
||||
for (final filePath in filePaths) {
|
||||
if (!await File(filePath).exists()) {
|
||||
@@ -24,25 +26,21 @@ Future<bool> shareFiles(BuildContext context, List<String> filePaths) async {
|
||||
} else {
|
||||
text = '${filePaths.length} ${S.of(context)!.files}';
|
||||
}
|
||||
_app.setMoveBg(false);
|
||||
// ignore: deprecated_member_use
|
||||
await Share.shareFiles(filePaths, text: 'ServerBox -> $text');
|
||||
_app.setMoveBg(true);
|
||||
return filePaths.isNotEmpty;
|
||||
}
|
||||
|
||||
Future<bool> shareText(String text) async {
|
||||
final result = await Share.shareWithResult(text, subject: 'ServerBox backup');
|
||||
return result.status == ShareResultStatus.success;
|
||||
}
|
||||
|
||||
void copy(String text) {
|
||||
Clipboard.setData(ClipboardData(text: text));
|
||||
}
|
||||
|
||||
Future<String?> pickOneFile() async {
|
||||
final app = locator<AppProvider>();
|
||||
app.setMoveBg(false);
|
||||
_app.setMoveBg(false);
|
||||
final result = await FilePicker.platform.pickFiles(type: FileType.any);
|
||||
app.setMoveBg(true);
|
||||
_app.setMoveBg(true);
|
||||
return result?.files.single.path;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user