✨ Chat attachments
This commit is contained in:
parent
9cb2b9122e
commit
c3bf0a19b8
@ -145,8 +145,6 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
padding: EdgeInsets.only(
|
||||
top: !isMerged ? 8 : 0,
|
||||
bottom: !hasMerged ? 8 : 0,
|
||||
left: 12,
|
||||
right: 12,
|
||||
),
|
||||
child: ChatMessage(
|
||||
item: item,
|
||||
|
@ -45,7 +45,7 @@ class _PostPublishingScreenState extends State<PostPublishingScreen> {
|
||||
|
||||
List<int> _attachments = List.empty();
|
||||
|
||||
void showAttachments(BuildContext context) {
|
||||
void showAttachments() {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (context) => AttachmentPublishingPopup(
|
||||
@ -258,7 +258,7 @@ class _PostPublishingScreenState extends State<PostPublishingScreen> {
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(shape: const CircleBorder()),
|
||||
child: const Icon(Icons.camera_alt),
|
||||
onPressed: () => showAttachments(context),
|
||||
onPressed: () => showAttachments(),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
@ -82,6 +82,8 @@ class _SocialScreenState extends State<SocialScreen> {
|
||||
sliver: SliverAppBar(
|
||||
title: Text('social'.tr),
|
||||
centerTitle: false,
|
||||
floating: true,
|
||||
snap: true,
|
||||
titleSpacing:
|
||||
SolianTheme.isLargeScreen(context) ? null : 24,
|
||||
forceElevated: innerBoxIsScrolled,
|
||||
|
@ -4,6 +4,7 @@ import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:solian/models/message.dart';
|
||||
import 'package:solian/widgets/account/account_avatar.dart';
|
||||
import 'package:solian/widgets/attachments/attachment_list.dart';
|
||||
import 'package:timeago/timeago.dart' show format;
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
|
||||
@ -136,7 +137,11 @@ class ChatMessage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
).paddingSymmetric(horizontal: 12),
|
||||
AttachmentList(
|
||||
parentId: item.uuid,
|
||||
attachmentsId: item.attachments ?? List.empty(),
|
||||
).paddingSymmetric(vertical: 4),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import 'package:solian/models/channel.dart';
|
||||
import 'package:solian/models/message.dart';
|
||||
import 'package:solian/providers/auth.dart';
|
||||
import 'package:solian/services.dart';
|
||||
import 'package:solian/widgets/attachments/attachment_publish.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
class ChatMessageInput extends StatefulWidget {
|
||||
@ -34,6 +35,17 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
|
||||
|
||||
List<int> _attachments = List.empty(growable: true);
|
||||
|
||||
void showAttachments() {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (context) => AttachmentPublishingPopup(
|
||||
usage: 'm.attachment',
|
||||
current: _attachments,
|
||||
onUpdate: (value) => _attachments = value,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> encodeMessage(String content) {
|
||||
// TODO Impl E2EE
|
||||
|
||||
@ -144,6 +156,11 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
|
||||
FocusManager.instance.primaryFocus?.unfocus(),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.attach_file),
|
||||
color: Colors.teal,
|
||||
onPressed: () => showAttachments(),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.send),
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
|
Loading…
Reference in New Issue
Block a user