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