1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-10-23 15:03:22 +00:00
comunicmobile/lib/ui/widgets/text_widget.dart
2020-04-16 10:14:45 +02:00

38 lines
842 B
Dart

import 'package:comunic/utils/bbcode_parser.dart';
import 'package:flutter/material.dart';
import 'package:flutter_emoji/flutter_emoji.dart';
/// Text widget
///
/// The content passed to this widget is automatically parsed
///
/// @author Pierre Hubert
class TextWidget extends StatelessWidget {
final String content;
final bool parseBBcode;
final TextStyle style;
const TextWidget({
Key key,
@required this.content,
this.parseBBcode = false,
this.style,
}) : assert(content != null),
assert(parseBBcode != null),
super(key: key);
@override
Widget build(BuildContext context) {
var content = EmojiParser().emojify(this.content);
if (this.parseBBcode)
return BBCodeParsedWidget(text: content);
else
return Text(
content,
style: style,
);
}
}