mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-27 14:59:29 +01:00
refactor: Migrate to share_plus
This commit is contained in:
parent
06a18b2e4e
commit
822b45d885
@ -7,7 +7,7 @@ import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||
import 'package:matrix/encryption.dart';
|
||||
import 'package:matrix/encryption/utils/bootstrap.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:share/share.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
|
||||
import 'package:fluffychat/config/themes.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:share/share.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
|
||||
|
@ -3,10 +3,9 @@ import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:file_picker_cross/file_picker_cross.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:share/share.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
|
||||
@ -23,17 +22,10 @@ extension MatrixFileExtension on MatrixFile {
|
||||
|
||||
void share(BuildContext context) async {
|
||||
final fileName = name.split('/').last;
|
||||
final tmpDirectory = PlatformInfos.isAndroid
|
||||
? (await getExternalStorageDirectories(
|
||||
type: StorageDirectory.downloads))!
|
||||
.first
|
||||
: await getTemporaryDirectory();
|
||||
final tmpDirectory = await getTemporaryDirectory();
|
||||
final path = '${tmpDirectory.path}$fileName';
|
||||
await File(path).writeAsBytes(bytes);
|
||||
await Share.shareFiles([path]);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(L10n.of(context)!.savedFileAs(path))),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1449,15 +1449,8 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.4.0"
|
||||
share:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: share
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.4"
|
||||
share_plus:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: share_plus
|
||||
url: "https://pub.dartlang.org"
|
||||
|
@ -75,7 +75,7 @@ dependencies:
|
||||
salomon_bottom_bar: ^3.2.0
|
||||
scroll_to_index: ^2.1.1
|
||||
sentry: ^6.3.0
|
||||
share: ^2.0.4
|
||||
share_plus: ^4.0.4
|
||||
shared_preferences: ^2.0.13
|
||||
slugify: ^2.0.0
|
||||
snapping_sheet: ^3.1.0
|
||||
|
Loading…
Reference in New Issue
Block a user