reorganize
This commit is contained in:
parent
b9a2e09e74
commit
220c13a245
12 changed files with 39 additions and 29 deletions
64
lib/widgets/chat_page/chat_box.dart
Normal file
64
lib/widgets/chat_page/chat_box.dart
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
import "package:flutter/material.dart";
|
||||
import "package:flutter_chat_core/flutter_chat_core.dart";
|
||||
import "package:flutter_chat_ui/flutter_chat_ui.dart";
|
||||
|
||||
class ChatBox extends StatelessWidget {
|
||||
final Message? replyToMessage;
|
||||
final VoidCallback onDismiss;
|
||||
final Map<String, String> headers;
|
||||
const ChatBox({
|
||||
required this.replyToMessage,
|
||||
required this.onDismiss,
|
||||
required this.headers,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Composer(
|
||||
sigmaX: 0,
|
||||
sigmaY: 0,
|
||||
sendIconColor: Theme.of(context).colorScheme.primary,
|
||||
sendOnEnter: true,
|
||||
topWidget: replyToMessage == null
|
||||
? null
|
||||
: ColoredBox(
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
child: Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Avatar(
|
||||
userId: replyToMessage!.authorId,
|
||||
headers: headers,
|
||||
size: 16,
|
||||
),
|
||||
Text(
|
||||
replyToMessage!.metadata?["displayName"] ??
|
||||
replyToMessage!.authorId,
|
||||
style: Theme.of(context).textTheme.labelMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: (replyToMessage is TextMessage)
|
||||
? Text(
|
||||
(replyToMessage as TextMessage).text,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Theme.of(context).textTheme.labelMedium,
|
||||
maxLines: 1,
|
||||
)
|
||||
: SizedBox(),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: onDismiss,
|
||||
icon: Icon(Icons.close),
|
||||
iconSize: 20,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
autofocus: true,
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue