2020-11-14 08:54:26 +01:00
|
|
|
import 'package:flushbar/flushbar_helper.dart';
|
2020-10-28 07:23:50 +01:00
|
|
|
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),
|
|
|
|
);
|
2020-11-14 08:54:26 +01:00
|
|
|
await FlushbarHelper.createSuccess(
|
|
|
|
message: L10n.of(context).copiedToClipboard)
|
|
|
|
.show(context);
|
2020-10-28 07:23:50 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|