63 lines
1.9 KiB
Dart
63 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../../../api/marianumcloud/talk/chat/get_chat_response.dart';
|
|
import '../../../../api/marianumcloud/talk/chat/rich_object_string_processor.dart';
|
|
import '../data/chat_bubble_styles.dart';
|
|
|
|
class AnswerReference extends StatelessWidget {
|
|
final GetChatResponseObject referenceMessage;
|
|
final String? selfId;
|
|
const AnswerReference({
|
|
required this.referenceMessage,
|
|
required this.selfId,
|
|
super.key,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final style = ChatBubbleStyles(context);
|
|
final isSelf = referenceMessage.actorId == selfId;
|
|
final accent = isSelf
|
|
? style.getSelfStyle().color!.withGreen(200)
|
|
: style.getRemoteStyle().color!.withWhite(200);
|
|
return DecoratedBox(
|
|
decoration: BoxDecoration(
|
|
color: accent.withValues(alpha: 0.2),
|
|
borderRadius: const BorderRadius.all(Radius.circular(5)),
|
|
border: Border(
|
|
left: BorderSide(color: accent, width: 5),
|
|
),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(5).add(const EdgeInsets.only(left: 5)),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
referenceMessage.actorDisplayName,
|
|
maxLines: 1,
|
|
style: TextStyle(
|
|
overflow: TextOverflow.ellipsis,
|
|
color: accent,
|
|
fontSize: 12,
|
|
),
|
|
),
|
|
Text(
|
|
RichObjectStringProcessor.parseToString(
|
|
referenceMessage.message,
|
|
referenceMessage.messageParameters,
|
|
),
|
|
maxLines: 2,
|
|
style: TextStyle(
|
|
overflow: TextOverflow.ellipsis,
|
|
color: Theme.of(context).colorScheme.onSurface,
|
|
fontSize: 12,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|