78 lines
2.5 KiB
Dart
78 lines
2.5 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 BuildContext context;
|
|
final GetChatResponseObject referenceMessage;
|
|
final String? selfId;
|
|
const AnswerReference({
|
|
required this.context,
|
|
required this.referenceMessage,
|
|
required this.selfId,
|
|
super.key,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var style = ChatBubbleStyles(context);
|
|
return DecoratedBox(
|
|
decoration: BoxDecoration(
|
|
color: referenceMessage.actorId == selfId
|
|
? style
|
|
.getSelfStyle(false)
|
|
.color!
|
|
.withGreen(200)
|
|
.withValues(alpha: 0.2)
|
|
: style
|
|
.getRemoteStyle(false)
|
|
.color!
|
|
.withWhite(200)
|
|
.withValues(alpha: 0.2),
|
|
borderRadius: const BorderRadius.all(Radius.circular(5)),
|
|
border: Border(
|
|
left: BorderSide(
|
|
color: referenceMessage.actorId == selfId
|
|
? style.getSelfStyle(false).color!.withGreen(200)
|
|
: style.getRemoteStyle(false).color!.withWhite(200),
|
|
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: referenceMessage.actorId == selfId
|
|
? style.getSelfStyle(false).color!.withGreen(200)
|
|
: style.getRemoteStyle(false).color!.withWhite(200),
|
|
fontSize: 12,
|
|
),
|
|
),
|
|
Text(
|
|
RichObjectStringProcessor.parseToString(
|
|
referenceMessage.message,
|
|
referenceMessage.messageParameters,
|
|
),
|
|
maxLines: 2,
|
|
style: TextStyle(
|
|
overflow: TextOverflow.ellipsis,
|
|
color: Theme.of(context).colorScheme.onSurface,
|
|
fontSize: 12,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|