Show bookmark url when no title or description is provided

This commit is contained in:
Juan Gilsanz Polo
2025-06-17 21:15:17 +02:00
parent ff4f8be19f
commit a48e760f0c

View File

@@ -41,11 +41,13 @@ class BookmarkItem extends ConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
String validateStrings(String? string1, String? string2) { String validateStrings(String? string1, String? string2, String? string3) {
if (string1 != null && string1.isNotEmpty) { if (string1 != null && string1.isNotEmpty) {
return string1; return string1;
} else if (string2 != null && string2.isNotEmpty) { } else if (string2 != null && string2.isNotEmpty) {
return string2; return string2;
} else if (string3 != null && string3.isNotEmpty) {
return string3;
} else { } else {
return ""; return "";
} }
@@ -159,7 +161,7 @@ class BookmarkItem extends ConsumerWidget {
), ),
Expanded( Expanded(
child: Text( child: Text(
validateStrings(bookmark.title, bookmark.websiteTitle), validateStrings(bookmark.title, bookmark.websiteTitle, bookmark.url),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left, textAlign: TextAlign.left,
@@ -174,7 +176,7 @@ class BookmarkItem extends ConsumerWidget {
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
Text( Text(
validateStrings(bookmark.description, bookmark.websiteDescription), validateStrings(bookmark.description, bookmark.websiteDescription, bookmark.url),
maxLines: 3, maxLines: 3,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left, textAlign: TextAlign.left,