mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-18 15:54:35 +01:00
fix: windows bakup (#188)
This commit is contained in:
@@ -20,6 +20,7 @@ import 'package:toolbox/view/widget/expand_tile.dart';
|
||||
import 'package:toolbox/view/widget/cardx.dart';
|
||||
import 'package:toolbox/view/widget/store_switch.dart';
|
||||
import 'package:toolbox/view/widget/value_notifier.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../core/utils/misc.dart';
|
||||
import '../../data/res/ui.dart';
|
||||
@@ -63,10 +64,7 @@ class BackupPage extends StatelessWidget {
|
||||
l10n.backupTip,
|
||||
style: UIs.textGrey,
|
||||
),
|
||||
onTap: () async {
|
||||
await Backup.backup();
|
||||
await shareFiles([await Paths.bak]);
|
||||
},
|
||||
onTap: _onBackup,
|
||||
),
|
||||
ListTile(
|
||||
trailing: const Icon(Icons.restore),
|
||||
@@ -150,6 +148,21 @@ class BackupPage extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _onBackup() async {
|
||||
await Backup.backup();
|
||||
final path = await Paths.bak;
|
||||
|
||||
/// Issue #188
|
||||
if (isWindows) {
|
||||
await launchUrl(
|
||||
File(path).uri,
|
||||
mode: LaunchMode.externalNonBrowserApplication,
|
||||
);
|
||||
} else {
|
||||
await shareFiles([path]);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onRestore(BuildContext context) async {
|
||||
final path = await pickOneFile();
|
||||
if (path == null) return;
|
||||
|
||||
Reference in New Issue
Block a user