forked from Henry-Hiles/nexus
reorganize
This commit is contained in:
parent
9054b6b357
commit
95a4e03f00
6 changed files with 6 additions and 6 deletions
59
lib/widgets/chat_page/wrappers/message_wrapper.dart
Normal file
59
lib/widgets/chat_page/wrappers/message_wrapper.dart
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
import "package:flutter/material.dart";
|
||||
import "package:flutter_chat_core/flutter_chat_core.dart";
|
||||
import "package:nexus/models/room.dart";
|
||||
import "package:nexus/widgets/chat_page/lazy_loading/message_avatar.dart";
|
||||
import "package:nexus/widgets/chat_page/lazy_loading/message_displayname.dart";
|
||||
|
||||
class MessageWrapper extends StatelessWidget {
|
||||
final Message message;
|
||||
final Widget child;
|
||||
final Room room;
|
||||
final MessageGroupStatus? groupStatus;
|
||||
const MessageWrapper(
|
||||
this.message,
|
||||
this.child,
|
||||
this.groupStatus,
|
||||
this.room, {
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
child: AnimatedContainer(
|
||||
padding: message.metadata?["flashing"] == true
|
||||
? EdgeInsets.all(8)
|
||||
: EdgeInsets.all(0),
|
||||
color: message.metadata?["flashing"] == true
|
||||
? Theme.of(context).colorScheme.onSurface.withAlpha(50)
|
||||
: Colors.transparent,
|
||||
duration: Duration(milliseconds: 250),
|
||||
child: Row(
|
||||
spacing: 8,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
groupStatus?.isFirst != false
|
||||
? MessageAvatar(message, room, height: 40)
|
||||
: SizedBox(width: 40),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 4,
|
||||
children: [
|
||||
if (groupStatus?.isFirst != false)
|
||||
MessageDisplayname(
|
||||
message,
|
||||
room,
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
child,
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue