UI changes

This commit is contained in:
Juan Gilsanz Polo
2024-02-25 13:16:40 +01:00
parent a0b39c3cc8
commit cf13d76a68
2 changed files with 101 additions and 114 deletions

View File

@@ -31,117 +31,117 @@ class BookmarkItem extends ConsumerWidget {
} }
} }
return ListTile( return InkWell(
onTap: ref.watch(appStatusProvider).useInAppBrowser == true onTap: ref.watch(appStatusProvider).useInAppBrowser == true
? () => ref.watch(routerProvider).push(RoutesPaths.webview, extra: bookmark) ? () => ref.watch(routerProvider).push(RoutesPaths.webview, extra: bookmark)
: () => openUrl(bookmark.url!), : () => openUrl(bookmark.url!),
isThreeLine: true, child: Padding(
title: Padding( padding: const EdgeInsets.all(16),
padding: const EdgeInsets.only(bottom: 4), child: Column(
child: Row( crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if (ref.watch(appStatusProvider).showFavicon == true) Row(
FutureBuilder( children: [
future: FaviconFinder.getBest(bookmark.url!), if (ref.watch(appStatusProvider).showFavicon == true)
builder: (context, snapshot) { FutureBuilder(
if (snapshot.hasData == false) { future: FaviconFinder.getBest(bookmark.url!),
return Padding( builder: (context, snapshot) {
padding: const EdgeInsets.only(right: 8), if (snapshot.hasData == false) {
child: ClipRRect( return Padding(
borderRadius: BorderRadius.circular(4), padding: const EdgeInsets.only(right: 8),
child: Skeletonizer( child: ClipRRect(
enabled: true, borderRadius: BorderRadius.circular(4),
ignoreContainers: true, child: Skeletonizer(
child: Container( enabled: true,
width: 16, ignoreContainers: true,
height: 16, child: Container(
color: Colors.black, width: 16,
height: 16,
color: Colors.black,
),
),
), ),
), );
), }
); return Row(
} children: [
return Row( if (snapshot.data!.url.contains("svg"))
children: [ SvgPicture.network(
if (snapshot.data!.url.contains("svg")) snapshot.data!.url,
SvgPicture.network( width: 16,
snapshot.data!.url, height: 16,
width: 16, ),
height: 16, if (!snapshot.data!.url.contains("svg"))
), Image.network(
if (!snapshot.data!.url.contains("svg")) snapshot.data!.url,
Image.network( width: 16,
snapshot.data!.url, height: 16,
width: 16, ),
height: 16, const SizedBox(width: 8),
), ],
const SizedBox(width: 8), );
], },
); ),
}, Expanded(
), child: Text(
Expanded( validateStrings(bookmark.title, bookmark.websiteTitle),
child: Text( maxLines: 1,
validateStrings(bookmark.title, bookmark.websiteTitle), overflow: TextOverflow.ellipsis,
maxLines: 1, textAlign: TextAlign.left,
overflow: TextOverflow.ellipsis, style: TextStyle(
textAlign: TextAlign.left, fontSize: 16,
style: TextStyle( fontWeight: FontWeight.w500,
fontSize: 16, color: Theme.of(context).colorScheme.onSurface,
fontWeight: FontWeight.w500, ),
color: Theme.of(context).colorScheme.onSurface, ),
), ),
],
),
const SizedBox(height: 4),
Text(
validateStrings(bookmark.description, bookmark.websiteDescription),
maxLines: 3,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 14,
color: Theme.of(context).colorScheme.onSurfaceVariant,
), ),
), ),
const SizedBox(height: 4),
Row(
children: [
Expanded(
child: Text(
bookmark.tagNames?.map((tag) => "#$tag").join(" ") ?? '',
overflow: TextOverflow.ellipsis,
style: const TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
),
),
),
if (bookmark.dateModified != null) ...[
if (bookmark.tagNames?.isNotEmpty == true)
Container(
width: 1,
height: 12,
margin: const EdgeInsets.symmetric(horizontal: 8),
color: Theme.of(context).colorScheme.tertiary.withOpacity(0.3),
),
Text(
dateToString(bookmark.dateModified!),
style: TextStyle(
fontSize: 12,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
],
],
),
], ],
), ),
), ),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
validateStrings(bookmark.description, bookmark.websiteDescription),
maxLines: 3,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 14,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
const SizedBox(height: 4),
Row(
children: [
Expanded(
child: Text(
bookmark.tagNames?.map((tag) => "#$tag").join(" ") ?? '',
overflow: TextOverflow.ellipsis,
style: const TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
),
),
),
if (bookmark.dateModified != null) ...[
if (bookmark.tagNames?.isNotEmpty == true)
Container(
width: 1,
height: 12,
margin: const EdgeInsets.symmetric(horizontal: 8),
color: Theme.of(context).colorScheme.tertiary.withOpacity(0.3),
),
Text(
dateToString(bookmark.dateModified!),
style: TextStyle(
fontSize: 12,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
],
],
),
],
),
); );
} }
} }

View File

@@ -118,20 +118,7 @@ class BookmarksScreen extends ConsumerWidget {
// Bottom gap for FAB // Bottom gap for FAB
return const SizedBox(height: 80); return const SizedBox(height: 80);
} }
return BookmarkItem(bookmark: bookmarks.bookmarks[index]);
final link = bookmarks.bookmarks[index];
return Column(
children: [
BookmarkItem(bookmark: link),
if (index < bookmarks.bookmarks.length - 1)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Divider(
color: Theme.of(context).colorScheme.tertiary.withOpacity(0.3),
),
),
],
);
}, },
), ),
], ],