Chat message sending and receiving

This commit is contained in:
2024-11-17 21:30:02 +08:00
parent 285bb42b09
commit 2065350698
9 changed files with 200 additions and 55 deletions

View File

@ -9,7 +9,8 @@ import 'package:surface/widgets/markdown_content.dart';
class ChatMessage extends StatelessWidget {
final SnChatMessage data;
const ChatMessage({super.key, required this.data});
final bool isPending;
const ChatMessage({super.key, required this.data, this.isPending = false});
@override
Widget build(BuildContext context) {
@ -38,6 +39,6 @@ class ChatMessage extends StatelessWidget {
),
)
],
);
).opacity(isPending ? 0.5 : 1);
}
}

View File

@ -1,3 +1,4 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:material_symbols_icons/symbols.dart';
@ -33,12 +34,12 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
@override
Widget build(BuildContext context) {
return SizedBox(
height: 72,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
height: 56,
child: Row(
children: [
Expanded(
child: TextField(
@ -46,7 +47,9 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
controller: _contentController,
decoration: InputDecoration(
isCollapsed: true,
hintText: 'Type a message...',
hintText: 'fieldChatMessage'.tr(args: [
widget.controller.channel?.name ?? 'loading'.tr()
]),
border: InputBorder.none,
),
onSubmitted: (_) {
@ -68,9 +71,9 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
),
),
],
).padding(horizontal: 16, vertical: 12),
],
),
),
).padding(horizontal: 16),
],
);
}
}