Merge branch 'master' into feature/own-lint-rules
This commit is contained in:
commit
fc555a005c
|
@ -1,9 +1,14 @@
|
|||
## Unreleased
|
||||
|
||||
### Added
|
||||
|
||||
- Share buttons on windows/linux now copy the data to the clipboard
|
||||
|
||||
### Fixed
|
||||
|
||||
- Quote blocks in posts and comments are now much prettier
|
||||
- Code blocks nwo have monospace font. As they should
|
||||
- Switching accounts in the profile tab now correctly reacts to the change
|
||||
|
||||
## v0.3.0 - 2021-02-25
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:esys_flutter_share/esys_flutter_share.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
|
@ -16,6 +15,7 @@ import '../util/extensions/spaced.dart';
|
|||
import '../util/goto.dart';
|
||||
import '../util/intl.dart';
|
||||
import '../util/more_icon.dart';
|
||||
import '../util/share.dart';
|
||||
import '../widgets/avatar.dart';
|
||||
import '../widgets/bottom_modal.dart';
|
||||
import '../widgets/fullscreenable_image.dart';
|
||||
|
@ -108,8 +108,7 @@ class CommunityPage extends HookWidget {
|
|||
}
|
||||
|
||||
// FUNCTIONS
|
||||
void _share() =>
|
||||
Share.text('Share instance', community.community.actorId, 'text/plain');
|
||||
void _share() => share(community.community.actorId, context: context);
|
||||
|
||||
void _openMoreMenu() {
|
||||
showBottomModal(
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:esys_flutter_share/esys_flutter_share.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
@ -10,6 +9,7 @@ import '../hooks/refreshable.dart';
|
|||
import '../hooks/stores.dart';
|
||||
import '../util/extensions/api.dart';
|
||||
import '../util/more_icon.dart';
|
||||
import '../util/share.dart';
|
||||
import '../widgets/comment_section.dart';
|
||||
import '../widgets/post.dart';
|
||||
import '../widgets/reveal_after_scroll.dart';
|
||||
|
@ -84,7 +84,7 @@ class FullPostPage extends HookWidget {
|
|||
}
|
||||
}
|
||||
|
||||
sharePost() => Share.text('Share post', post.post.apId, 'text/plain');
|
||||
sharePost() => share(post.post.apId, context: context);
|
||||
|
||||
comment() async {
|
||||
final newComment = await showCupertinoModalPopup<CommentView>(
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:esys_flutter_share/esys_flutter_share.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
|
@ -12,6 +11,7 @@ import '../util/extensions/api.dart';
|
|||
import '../util/extensions/spaced.dart';
|
||||
import '../util/goto.dart';
|
||||
import '../util/more_icon.dart';
|
||||
import '../util/share.dart';
|
||||
import '../util/text_color.dart';
|
||||
import '../widgets/avatar.dart';
|
||||
import '../widgets/bottom_modal.dart';
|
||||
|
@ -30,9 +30,6 @@ class InstancePage extends HookWidget {
|
|||
final Future<FullSiteView> siteFuture;
|
||||
final Future<List<CommunityView>> communitiesFuture;
|
||||
|
||||
void _share() =>
|
||||
Share.text('Share instance', 'https://$instanceHost', 'text/plain');
|
||||
|
||||
InstancePage({@required this.instanceHost})
|
||||
: assert(instanceHost != null),
|
||||
siteFuture = LemmyApiV2(instanceHost).run(const GetSite()),
|
||||
|
@ -70,6 +67,8 @@ class InstancePage extends HookWidget {
|
|||
|
||||
final site = siteSnap.data;
|
||||
|
||||
void _share() => share('https://$instanceHost', context: context);
|
||||
|
||||
void _openMoreMenu(BuildContext c) {
|
||||
showBottomModal(
|
||||
context: context,
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import 'dart:math' show max, min;
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:esys_flutter_share/esys_flutter_share.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:matrix4_transform/matrix4_transform.dart';
|
||||
import 'package:photo_view/photo_view.dart';
|
||||
|
||||
import '../util/share.dart';
|
||||
import '../widgets/bottom_modal.dart';
|
||||
|
||||
/// View to interact with a media object. Zoom in/out, download, share, etc.
|
||||
|
@ -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.text('Share image url', url, 'text/plain');
|
||||
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),
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import 'package:esys_flutter_share/esys_flutter_share.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:lemmy_api_client/v2.dart';
|
||||
|
||||
import '../hooks/logged_in_action.dart';
|
||||
import '../util/share.dart';
|
||||
import '../widgets/user_profile.dart';
|
||||
import 'write_message.dart';
|
||||
|
||||
|
@ -49,8 +49,10 @@ class UserPage extends HookWidget {
|
|||
SendMessageButton(userDetailsSnap.data.userView.user),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.share),
|
||||
onPressed: () => Share.text('Share user',
|
||||
userDetailsSnap.data.userView.user.actorId, 'text/plain'),
|
||||
onPressed: () => share(
|
||||
userDetailsSnap.data.userView.user.actorId,
|
||||
context: context,
|
||||
),
|
||||
),
|
||||
]
|
||||
],
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
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
|
||||
Future<void> share(
|
||||
String text, {
|
||||
String subject,
|
||||
Rect sharePositionOrigin,
|
||||
@required BuildContext context,
|
||||
}) async {
|
||||
assert(context != null);
|
||||
|
||||
try {
|
||||
return await Share.share(
|
||||
text,
|
||||
subject: subject,
|
||||
sharePositionOrigin: sharePositionOrigin,
|
||||
);
|
||||
} on MissingPluginException {
|
||||
await Clipboard.setData(ClipboardData(text: text));
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Copied data to clipboard!')),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:esys_flutter_share/esys_flutter_share.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
@ -16,6 +15,7 @@ import '../util/extensions/api.dart';
|
|||
import '../util/extensions/datetime.dart';
|
||||
import '../util/goto.dart';
|
||||
import '../util/intl.dart';
|
||||
import '../util/share.dart';
|
||||
import '../util/text_color.dart';
|
||||
import 'avatar.dart';
|
||||
import 'bottom_modal.dart';
|
||||
|
@ -149,14 +149,12 @@ class CommentWidget extends HookWidget {
|
|||
ListTile(
|
||||
leading: const Icon(Icons.share),
|
||||
title: const Text('Share url'),
|
||||
onTap: () => Share.text(
|
||||
'Share comment url', com.comment.link, 'text/plain'),
|
||||
onTap: () => share(com.comment.link, context: context),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.share),
|
||||
title: const Text('Share text'),
|
||||
onTap: () => Share.text(
|
||||
'Share comment text', com.comment.content, 'text/plain'),
|
||||
onTap: () => share(com.comment.content, context: context),
|
||||
),
|
||||
ListTile(
|
||||
leading:
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:esys_flutter_share/esys_flutter_share.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -18,6 +17,7 @@ import '../util/extensions/api.dart';
|
|||
import '../util/extensions/datetime.dart';
|
||||
import '../util/goto.dart';
|
||||
import '../util/more_icon.dart';
|
||||
import '../util/share.dart';
|
||||
import 'avatar.dart';
|
||||
import 'bottom_modal.dart';
|
||||
import 'fullscreenable_image.dart';
|
||||
|
@ -384,9 +384,8 @@ class PostWidget extends HookWidget {
|
|||
if (!fullPost)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.share),
|
||||
onPressed: () => Share.text(
|
||||
'Share post url', post.post.apId, 'text/plain'),
|
||||
), // TODO: find a way to mark it as url
|
||||
onPressed: () => share(post.post.apId, context: context),
|
||||
),
|
||||
if (!fullPost) SavePostButton(post),
|
||||
_Voting(post),
|
||||
],
|
||||
|
|
|
@ -47,7 +47,7 @@ class UserProfile extends HookWidget {
|
|||
sort: SortType.active,
|
||||
auth: accountsStore.defaultTokenFor(instanceHost)?.raw,
|
||||
));
|
||||
});
|
||||
}, [userId, instanceHost]);
|
||||
|
||||
if (!userDetailsSnap.hasData) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
|
|
16
pubspec.lock
16
pubspec.lock
|
@ -183,13 +183,6 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.12"
|
||||
esys_flutter_share:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: esys_flutter_share
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -623,6 +616,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.25.0"
|
||||
share:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: share
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
shared_preferences:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -881,5 +881,5 @@ packages:
|
|||
source: hosted
|
||||
version: "2.2.1"
|
||||
sdks:
|
||||
dart: ">=2.12.0-0.0 <3.0.0"
|
||||
dart: ">=2.12.0-259.9.beta <3.0.0"
|
||||
flutter: ">=1.22.2"
|
||||
|
|
|
@ -31,7 +31,7 @@ dependencies:
|
|||
modal_bottom_sheet: ^1.0.0+1
|
||||
|
||||
# native
|
||||
esys_flutter_share: ^1.0.2
|
||||
share: ^2.0.1
|
||||
url_launcher: ^5.5.1
|
||||
shared_preferences: ">=0.5.0 <2.0.0"
|
||||
package_info: ^0.4.3
|
||||
|
|
Loading…
Reference in New Issue