mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-25 22:39:22 +00:00
Parse emojies
This commit is contained in:
parent
b7be59bc6e
commit
3389ca18f7
@ -3,6 +3,7 @@ import 'package:comunic/models/user.dart';
|
||||
import 'package:comunic/ui/widgets/account_image_widget.dart';
|
||||
import 'package:comunic/ui/widgets/like_widget.dart';
|
||||
import 'package:comunic/ui/widgets/network_image_widget.dart';
|
||||
import 'package:comunic/ui/widgets/text_widget.dart';
|
||||
import 'package:comunic/utils/date_utils.dart';
|
||||
import 'package:comunic/utils/intl_utils.dart';
|
||||
import 'package:comunic/utils/ui_utils.dart';
|
||||
@ -90,8 +91,8 @@ class CommentTile extends StatelessWidget {
|
||||
// Comment text
|
||||
Container(
|
||||
child: comment.hasContent
|
||||
? Text(
|
||||
comment.content,
|
||||
? TextWidget(
|
||||
content: comment.content,
|
||||
style: TextStyle(
|
||||
color: darkTheme() ? darkAccentColor : Colors.black),
|
||||
)
|
||||
|
@ -199,7 +199,10 @@ class _PostTileState extends State<PostTile> {
|
||||
// Post text
|
||||
Container(
|
||||
child: widget.post.hasContent
|
||||
? TextWidget(content: widget.post.content)
|
||||
? TextWidget(
|
||||
content: widget.post.content,
|
||||
parseBBcode: true,
|
||||
)
|
||||
: null),
|
||||
],
|
||||
);
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'package:comunic/utils/bbcode_parser.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_emoji/flutter_emoji.dart';
|
||||
|
||||
/// Text widget
|
||||
///
|
||||
@ -9,13 +10,28 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class TextWidget extends StatelessWidget {
|
||||
final String content;
|
||||
final bool parseBBcode;
|
||||
final TextStyle style;
|
||||
|
||||
const TextWidget({Key key, @required this.content})
|
||||
: assert(content != null),
|
||||
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) {
|
||||
return BBCodeParsedWidget(text: content);
|
||||
var content = EmojiParser().emojify(this.content);
|
||||
|
||||
if (this.parseBBcode)
|
||||
return BBCodeParsedWidget(text: content);
|
||||
else
|
||||
return Text(
|
||||
content,
|
||||
style: style,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -97,6 +97,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.3"
|
||||
flutter_emoji:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_emoji
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.2.1+1"
|
||||
flutter_plugin_android_lifecycle:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -51,6 +51,9 @@ dependencies:
|
||||
# Get current system language
|
||||
intl: ^0.16.1
|
||||
|
||||
# Parse emojies
|
||||
flutter_emoji: ^2.2.1+1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
Loading…
Reference in New Issue
Block a user