mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-24 04:59:26 +01:00
21 lines
663 B
Dart
21 lines
663 B
Dart
import 'package:adaptive_page_layout/adaptive_page_layout.dart';
|
|
import 'package:fluffychat/utils/platform_infos.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:share/share.dart';
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
|
|
abstract class FluffyShare {
|
|
static Future<void> share(String text, BuildContext context) async {
|
|
if (PlatformInfos.isMobile) {
|
|
return Share.share(text);
|
|
}
|
|
await Clipboard.setData(
|
|
ClipboardData(text: text),
|
|
);
|
|
AdaptivePageLayout.of(context).showSnackBar(
|
|
SnackBar(content: Text(L10n.of(context).copiedToClipboard)));
|
|
return;
|
|
}
|
|
}
|