mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-29 17:52:35 +01:00
24 lines
614 B
Dart
24 lines
614 B
Dart
//@dart=2.12
|
|
|
|
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:fluffychat/utils/platform_infos.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),
|
|
);
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
SnackBar(content: Text(L10n.of(context)!.copiedToClipboard)));
|
|
return;
|
|
}
|
|
}
|