|
|
|
@ -27,7 +27,7 @@ class EventInfoDialog extends StatelessWidget {
|
|
|
|
|
super.key,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
String get prettyJson {
|
|
|
|
|
String prettyJson(MatrixEvent event) {
|
|
|
|
|
const decoder = JsonDecoder();
|
|
|
|
|
const encoder = JsonEncoder.withIndent(' ');
|
|
|
|
|
final object = decoder.convert(jsonEncode(event.toJson()));
|
|
|
|
@ -37,6 +37,7 @@ class EventInfoDialog extends StatelessWidget {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
final theme = Theme.of(context);
|
|
|
|
|
final originalSource = event.originalSource;
|
|
|
|
|
return Scaffold(
|
|
|
|
|
appBar: AppBar(
|
|
|
|
|
title: Text(L10n.of(context)!.messageInfo),
|
|
|
|
@ -61,48 +62,53 @@ class EventInfoDialog extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
ListTile(
|
|
|
|
|
title: Text(L10n.of(context)!.time),
|
|
|
|
|
title: Text('${L10n.of(context)!.time}:'),
|
|
|
|
|
subtitle: Text(event.originServerTs.localizedTime(context)),
|
|
|
|
|
),
|
|
|
|
|
ListTile(
|
|
|
|
|
title: Text(L10n.of(context)!.messageType),
|
|
|
|
|
subtitle: Text(event.humanreadableType),
|
|
|
|
|
title: Text('${L10n.of(context)!.status}:'),
|
|
|
|
|
subtitle: Text(event.status.name),
|
|
|
|
|
),
|
|
|
|
|
ListTile(title: Text('${L10n.of(context)!.sourceCode}:')),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(12.0),
|
|
|
|
|
child: Material(
|
|
|
|
|
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
|
|
|
|
color: theme.colorScheme.inverseSurface,
|
|
|
|
|
color: theme.colorScheme.surfaceContainer,
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
padding: const EdgeInsets.all(8),
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
|
child: SelectableText(
|
|
|
|
|
prettyJson,
|
|
|
|
|
prettyJson(MatrixEvent.fromJson(event.toJson())),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: theme.colorScheme.onInverseSurface,
|
|
|
|
|
color: theme.colorScheme.onSurface,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (originalSource != null) ...[
|
|
|
|
|
ListTile(title: Text('${L10n.of(context)!.encrypted}:')),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(12.0),
|
|
|
|
|
child: Material(
|
|
|
|
|
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
|
|
|
|
color: theme.colorScheme.surfaceContainer,
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
|
child: SelectableText(
|
|
|
|
|
prettyJson(originalSource),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: theme.colorScheme.onSurface,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extension on Event {
|
|
|
|
|
String get humanreadableType {
|
|
|
|
|
if (type == EventTypes.Message) {
|
|
|
|
|
return messageType.split('m.').last;
|
|
|
|
|
}
|
|
|
|
|
if (type.startsWith('m.room.')) {
|
|
|
|
|
return type.split('m.room.').last;
|
|
|
|
|
}
|
|
|
|
|
if (type.startsWith('m.')) {
|
|
|
|
|
return type.split('m.').last;
|
|
|
|
|
}
|
|
|
|
|
return type;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|