Improved favicons load
This commit is contained in:
@@ -5,4 +5,6 @@ class Urls {
|
|||||||
static const playStoreLink = "https://play.google.com/store/apps/details?id=com.jgeek00.linkdy&pcampaignid=web_share";
|
static const playStoreLink = "https://play.google.com/store/apps/details?id=com.jgeek00.linkdy&pcampaignid=web_share";
|
||||||
static const linkdingRepo = "https://github.com/sissbruecker/linkding";
|
static const linkdingRepo = "https://github.com/sissbruecker/linkding";
|
||||||
static const support = "https://appsupport.jgeek00.com";
|
static const support = "https://appsupport.jgeek00.com";
|
||||||
|
static gstatic(url) =>
|
||||||
|
"https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=${url}&size=16";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/scheduler.dart';
|
import 'package:flutter/scheduler.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
|
||||||
import 'package:linkdy/screens/bookmarks/provider/favicon_loader.provider.dart';
|
|
||||||
import 'package:linkdy/constants/shared_preferences_keys.dart';
|
import 'package:linkdy/constants/shared_preferences_keys.dart';
|
||||||
import 'package:linkdy/providers/shared_preferences.provider.dart';
|
import 'package:linkdy/providers/shared_preferences.provider.dart';
|
||||||
import 'package:linkdy/constants/enums.dart';
|
import 'package:linkdy/constants/enums.dart';
|
||||||
@@ -59,7 +58,6 @@ class AppStatus extends _$AppStatus {
|
|||||||
void setShowFavicon(bool value) {
|
void setShowFavicon(bool value) {
|
||||||
state.showFavicon = value;
|
state.showFavicon = value;
|
||||||
ref.read(sharedPreferencesProvider).setBool(SharedPreferencesKeys.showFavicon, value);
|
ref.read(sharedPreferencesProvider).setBool(SharedPreferencesKeys.showFavicon, value);
|
||||||
ref.read(faviconStoreProvider.notifier).clearFavicons();
|
|
||||||
ref.notifyListeners();
|
ref.notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,8 +87,5 @@ ThemeMode selectedTheme(SelectedThemeRef ref) {
|
|||||||
|
|
||||||
case SelectedTheme.dark:
|
case SelectedTheme.dark:
|
||||||
return ThemeMode.dark;
|
return ThemeMode.dark;
|
||||||
|
|
||||||
default:
|
|
||||||
return ThemeMode.light;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|||||||
|
|
||||||
import 'package:linkdy/screens/webview/ui/webview.dart';
|
import 'package:linkdy/screens/webview/ui/webview.dart';
|
||||||
import 'package:linkdy/screens/bookmarks/provider/common_functions.dart';
|
import 'package:linkdy/screens/bookmarks/provider/common_functions.dart';
|
||||||
import 'package:linkdy/screens/bookmarks/provider/favicon_loader.provider.dart';
|
|
||||||
import 'package:linkdy/screens/bookmarks/model/bookmarks.model.dart';
|
import 'package:linkdy/screens/bookmarks/model/bookmarks.model.dart';
|
||||||
|
|
||||||
import 'package:linkdy/config/sizes.dart';
|
import 'package:linkdy/config/sizes.dart';
|
||||||
@@ -35,7 +34,6 @@ FutureOr<void> bookmarksRequest(
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (result.successful == true) {
|
if (result.successful == true) {
|
||||||
ref.read(faviconStoreProvider.notifier).loadFavicons(result.content!.results!);
|
|
||||||
ref.read(bookmarksProvider).bookmarks = result.content!.results!;
|
ref.read(bookmarksProvider).bookmarks = result.content!.results!;
|
||||||
ref.read(bookmarksProvider).maxNumber = result.content!.count!;
|
ref.read(bookmarksProvider).maxNumber = result.content!.count!;
|
||||||
ref.read(bookmarksProvider).currentPage = 0;
|
ref.read(bookmarksProvider).currentPage = 0;
|
||||||
@@ -65,7 +63,7 @@ FutureOr<void> bookmarksRequestLoadMore(BookmarksRequestLoadMoreRef ref) async {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (result.successful == true) {
|
if (result.successful == true) {
|
||||||
ref.read(faviconStoreProvider.notifier).loadFavicons(result.content!.results!);
|
// ref.read(faviconStoreProvider.notifier).loadFavicons(result.content!.results!);
|
||||||
provider.bookmarks = [...provider.bookmarks, ...result.content!.results!];
|
provider.bookmarks = [...provider.bookmarks, ...result.content!.results!];
|
||||||
provider.maxNumber = result.content!.count!;
|
provider.maxNumber = result.content!.count!;
|
||||||
provider.currentPage = provider.currentPage + 1;
|
provider.currentPage = provider.currentPage + 1;
|
||||||
|
|||||||
@@ -1,94 +0,0 @@
|
|||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:favicon/favicon.dart';
|
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
||||||
|
|
||||||
import 'package:linkdy/screens/bookmarks/model/favicon_loader.model.dart';
|
|
||||||
|
|
||||||
import 'package:linkdy/models/favicon_item.dart';
|
|
||||||
import 'package:linkdy/models/data/bookmarks.dart';
|
|
||||||
|
|
||||||
part 'favicon_loader.provider.g.dart';
|
|
||||||
|
|
||||||
// @riverpod
|
|
||||||
// FutureOr<FaviconItem?> fetchFavicon(FetchFaviconRef ref, String bookmarkUrl) async {
|
|
||||||
// final exists = ref.watch(faviconStoreProvider).favicons.where((favicon) => favicon.url == bookmarkUrl).toList();
|
|
||||||
// if (exists.isNotEmpty) {
|
|
||||||
// return exists[0];
|
|
||||||
// }
|
|
||||||
|
|
||||||
// final faviconResult = await FaviconFinder.getBest(bookmarkUrl);
|
|
||||||
// if (faviconResult == null) {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// final result = await http.get(Uri.parse(faviconResult.url));
|
|
||||||
// if (result.statusCode == 200) {
|
|
||||||
// final faviconItem = FaviconItem(
|
|
||||||
// url: bookmarkUrl,
|
|
||||||
// favicon: faviconResult.url.contains("svg") ? result.body : base64.encode(result.bodyBytes),
|
|
||||||
// isSvg: faviconResult.url.contains("svg"),
|
|
||||||
// );
|
|
||||||
// ref.read(faviconStoreProvider).favicons.add(faviconItem);
|
|
||||||
// return faviconItem;
|
|
||||||
// } else {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Riverpod(keepAlive: true)
|
|
||||||
class FaviconStore extends _$FaviconStore {
|
|
||||||
@override
|
|
||||||
FaviconLoaderModel build() {
|
|
||||||
return FaviconLoaderModel(
|
|
||||||
favicons: [],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void clearFavicons() {
|
|
||||||
state.favicons = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
void loadFavicons(List<Bookmark> bookmarks) async {
|
|
||||||
if (state.loadingFavicons == true) return;
|
|
||||||
|
|
||||||
state.loadingFavicons = true;
|
|
||||||
ref.notifyListeners();
|
|
||||||
|
|
||||||
final mappedSaved = state.favicons.map((e) => e.url);
|
|
||||||
final notExist = bookmarks.map((b) => b.url!).where((b) => !mappedSaved.contains(b)).toList();
|
|
||||||
|
|
||||||
final favicons = await compute(
|
|
||||||
(message) => Future.wait(
|
|
||||||
message.map(
|
|
||||||
(e) {
|
|
||||||
try {
|
|
||||||
return FaviconFinder.getBest(e);
|
|
||||||
} catch (_) {
|
|
||||||
return Future.delayed(Duration.zero);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
notExist,
|
|
||||||
);
|
|
||||||
|
|
||||||
final faviconUrls = favicons
|
|
||||||
.asMap()
|
|
||||||
.entries
|
|
||||||
.map(
|
|
||||||
(e) => e.value != null
|
|
||||||
? FaviconItem(
|
|
||||||
url: notExist[e.key],
|
|
||||||
favicon: e.value!.url,
|
|
||||||
isSvg: e.value!.url.contains('svg'),
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
)
|
|
||||||
.toList();
|
|
||||||
faviconUrls.removeWhere((v) => v == null);
|
|
||||||
|
|
||||||
state.favicons = [...state.favicons, ...List<FaviconItem>.from(faviconUrls)];
|
|
||||||
state.loadingFavicons = false;
|
|
||||||
ref.notifyListeners();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'favicon_loader.provider.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// RiverpodGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
String _$faviconStoreHash() => r'5575f5daff34748e6cae0143c8633cbbe19b6009';
|
|
||||||
|
|
||||||
/// See also [FaviconStore].
|
|
||||||
@ProviderFor(FaviconStore)
|
|
||||||
final faviconStoreProvider =
|
|
||||||
NotifierProvider<FaviconStore, FaviconLoaderModel>.internal(
|
|
||||||
FaviconStore.new,
|
|
||||||
name: r'faviconStoreProvider',
|
|
||||||
debugGetCreateSourceHash:
|
|
||||||
const bool.fromEnvironment('dart.vm.product') ? null : _$faviconStoreHash,
|
|
||||||
dependencies: null,
|
|
||||||
allTransitiveDependencies: null,
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef _$FaviconStore = Notifier<FaviconLoaderModel>;
|
|
||||||
// ignore_for_file: type=lint
|
|
||||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member
|
|
||||||
@@ -3,7 +3,6 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
|
||||||
import 'package:linkdy/screens/webview/ui/webview.dart';
|
import 'package:linkdy/screens/webview/ui/webview.dart';
|
||||||
import 'package:linkdy/screens/bookmarks/provider/favicon_loader.provider.dart';
|
|
||||||
import 'package:linkdy/screens/bookmarks/provider/bookmarks.provider.dart';
|
import 'package:linkdy/screens/bookmarks/provider/bookmarks.provider.dart';
|
||||||
import 'package:linkdy/screens/bookmarks/provider/common_functions.dart';
|
import 'package:linkdy/screens/bookmarks/provider/common_functions.dart';
|
||||||
import 'package:linkdy/screens/bookmarks/model/search_bookmarks.model.dart';
|
import 'package:linkdy/screens/bookmarks/model/search_bookmarks.model.dart';
|
||||||
@@ -31,7 +30,7 @@ FutureOr<void> fetchSearchBookmarks(FetchSearchBookmarksRef ref, int limit) asyn
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (result.successful == true) {
|
if (result.successful == true) {
|
||||||
ref.read(faviconStoreProvider.notifier).loadFavicons(result.content!.results!);
|
// ref.read(faviconStoreProvider.notifier).loadFavicons(result.content!.results!);
|
||||||
ref.read(searchBookmarksProvider).bookmarks = result.content!.results!;
|
ref.read(searchBookmarksProvider).bookmarks = result.content!.results!;
|
||||||
ref.read(searchBookmarksProvider).maxNumber = result.content!.count!;
|
ref.read(searchBookmarksProvider).maxNumber = result.content!.count!;
|
||||||
ref.read(searchBookmarksProvider).currentPage = 0;
|
ref.read(searchBookmarksProvider).currentPage = 0;
|
||||||
@@ -56,7 +55,6 @@ FutureOr<void> fetchSearchBookmarksLoadMore(FetchSearchBookmarksLoadMoreRef ref)
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (result.successful == true) {
|
if (result.successful == true) {
|
||||||
ref.read(faviconStoreProvider.notifier).loadFavicons(result.content!.results!);
|
|
||||||
provider.bookmarks = [...provider.bookmarks, ...result.content!.results!];
|
provider.bookmarks = [...provider.bookmarks, ...result.content!.results!];
|
||||||
provider.maxNumber = result.content!.count!;
|
provider.maxNumber = result.content!.count!;
|
||||||
provider.currentPage = provider.currentPage + 1;
|
provider.currentPage = provider.currentPage + 1;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|||||||
|
|
||||||
import 'package:linkdy/screens/bookmarks/ui/visualization_modal.dart';
|
import 'package:linkdy/screens/bookmarks/ui/visualization_modal.dart';
|
||||||
import 'package:linkdy/screens/bookmarks/provider/bookmarks.provider.dart';
|
import 'package:linkdy/screens/bookmarks/provider/bookmarks.provider.dart';
|
||||||
import 'package:linkdy/screens/bookmarks/ui/bookmark_item.dart';
|
import 'package:linkdy/widgets/bookmark_item.dart';
|
||||||
import 'package:linkdy/screens/bookmarks/ui/bookmark_form_modal.dart';
|
import 'package:linkdy/screens/bookmarks/ui/bookmark_form_modal.dart';
|
||||||
import 'package:linkdy/screens/bookmarks/ui/delete_bookmark_modal.dart';
|
import 'package:linkdy/screens/bookmarks/ui/delete_bookmark_modal.dart';
|
||||||
import 'package:linkdy/screens/bookmarks/ui/search_bookmarks.dart';
|
import 'package:linkdy/screens/bookmarks/ui/search_bookmarks.dart';
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||||||
|
|
||||||
import 'package:linkdy/screens/bookmarks/provider/search_bookmarks.provider.dart';
|
import 'package:linkdy/screens/bookmarks/provider/search_bookmarks.provider.dart';
|
||||||
import 'package:linkdy/screens/bookmarks/ui/bookmark_form_modal.dart';
|
import 'package:linkdy/screens/bookmarks/ui/bookmark_form_modal.dart';
|
||||||
import 'package:linkdy/screens/bookmarks/ui/bookmark_item.dart';
|
import 'package:linkdy/widgets/bookmark_item.dart';
|
||||||
import 'package:linkdy/screens/bookmarks/ui/delete_bookmark_modal.dart';
|
import 'package:linkdy/screens/bookmarks/ui/delete_bookmark_modal.dart';
|
||||||
import 'package:linkdy/widgets/enter_search_term_screen.dart';
|
import 'package:linkdy/widgets/enter_search_term_screen.dart';
|
||||||
import 'package:linkdy/widgets/no_data_screen.dart';
|
import 'package:linkdy/widgets/no_data_screen.dart';
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
|
||||||
import 'package:linkdy/screens/webview/ui/webview.dart';
|
import 'package:linkdy/screens/webview/ui/webview.dart';
|
||||||
import 'package:linkdy/screens/bookmarks/provider/favicon_loader.provider.dart';
|
|
||||||
import 'package:linkdy/screens/bookmarks/provider/common_functions.dart';
|
import 'package:linkdy/screens/bookmarks/provider/common_functions.dart';
|
||||||
import 'package:linkdy/screens/bookmarks/provider/bookmarks.provider.dart';
|
import 'package:linkdy/screens/bookmarks/provider/bookmarks.provider.dart';
|
||||||
import 'package:linkdy/screens/filtered_bookmarks/model/filtered_bookmarks.model.dart';
|
import 'package:linkdy/screens/filtered_bookmarks/model/filtered_bookmarks.model.dart';
|
||||||
@@ -36,7 +35,7 @@ FutureOr<void> tagBookmarksRequest(TagBookmarksRequestRef ref, Tag? tag, String?
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (bookmarksResult.successful == true) {
|
if (bookmarksResult.successful == true) {
|
||||||
ref.read(faviconStoreProvider.notifier).loadFavicons(bookmarksResult.content!.results!);
|
// ref.read(faviconStoreProvider.notifier).loadFavicons(bookmarksResult.content!.results!);
|
||||||
ref.read(filteredBookmarksProvider).bookmarks = bookmarksResult.content!.results!;
|
ref.read(filteredBookmarksProvider).bookmarks = bookmarksResult.content!.results!;
|
||||||
ref.read(filteredBookmarksProvider).maxNumber = bookmarksResult.content!.count!;
|
ref.read(filteredBookmarksProvider).maxNumber = bookmarksResult.content!.count!;
|
||||||
if (tag == null) ref.read(filteredBookmarksProvider).tag = tagResult!.content!;
|
if (tag == null) ref.read(filteredBookmarksProvider).tag = tagResult!.content!;
|
||||||
@@ -63,7 +62,6 @@ FutureOr<void> tagBookmarksRequestLoadMore(FilteredBookmarksRequestLoadMoreRef r
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (result.successful == true) {
|
if (result.successful == true) {
|
||||||
ref.read(faviconStoreProvider.notifier).loadFavicons(result.content!.results!);
|
|
||||||
provider.bookmarks = [...provider.bookmarks, ...result.content!.results!];
|
provider.bookmarks = [...provider.bookmarks, ...result.content!.results!];
|
||||||
provider.maxNumber = result.content!.count!;
|
provider.maxNumber = result.content!.count!;
|
||||||
provider.currentPage = provider.currentPage + 1;
|
provider.currentPage = provider.currentPage + 1;
|
||||||
@@ -85,7 +83,7 @@ FutureOr<void> filteredBookmarksRequest(FilteredBookmarksRequestRef ref, Filtere
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (bookmarksResult.successful == true) {
|
if (bookmarksResult.successful == true) {
|
||||||
ref.read(faviconStoreProvider.notifier).loadFavicons(bookmarksResult.content!.results!);
|
// ref.read(faviconStoreProvider.notifier).loadFavicons(bookmarksResult.content!.results!);
|
||||||
ref.read(filteredBookmarksProvider).bookmarks = bookmarksResult.content!.results!;
|
ref.read(filteredBookmarksProvider).bookmarks = bookmarksResult.content!.results!;
|
||||||
ref.read(filteredBookmarksProvider).maxNumber = bookmarksResult.content!.count!;
|
ref.read(filteredBookmarksProvider).maxNumber = bookmarksResult.content!.count!;
|
||||||
ref.read(filteredBookmarksProvider).currentPage = 0;
|
ref.read(filteredBookmarksProvider).currentPage = 0;
|
||||||
@@ -117,7 +115,7 @@ FutureOr<void> filteredBookmarksRequestLoadMore(TagBookmarksRequestLoadMoreRef r
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (result.successful == true) {
|
if (result.successful == true) {
|
||||||
ref.read(faviconStoreProvider.notifier).loadFavicons(result.content!.results!);
|
// ref.read(faviconStoreProvider.notifier).loadFavicons(result.content!.results!);
|
||||||
provider.bookmarks = [...provider.bookmarks, ...result.content!.results!];
|
provider.bookmarks = [...provider.bookmarks, ...result.content!.results!];
|
||||||
provider.maxNumber = result.content!.count!;
|
provider.maxNumber = result.content!.count!;
|
||||||
provider.currentPage = provider.currentPage + 1;
|
provider.currentPage = provider.currentPage + 1;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'package:flutter_hooks/flutter_hooks.dart';
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
|
||||||
import 'package:linkdy/screens/bookmarks/ui/bookmark_form_modal.dart';
|
import 'package:linkdy/screens/bookmarks/ui/bookmark_form_modal.dart';
|
||||||
import 'package:linkdy/screens/bookmarks/ui/bookmark_item.dart';
|
import 'package:linkdy/widgets/bookmark_item.dart';
|
||||||
import 'package:linkdy/screens/bookmarks/ui/delete_bookmark_modal.dart';
|
import 'package:linkdy/screens/bookmarks/ui/delete_bookmark_modal.dart';
|
||||||
import 'package:linkdy/screens/filtered_bookmarks/provider/filtered_bookmarks.provider.dart';
|
import 'package:linkdy/screens/filtered_bookmarks/provider/filtered_bookmarks.provider.dart';
|
||||||
import 'package:linkdy/widgets/error_screen.dart';
|
import 'package:linkdy/widgets/error_screen.dart';
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:linkdy/constants/urls.dart';
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
import 'package:skeletonizer/skeletonizer.dart';
|
import 'package:skeletonizer/skeletonizer.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:super_context_menu/super_context_menu.dart';
|
||||||
|
|
||||||
import 'package:linkdy/screens/bookmarks/provider/favicon_loader.provider.dart';
|
|
||||||
|
|
||||||
import 'package:linkdy/i18n/strings.g.dart';
|
import 'package:linkdy/i18n/strings.g.dart';
|
||||||
import 'package:linkdy/models/data/bookmarks.dart';
|
import 'package:linkdy/models/data/bookmarks.dart';
|
||||||
import 'package:linkdy/providers/app_status.provider.dart';
|
import 'package:linkdy/providers/app_status.provider.dart';
|
||||||
import 'package:linkdy/utils/date_to_string.dart';
|
import 'package:linkdy/utils/date_to_string.dart';
|
||||||
import 'package:super_context_menu/super_context_menu.dart';
|
|
||||||
|
|
||||||
// Wait until the context menu close animation animation finishes
|
// Wait until the context menu close animation animation finishes
|
||||||
Duration _durationTime = const Duration(milliseconds: 150);
|
Duration _durationTime = const Duration(milliseconds: 150);
|
||||||
@@ -136,8 +134,13 @@ class BookmarkItem extends ConsumerWidget {
|
|||||||
if (ref.watch(appStatusProvider).showFavicon == true)
|
if (ref.watch(appStatusProvider).showFavicon == true)
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(right: 8),
|
padding: const EdgeInsets.only(right: 8),
|
||||||
child: ref.watch(faviconStoreProvider).loadingFavicons == true
|
child: Image.network(
|
||||||
? ClipRRect(
|
Urls.gstatic(bookmark.url),
|
||||||
|
width: 16,
|
||||||
|
height: 16,
|
||||||
|
loadingBuilder: (context, child, loadingProgress) {
|
||||||
|
if (loadingProgress != null) {
|
||||||
|
return ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(4),
|
borderRadius: BorderRadius.circular(4),
|
||||||
child: Skeletonizer(
|
child: Skeletonizer(
|
||||||
enabled: true,
|
enabled: true,
|
||||||
@@ -148,59 +151,11 @@ class BookmarkItem extends ConsumerWidget {
|
|||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
);
|
||||||
: Builder(
|
}
|
||||||
builder: (context) {
|
return child;
|
||||||
final faviconItem = ref
|
},
|
||||||
.watch(faviconStoreProvider)
|
),
|
||||||
.favicons
|
|
||||||
.where((f) => f.url == bookmark.url!)
|
|
||||||
.toList();
|
|
||||||
if (faviconItem.isEmpty) return const SizedBox();
|
|
||||||
if (faviconItem[0].isSvg == true) {
|
|
||||||
return SvgPicture.network(
|
|
||||||
faviconItem[0].favicon,
|
|
||||||
width: 16,
|
|
||||||
height: 16,
|
|
||||||
placeholderBuilder: (context) => ClipRRect(
|
|
||||||
borderRadius: BorderRadius.circular(4),
|
|
||||||
child: Skeletonizer(
|
|
||||||
enabled: true,
|
|
||||||
ignoreContainers: true,
|
|
||||||
child: Container(
|
|
||||||
width: 16,
|
|
||||||
height: 16,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return Image.network(
|
|
||||||
faviconItem[0].favicon,
|
|
||||||
width: 16,
|
|
||||||
height: 16,
|
|
||||||
loadingBuilder: (context, child, loadingProgress) {
|
|
||||||
if (loadingProgress != null) {
|
|
||||||
return ClipRRect(
|
|
||||||
borderRadius: BorderRadius.circular(4),
|
|
||||||
child: Skeletonizer(
|
|
||||||
enabled: true,
|
|
||||||
ignoreContainers: true,
|
|
||||||
child: Container(
|
|
||||||
width: 16,
|
|
||||||
height: 16,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return child;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
Reference in New Issue
Block a user