fluffychat/lib/components/list_items/state_message.dart

43 lines
1.2 KiB
Dart
Raw Normal View History

2020-01-01 19:10:13 +01:00
import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/utils/matrix_locals.dart';
2020-01-01 19:10:13 +01:00
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
2020-01-01 19:10:13 +01:00
2020-12-12 09:27:17 +01:00
import '../../app_config.dart';
2020-01-01 19:10:13 +01:00
class StateMessage extends StatelessWidget {
final Event event;
const StateMessage(this.event);
@override
Widget build(BuildContext context) {
2020-12-12 09:27:17 +01:00
if (event.type == EventTypes.Redaction || AppConfig.hideAllStateEvents) {
return Container();
}
2020-01-01 19:10:13 +01:00
return Padding(
2020-01-18 13:22:22 +01:00
padding: const EdgeInsets.only(
left: 8.0,
right: 8.0,
2020-09-21 19:21:24 +02:00
bottom: 8.0,
2020-01-18 13:22:22 +01:00
),
2020-09-21 19:21:24 +02:00
child: Center(
child: Container(
2020-11-22 19:34:19 +01:00
padding: const EdgeInsets.all(8),
2020-09-21 19:21:24 +02:00
decoration: BoxDecoration(
2020-11-22 19:34:19 +01:00
color: Theme.of(context).secondaryHeaderColor.withOpacity(0.9),
2020-09-21 19:21:24 +02:00
borderRadius: BorderRadius.circular(7),
),
child: Text(
event.getLocalizedBody(MatrixLocals(L10n.of(context))),
2020-09-21 19:21:24 +02:00
textAlign: TextAlign.center,
style: TextStyle(
color: Theme.of(context).textTheme.bodyText2.color,
decoration: event.redacted ? TextDecoration.lineThrough : null,
),
2020-01-19 15:07:42 +01:00
),
2020-01-03 11:57:00 +01:00
),
2020-01-01 19:10:13 +01:00
),
);
}
}