🐛 Fix replies
This commit is contained in:
parent
f0f33f7bb3
commit
ca1a8a04cb
@ -208,13 +208,34 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
|||||||
_pagingController.itemList?[index + 1],
|
_pagingController.itemList?[index + 1],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget content;
|
||||||
|
if (item.replyTo != null) {
|
||||||
|
content = Column(
|
||||||
|
children: [
|
||||||
|
ChatMessage(
|
||||||
|
key: Key('m${item.replyTo.uuid}'),
|
||||||
|
item: item.replyTo,
|
||||||
|
isReply: true,
|
||||||
|
).paddingOnly(left: 24, right: 4, bottom: 2),
|
||||||
|
ChatMessage(
|
||||||
|
key: Key('m${item.uuid}'),
|
||||||
|
item: item,
|
||||||
|
isMerged: isMerged,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
content = ChatMessage(
|
||||||
|
key: Key('m${item.uuid}'),
|
||||||
|
item: item,
|
||||||
|
isMerged: isMerged,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return InkWell(
|
return InkWell(
|
||||||
child: Container(
|
child: Container(
|
||||||
child: ChatMessage(
|
child: content.paddingOnly(
|
||||||
key: Key('m${item.uuid}'),
|
|
||||||
item: item,
|
|
||||||
isMerged: isMerged,
|
|
||||||
).paddingOnly(
|
|
||||||
top: !isMerged ? 8 : 0,
|
top: !isMerged ? 8 : 0,
|
||||||
bottom: !hasMerged ? 8 : 0,
|
bottom: !hasMerged ? 8 : 0,
|
||||||
),
|
),
|
||||||
|
@ -22,7 +22,7 @@ class _AccountProfilePopupState extends State<AccountProfilePopup> {
|
|||||||
void getUserinfo() async {
|
void getUserinfo() async {
|
||||||
setState(() => _isBusy = true);
|
setState(() => _isBusy = true);
|
||||||
|
|
||||||
final client = GetConnect();
|
final client = GetConnect(maxAuthRetries: 3);
|
||||||
client.httpClient.baseUrl = ServiceFinder.services['passport'];
|
client.httpClient.baseUrl = ServiceFinder.services['passport'];
|
||||||
|
|
||||||
final resp = await client.get('/api/users/${widget.account.name}');
|
final resp = await client.get('/api/users/${widget.account.name}');
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_animate/flutter_animate.dart';
|
import 'package:flutter_animate/flutter_animate.dart';
|
||||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:solian/models/message.dart';
|
import 'package:solian/models/message.dart';
|
||||||
import 'package:solian/widgets/account/account_avatar.dart';
|
import 'package:solian/widgets/account/account_avatar.dart';
|
||||||
@ -11,7 +12,7 @@ import 'package:url_launcher/url_launcher_string.dart';
|
|||||||
class ChatMessage extends StatelessWidget {
|
class ChatMessage extends StatelessWidget {
|
||||||
final Message item;
|
final Message item;
|
||||||
final bool isContentPreviewing;
|
final bool isContentPreviewing;
|
||||||
final bool isCompact;
|
final bool isReply;
|
||||||
final bool isMerged;
|
final bool isMerged;
|
||||||
final bool isHasMerged;
|
final bool isHasMerged;
|
||||||
|
|
||||||
@ -21,7 +22,7 @@ class ChatMessage extends StatelessWidget {
|
|||||||
this.isContentPreviewing = false,
|
this.isContentPreviewing = false,
|
||||||
this.isMerged = false,
|
this.isMerged = false,
|
||||||
this.isHasMerged = false,
|
this.isHasMerged = false,
|
||||||
this.isCompact = false,
|
this.isReply = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
Future<String?> decodeContent(Map<String, dynamic> content) async {
|
Future<String?> decodeContent(Map<String, dynamic> content) async {
|
||||||
@ -100,19 +101,24 @@ class ChatMessage extends StatelessWidget {
|
|||||||
widget = buildContent();
|
widget = buildContent();
|
||||||
} else if (isMerged) {
|
} else if (isMerged) {
|
||||||
widget = buildContent().paddingOnly(left: 52);
|
widget = buildContent().paddingOnly(left: 52);
|
||||||
} else if (isCompact) {
|
} else if (isReply) {
|
||||||
widget = Row(
|
widget = Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
|
Transform.scale(
|
||||||
|
scaleX: -1,
|
||||||
|
child: const FaIcon(FontAwesomeIcons.reply, size: 14),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12),
|
||||||
AccountAvatar(content: item.sender.account.avatar, radius: 8),
|
AccountAvatar(content: item.sender.account.avatar, radius: 8),
|
||||||
|
const SizedBox(width: 4),
|
||||||
Text(
|
Text(
|
||||||
item.sender.account.nick,
|
item.sender.account.nick,
|
||||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 4),
|
||||||
Text(format(item.createdAt, locale: 'en_short')),
|
Text(format(item.createdAt, locale: 'en_short')),
|
||||||
const SizedBox(width: 4),
|
Expanded(child: buildContent()),
|
||||||
buildContent(),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -79,7 +79,7 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
|
|||||||
'type': 'm.text',
|
'type': 'm.text',
|
||||||
'content': encodeMessage(_textController.value.text),
|
'content': encodeMessage(_textController.value.text),
|
||||||
'attachments': _attachments,
|
'attachments': _attachments,
|
||||||
'reply_to': widget.reply?.id,
|
'reply_to': _replyTo?.id,
|
||||||
};
|
};
|
||||||
|
|
||||||
// The mock data
|
// The mock data
|
||||||
@ -105,6 +105,7 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
|
|||||||
channelId: widget.channel.id,
|
channelId: widget.channel.id,
|
||||||
senderId: sender.id,
|
senderId: sender.id,
|
||||||
);
|
);
|
||||||
|
|
||||||
message.isSending = true;
|
message.isSending = true;
|
||||||
|
|
||||||
if (widget.edit == null) widget.onSent(message);
|
if (widget.edit == null) widget.onSent(message);
|
||||||
|
Loading…
Reference in New Issue
Block a user