fix: Sharing on iOS and iPad
This commit is contained in:
parent
020701b42a
commit
1c7b6a4953
5 changed files with 18 additions and 5 deletions
|
|
@ -121,7 +121,12 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
|
|||
icon: const Icon(Icons.save_alt_outlined),
|
||||
label: Text(L10n.of(context)!.saveTheSecurityKeyNow),
|
||||
onPressed: () {
|
||||
Share.share(key!);
|
||||
final box = context.findRenderObject() as RenderBox;
|
||||
Share.share(
|
||||
key!,
|
||||
sharePositionOrigin:
|
||||
box.localToGlobal(Offset.zero) & box.size,
|
||||
);
|
||||
setState(() => _recoveryKeyCopied = true);
|
||||
},
|
||||
),
|
||||
|
|
|
|||
|
|
@ -9,7 +9,11 @@ import 'package:fluffychat/utils/platform_infos.dart';
|
|||
abstract class FluffyShare {
|
||||
static Future<void> share(String text, BuildContext context) async {
|
||||
if (PlatformInfos.isMobile) {
|
||||
return Share.share(text);
|
||||
final box = context.findRenderObject() as RenderBox;
|
||||
return Share.share(
|
||||
text,
|
||||
sharePositionOrigin: box.localToGlobal(Offset.zero) & box.size,
|
||||
);
|
||||
}
|
||||
await Clipboard.setData(
|
||||
ClipboardData(text: text),
|
||||
|
|
|
|||
|
|
@ -25,7 +25,11 @@ extension MatrixFileExtension on MatrixFile {
|
|||
final tmpDirectory = await getTemporaryDirectory();
|
||||
final path = '${tmpDirectory.path}$fileName';
|
||||
await File(path).writeAsBytes(bytes);
|
||||
await Share.shareFiles([path]);
|
||||
final box = context.findRenderObject() as RenderBox;
|
||||
await Share.shareFiles(
|
||||
[path],
|
||||
sharePositionOrigin: box.localToGlobal(Offset.zero) & box.size,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue