fix(ui): Fix UI crash when less than 8 shared media items are available

This commit is contained in:
PapaTutuWawa 2023-03-16 17:09:58 +01:00
parent 8178a0dd8a
commit 8f68292dfd

View File

@ -118,17 +118,21 @@ class SharedMediaDisplay extends StatelessWidget {
mainAxisSpacing: 8,
crossAxisSpacing: 8,
),
children: preview.sublist(0, 8).map((el) {
if (el == preview.last && sharedMediaAmount >= 8) {
return SharedSummaryWidget(
notShown: sharedMediaAmount - 7,
conversationJid: jid,
conversationTitle: title,
);
}
children: preview.length < 8
? preview
.map((el) => buildSharedMediaWidget(el, jid))
.toList()
: preview.sublist(0, 8).map((el) {
if (el == preview.last && sharedMediaAmount >= 8) {
return SharedSummaryWidget(
notShown: sharedMediaAmount - 7,
conversationJid: jid,
conversationTitle: title,
);
}
return buildSharedMediaWidget(el, jid);
}).toList(),
return buildSharedMediaWidget(el, jid);
}).toList(),
),
),
),