|
|
|
|
@ -13,10 +13,11 @@ import 'package:url_launcher/url_launcher.dart';
|
|
|
|
|
import '../model/copilot_message_model.dart';
|
|
|
|
|
|
|
|
|
|
class CopilotMessageBubble extends StatelessWidget {
|
|
|
|
|
final String? userAvatar;
|
|
|
|
|
final CopilotMessage message;
|
|
|
|
|
final bool showHeader;
|
|
|
|
|
|
|
|
|
|
const CopilotMessageBubble({Key? key, required this.message, this.showHeader = true}) : super(key: key);
|
|
|
|
|
const CopilotMessageBubble({Key? key, required this.message, this.showHeader = true, this.userAvatar}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
@ -24,12 +25,6 @@ class CopilotMessageBubble extends StatelessWidget {
|
|
|
|
|
return isUser ? _senderCard(context) : _recipientCard(context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const Widget _avatar = SizedBox(
|
|
|
|
|
height: 26,
|
|
|
|
|
width: 26,
|
|
|
|
|
child: DecoratedBox(decoration: BoxDecoration(shape: BoxShape.circle, color: Colors.grey)),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
String get _timeText => (message.timestamp?.toIso8601String() ?? DateTime.now().toIso8601String()).chatMsgTime;
|
|
|
|
|
|
|
|
|
|
Widget _senderCard(BuildContext context) {
|
|
|
|
|
@ -38,7 +33,19 @@ class CopilotMessageBubble extends StatelessWidget {
|
|
|
|
|
children: [
|
|
|
|
|
const InfoTextLabelWidget(label: "Me"),
|
|
|
|
|
8.width,
|
|
|
|
|
_avatar,
|
|
|
|
|
Container(
|
|
|
|
|
height: 36,
|
|
|
|
|
width: 36,
|
|
|
|
|
padding: const EdgeInsets.all(4),
|
|
|
|
|
decoration: BoxDecoration(color: AppColor.background(context), shape: BoxShape.circle, border: Border.all(color: Colors.transparent)),
|
|
|
|
|
child: userAvatar != null
|
|
|
|
|
? ClipOval(child: Image.network(userAvatar!, width: 14, height: 14))
|
|
|
|
|
: Icon(
|
|
|
|
|
Icons.person,
|
|
|
|
|
size: 16,
|
|
|
|
|
color: AppColor.icon2Color(context),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
@ -95,7 +102,12 @@ class CopilotMessageBubble extends StatelessWidget {
|
|
|
|
|
final recipientHeader = Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
_avatar,
|
|
|
|
|
Container(
|
|
|
|
|
height: 36,
|
|
|
|
|
width: 36,
|
|
|
|
|
padding: const EdgeInsets.all(8),
|
|
|
|
|
decoration: BoxDecoration(color: AppColor.background(context), shape: BoxShape.circle, border: Border.all(color: Colors.transparent)),
|
|
|
|
|
child: "copilot_logo".toSvgAsset(width: 14, height: 14)),
|
|
|
|
|
8.width,
|
|
|
|
|
const InfoTextLabelWidget(label: "Copilot"),
|
|
|
|
|
// Text(
|
|
|
|
|
|