Compare commits
2 Commits
dea743a307
...
73982f48d6
Author | SHA1 | Date | |
---|---|---|---|
73982f48d6 | |||
1d36b30361 |
@ -363,4 +363,7 @@ const i18nEnglish = {
|
||||
'stickerUploaderNameHint':
|
||||
'A human-friendly name given to the user in the sticker selection interface.',
|
||||
'readMore': 'Read more',
|
||||
'attachmentUnload': 'Not Loaded',
|
||||
'attachmentUnloadCaption':
|
||||
'In order to save traffic, this attachment is not loaded automatically. Click it to start loading.',
|
||||
};
|
||||
|
@ -331,4 +331,6 @@ const i18nSimplifiedChinese = {
|
||||
'stickerUploaderName': '贴图名称',
|
||||
'stickerUploaderNameHint': '在贴图选择界面提供给用户的人类友好名称。',
|
||||
'readMore': '阅读更多',
|
||||
'attachmentUnload': '附件未加载',
|
||||
'attachmentUnloadCaption': '为了节省流量,本附件未自动加载,点一下来开始加载。',
|
||||
};
|
||||
|
@ -7,6 +7,7 @@ import 'package:media_kit_video/media_kit_video.dart';
|
||||
import 'package:solian/models/attachment.dart';
|
||||
import 'package:solian/platform.dart';
|
||||
import 'package:solian/services.dart';
|
||||
import 'package:solian/widgets/sized_container.dart';
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
|
||||
class AttachmentItem extends StatefulWidget {
|
||||
@ -213,8 +214,12 @@ class _AttachmentItemImage extends StatelessWidget {
|
||||
|
||||
class _AttachmentItemVideo extends StatefulWidget {
|
||||
final Attachment item;
|
||||
final bool autoload;
|
||||
|
||||
const _AttachmentItemVideo({required this.item});
|
||||
const _AttachmentItemVideo({
|
||||
required this.item,
|
||||
this.autoload = false,
|
||||
});
|
||||
|
||||
@override
|
||||
State<_AttachmentItemVideo> createState() => _AttachmentItemVideoState();
|
||||
@ -226,21 +231,64 @@ class _AttachmentItemVideoState extends State<_AttachmentItemVideo> {
|
||||
);
|
||||
late final _controller = VideoController(_player);
|
||||
|
||||
bool _showContent = false;
|
||||
|
||||
void _startLoad() {
|
||||
_player.open(
|
||||
Media(ServiceFinder.buildUrl('files', '/attachments/${widget.item.id}')),
|
||||
play: false,
|
||||
);
|
||||
setState(() => _showContent = true);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_player.open(
|
||||
Media(
|
||||
ServiceFinder.buildUrl('files', '/attachments/${widget.item.id}'),
|
||||
),
|
||||
play: false,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ratio = widget.item.metadata?['ratio'] ?? 16 / 9;
|
||||
if (!_showContent) {
|
||||
return GestureDetector(
|
||||
child: AspectRatio(
|
||||
aspectRatio: ratio,
|
||||
child: CenteredContainer(
|
||||
maxWidth: 280,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.not_started,
|
||||
color: Colors.white,
|
||||
size: 32,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'attachmentUnload'.tr,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'attachmentUnloadCaption'.tr,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
_startLoad();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
return Video(
|
||||
aspectRatio: widget.item.metadata?['ratio'] ?? 16 / 9,
|
||||
aspectRatio: ratio,
|
||||
controller: _controller,
|
||||
);
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import 'package:solian/models/attachment.dart';
|
||||
import 'package:solian/widgets/attachments/attachment_item.dart';
|
||||
import 'package:solian/providers/content/attachment.dart';
|
||||
import 'package:solian/widgets/attachments/attachment_fullscreen.dart';
|
||||
import 'package:solian/widgets/sized_container.dart';
|
||||
|
||||
class AttachmentList extends StatefulWidget {
|
||||
final String parentId;
|
||||
@ -272,35 +273,33 @@ class AttachmentListEntry extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
if (item!.isMature && !showMature)
|
||||
Center(
|
||||
child: Container(
|
||||
constraints: const BoxConstraints(maxWidth: 280),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.visibility_off,
|
||||
color: Colors.white,
|
||||
size: 32,
|
||||
CenteredContainer(
|
||||
maxWidth: 280,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.visibility_off,
|
||||
color: Colors.white,
|
||||
size: 32,
|
||||
),
|
||||
if (!isDense) const SizedBox(height: 8),
|
||||
if (!isDense)
|
||||
Text(
|
||||
'matureContent'.tr,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
if (!isDense) const SizedBox(height: 8),
|
||||
if (!isDense)
|
||||
Text(
|
||||
'matureContent'.tr,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
if (!isDense)
|
||||
Text(
|
||||
'matureContentCaption'.tr,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
if (!isDense)
|
||||
Text(
|
||||
'matureContentCaption'.tr,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -50,10 +50,10 @@ class ChatEvent extends StatelessWidget {
|
||||
return Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.attachment,
|
||||
size: 18,
|
||||
Icons.file_copy,
|
||||
size: 15,
|
||||
color: unFocusColor,
|
||||
).paddingOnly(right: 6),
|
||||
).paddingOnly(right: 5),
|
||||
Text(
|
||||
'attachmentHint'.trParams(
|
||||
{'count': attachments.length.toString()},
|
||||
@ -221,6 +221,8 @@ class ChatEvent extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
_buildContent().paddingOnly(left: 0.5),
|
||||
_buildAttachment(context, isMinimal: true)
|
||||
.paddingOnly(left: 0),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -31,7 +31,11 @@ class ChatEventMessageActionLog extends StatelessWidget {
|
||||
).paddingOnly(
|
||||
left: isQuote ? 0 : (isMerged ? 64 : 12),
|
||||
top: 2,
|
||||
bottom: isHasMerged ? 2 : 0,
|
||||
bottom: isQuote
|
||||
? 0
|
||||
: isHasMerged
|
||||
? 2
|
||||
: 0,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -67,7 +67,9 @@ class ChatEventMessage extends StatelessWidget {
|
||||
left: isQuote ? 0 : 12,
|
||||
right: isQuote ? 0 : 12,
|
||||
top: body.quoteEvent == null ? 2 : 0,
|
||||
bottom: hasAttachment && !isContentPreviewing ? 4 : (isHasMerged ? 2 : 0),
|
||||
bottom: hasAttachment && !isContentPreviewing && !isQuote
|
||||
? 4
|
||||
: (isHasMerged ? 2 : 0),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -208,6 +208,8 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
|
||||
final body = EventMessageBody.fromJson(widget.edit!.body);
|
||||
_editTo = widget.edit!;
|
||||
_textController.text = body.text;
|
||||
_attachments.addAll(
|
||||
widget.edit!.body['attachments']?.cast<int>() ?? List.empty());
|
||||
}
|
||||
if (widget.reply != null) {
|
||||
_replyTo = widget.reply!;
|
||||
|
@ -335,10 +335,10 @@ class _PostItemState extends State<PostItem> {
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.attachment,
|
||||
size: 18,
|
||||
Icons.file_copy,
|
||||
size: 15,
|
||||
color: _unFocusColor,
|
||||
).paddingOnly(right: 6),
|
||||
).paddingOnly(right: 5),
|
||||
Text(
|
||||
'attachmentHint'.trParams(
|
||||
{'count': attachments.length.toString()},
|
||||
@ -440,7 +440,7 @@ class _PostItemState extends State<PostItem> {
|
||||
attachmentsId: attachments,
|
||||
isGrid: attachments.length > 1,
|
||||
),
|
||||
if (widget.isShowReply && widget.isReactable)
|
||||
if (widget.isShowReply || widget.isReactable)
|
||||
PostQuickAction(
|
||||
isShowReply: widget.isShowReply,
|
||||
isReactable: widget.isReactable,
|
||||
|
@ -16,8 +16,9 @@ class SizedContainer extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Container(
|
||||
constraints: BoxConstraints(maxWidth: maxWidth, maxHeight: maxHeight),
|
||||
child: LimitedBox(
|
||||
maxWidth: maxWidth,
|
||||
maxHeight: maxHeight,
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
@ -37,8 +38,8 @@ class CenteredContainer extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Container(
|
||||
constraints: BoxConstraints(maxWidth: maxWidth),
|
||||
child: LimitedBox(
|
||||
maxWidth: maxWidth,
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
|
@ -2,7 +2,7 @@ name: solian
|
||||
description: "The Solar Network App"
|
||||
publish_to: "none"
|
||||
|
||||
version: 1.2.1+6
|
||||
version: 1.2.1+8
|
||||
|
||||
environment:
|
||||
sdk: ">=3.3.4 <4.0.0"
|
||||
|
Loading…
x
Reference in New Issue
Block a user