✨ Share
This commit is contained in:
@ -6,6 +6,7 @@ import 'package:solian/providers/content/channel.dart';
|
||||
import 'package:solian/providers/relation.dart';
|
||||
import 'package:solian/providers/websocket.dart';
|
||||
import 'package:solian/services.dart';
|
||||
import 'package:solian/widgets/sized_container.dart';
|
||||
|
||||
class BootstrapperShell extends StatefulWidget {
|
||||
final Widget child;
|
||||
@ -129,12 +130,16 @@ class _BootstrapperShellState extends State<BootstrapperShell> {
|
||||
child: CircularProgressIndicator(strokeWidth: 3),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
_subtitle ??
|
||||
'${_periods[_periodCursor].label.tr} (${_periodCursor + 1}/${_periods.length})',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: _unFocusColor,
|
||||
CenteredContainer(
|
||||
maxWidth: 280,
|
||||
child: Text(
|
||||
_subtitle ??
|
||||
'${_periods[_periodCursor].label.tr} (${_periodCursor + 1}/${_periods.length})',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: _unFocusColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -10,6 +10,7 @@ const messagesEnglish = {
|
||||
'draft': 'Draft',
|
||||
'draftSave': 'Save',
|
||||
'draftBox': 'Draft Box',
|
||||
'share': 'Share',
|
||||
'feed': 'Feed',
|
||||
'feedSearch': 'Search Feed',
|
||||
'feedSearchWithTag': 'Searching with tag #@key',
|
||||
@ -282,4 +283,6 @@ const messagesEnglish = {
|
||||
'bsEstablishingConn': 'Establishing Connection',
|
||||
'bsPreparingData': 'Preparing User Data',
|
||||
'bsRegisteringPushNotify': 'Enabling Push Notifications',
|
||||
'postShareContent': '@content\n\n@username on the Solar Network\nCheck it out: @link',
|
||||
'postShareSubject': '@username posted a post on the Solar Network',
|
||||
};
|
||||
|
@ -17,6 +17,7 @@ const simplifiedChineseMessages = {
|
||||
'draft': '草稿',
|
||||
'draftSave': '存为草稿',
|
||||
'draftBox': '草稿箱',
|
||||
'share': '分享',
|
||||
'feed': '资讯',
|
||||
'feedSearch': '搜索资讯',
|
||||
'feedSearchWithTag': '检索带有 #@key 标签的资讯',
|
||||
@ -261,4 +262,6 @@ const simplifiedChineseMessages = {
|
||||
'bsEstablishingConn': '部署连接中',
|
||||
'bsPreparingData': '正在准备用户资料',
|
||||
'bsRegisteringPushNotify': '正在启用推送通知',
|
||||
'postShareContent': '@content\n\n@username 在 Solar Network\n原帖地址:@link',
|
||||
'postShareSubject': '@username 在 Solar Network 上发布了一篇帖子',
|
||||
};
|
||||
|
@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_animate/flutter_animate.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
import 'package:solian/exts.dart';
|
||||
import 'package:solian/models/post.dart';
|
||||
import 'package:solian/providers/auth.dart';
|
||||
@ -66,6 +67,25 @@ class _PostActionState extends State<PostAction> {
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: [
|
||||
ListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
leading: const Icon(Icons.share),
|
||||
title: Text('share'.tr),
|
||||
onTap: () async {
|
||||
await Share.share(
|
||||
'postShareContent'.trParams({
|
||||
'username': widget.item.author.nick,
|
||||
'content': widget.item.body['text'],
|
||||
'link':
|
||||
'https://sn.solsynth.dev/posts/${widget.item.id}',
|
||||
}),
|
||||
subject: 'postShareSubject'.trParams({
|
||||
'username': widget.item.author.nick,
|
||||
}),
|
||||
);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
if (!widget.noReact)
|
||||
ListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
@ -109,7 +129,8 @@ class _PostActionState extends State<PostAction> {
|
||||
: 'unpinPost'.tr,
|
||||
),
|
||||
onTap: () async {
|
||||
final client = Get.find<AuthProvider>().configureClient('interactive');
|
||||
final client = Get.find<AuthProvider>()
|
||||
.configureClient('interactive');
|
||||
await client.post('/posts/${widget.item.id}/pin', {});
|
||||
Navigator.pop(context, true);
|
||||
},
|
||||
|
Reference in New Issue
Block a user