fix: fixed null sometimes popping up
This commit is contained in:
@@ -269,14 +269,18 @@ class ChannelPreview extends StatelessWidget {
|
|||||||
var textList = text.split(' ');
|
var textList = text.split(' ');
|
||||||
List<TextSpan> resList = [];
|
List<TextSpan> resList = [];
|
||||||
for (var e in textList) {
|
for (var e in textList) {
|
||||||
if (mentions.any((element) => '@${element.name}' == e)) {
|
if (mentions != null &&
|
||||||
|
mentions.isNotEmpty &&
|
||||||
|
mentions.any((element) => '@${element.name}' == e)) {
|
||||||
resList.add(TextSpan(
|
resList.add(TextSpan(
|
||||||
text: '$e ',
|
text: '$e ',
|
||||||
style: mentionsTextStyle,
|
style: mentionsTextStyle,
|
||||||
));
|
));
|
||||||
} else if (attachments
|
} else if (attachments != null &&
|
||||||
.where((e) => e.title != null)
|
attachments.isNotEmpty &&
|
||||||
.any((element) => element.title == e)) {
|
attachments
|
||||||
|
.where((e) => e.title != null)
|
||||||
|
.any((element) => element.title == e)) {
|
||||||
resList.add(TextSpan(
|
resList.add(TextSpan(
|
||||||
text: '$e ',
|
text: '$e ',
|
||||||
style: normalTextStyle.copyWith(fontStyle: FontStyle.italic),
|
style: normalTextStyle.copyWith(fontStyle: FontStyle.italic),
|
||||||
|
|||||||
@@ -165,14 +165,18 @@ class MessageSearchItem extends StatelessWidget {
|
|||||||
var textList = text.split(' ');
|
var textList = text.split(' ');
|
||||||
List<TextSpan> resList = [];
|
List<TextSpan> resList = [];
|
||||||
for (var e in textList) {
|
for (var e in textList) {
|
||||||
if (mentions.any((element) => '@${element.name}' == e)) {
|
if (mentions != null &&
|
||||||
|
mentions.isNotEmpty &&
|
||||||
|
mentions.any((element) => '@${element.name}' == e)) {
|
||||||
resList.add(TextSpan(
|
resList.add(TextSpan(
|
||||||
text: '$e ',
|
text: '$e ',
|
||||||
style: mentionsTextStyle,
|
style: mentionsTextStyle,
|
||||||
));
|
));
|
||||||
} else if (attachments
|
} else if (attachments != null &&
|
||||||
.where((e) => e.title != null)
|
attachments.isNotEmpty &&
|
||||||
.any((element) => element.title == e)) {
|
attachments
|
||||||
|
.where((e) => e.title != null)
|
||||||
|
.any((element) => element.title == e)) {
|
||||||
resList.add(TextSpan(
|
resList.add(TextSpan(
|
||||||
text: '$e ',
|
text: '$e ',
|
||||||
style: normalTextStyle.copyWith(fontStyle: FontStyle.italic),
|
style: normalTextStyle.copyWith(fontStyle: FontStyle.italic),
|
||||||
|
|||||||
Reference in New Issue
Block a user