Remove class acting as a namespace
This commit is contained in:
parent
5db7a8e509
commit
048e347e43
|
@ -108,7 +108,7 @@ class CommunityPage extends HookWidget {
|
|||
}
|
||||
|
||||
// FUNCTIONS
|
||||
void _share() => Share.share(community.community.actorId, context: context);
|
||||
void _share() => share(community.community.actorId, context: context);
|
||||
|
||||
void _openMoreMenu() {
|
||||
showBottomModal(
|
||||
|
|
|
@ -84,7 +84,7 @@ class FullPostPage extends HookWidget {
|
|||
}
|
||||
}
|
||||
|
||||
sharePost() => Share.share(post.post.apId, context: context);
|
||||
sharePost() => share(post.post.apId, context: context);
|
||||
|
||||
comment() async {
|
||||
final newComment = await showCupertinoModalPopup<CommentView>(
|
||||
|
|
|
@ -67,7 +67,7 @@ class InstancePage extends HookWidget {
|
|||
|
||||
final site = siteSnap.data;
|
||||
|
||||
void _share() => Share.share('https://$instanceHost', context: context);
|
||||
void _share() => share('https://$instanceHost', context: context);
|
||||
|
||||
void _openMoreMenu(BuildContext c) {
|
||||
showBottomModal(
|
||||
|
|
|
@ -35,7 +35,7 @@ class MediaViewPage extends HookWidget {
|
|||
|
||||
// TODO: hide navbar and topbar on android without a content jump
|
||||
|
||||
share() {
|
||||
sharePhoto() {
|
||||
showBottomModal(
|
||||
context: context,
|
||||
builder: (context) => Column(
|
||||
|
@ -45,7 +45,7 @@ class MediaViewPage extends HookWidget {
|
|||
title: const Text('Share link'),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
Share.share(url, context: context);
|
||||
share(url, context: context);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
|
@ -77,7 +77,7 @@ class MediaViewPage extends HookWidget {
|
|||
IconButton(
|
||||
icon: const Icon(Icons.share),
|
||||
tooltip: 'share',
|
||||
onPressed: share,
|
||||
onPressed: sharePhoto,
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.file_download),
|
||||
|
|
|
@ -49,7 +49,7 @@ class UserPage extends HookWidget {
|
|||
SendMessageButton(userDetailsSnap.data.userView.user),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.share),
|
||||
onPressed: () => Share.share(
|
||||
onPressed: () => share(
|
||||
userDetailsSnap.data.userView.user.actorId,
|
||||
context: context,
|
||||
),
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:share/share.dart' as flutter_share;
|
||||
import 'package:share/share.dart';
|
||||
|
||||
/// A `package:share` wrapper that fallbacks to copying contents to the clipboard
|
||||
/// on platforms that do not support native sharing
|
||||
abstract class Share {
|
||||
static Future<void> share(
|
||||
Future<void> share(
|
||||
String text, {
|
||||
String subject,
|
||||
Rect sharePositionOrigin,
|
||||
@required BuildContext context,
|
||||
}) async {
|
||||
}) async {
|
||||
assert(context != null);
|
||||
|
||||
try {
|
||||
return await flutter_share.Share.share(
|
||||
return await Share.share(
|
||||
text,
|
||||
subject: subject,
|
||||
sharePositionOrigin: sharePositionOrigin,
|
||||
|
@ -25,5 +24,4 @@ abstract class Share {
|
|||
const SnackBar(content: Text('Copied data to clipboard!')),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -149,12 +149,12 @@ class CommentWidget extends HookWidget {
|
|||
ListTile(
|
||||
leading: const Icon(Icons.share),
|
||||
title: const Text('Share url'),
|
||||
onTap: () => Share.share(com.comment.link, context: context),
|
||||
onTap: () => share(com.comment.link, context: context),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.share),
|
||||
title: const Text('Share text'),
|
||||
onTap: () => Share.share(com.comment.content, context: context),
|
||||
onTap: () => share(com.comment.content, context: context),
|
||||
),
|
||||
ListTile(
|
||||
leading:
|
||||
|
|
|
@ -384,8 +384,7 @@ class PostWidget extends HookWidget {
|
|||
if (!fullPost)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.share),
|
||||
onPressed: () =>
|
||||
Share.share(post.post.apId, context: context),
|
||||
onPressed: () => share(post.post.apId, context: context),
|
||||
),
|
||||
if (!fullPost) SavePostButton(post),
|
||||
_Voting(post),
|
||||
|
|
Loading…
Reference in New Issue