Setting disable favicon and skeleton loader
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:favicon/favicon.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:skeletonizer/skeletonizer.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
import 'package:linkdy/models/data/bookmarks.dart';
|
||||
@@ -39,29 +40,46 @@ class BookmarkItem extends ConsumerWidget {
|
||||
padding: const EdgeInsets.only(bottom: 4),
|
||||
child: Row(
|
||||
children: [
|
||||
FutureBuilder(
|
||||
future: FaviconFinder.getBest(bookmark.url!),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.data == null) return const SizedBox();
|
||||
return Row(
|
||||
children: [
|
||||
if (snapshot.data!.url.contains("svg"))
|
||||
SvgPicture.network(
|
||||
snapshot.data!.url,
|
||||
width: 16,
|
||||
height: 16,
|
||||
if (ref.watch(appStatusProvider).showFavicon == true)
|
||||
FutureBuilder(
|
||||
future: FaviconFinder.getBest(bookmark.url!),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData == false) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(right: 8),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
child: Skeletonizer(
|
||||
enabled: true,
|
||||
ignoreContainers: true,
|
||||
child: Container(
|
||||
width: 16,
|
||||
height: 16,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (!snapshot.data!.url.contains("svg"))
|
||||
Image.network(
|
||||
snapshot.data!.url,
|
||||
width: 16,
|
||||
height: 16,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
return Row(
|
||||
children: [
|
||||
if (snapshot.data!.url.contains("svg"))
|
||||
SvgPicture.network(
|
||||
snapshot.data!.url,
|
||||
width: 16,
|
||||
height: 16,
|
||||
),
|
||||
if (!snapshot.data!.url.contains("svg"))
|
||||
Image.network(
|
||||
snapshot.data!.url,
|
||||
width: 16,
|
||||
height: 16,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
validateStrings(bookmark.title, bookmark.websiteTitle),
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:linkdy/i18n/strings.g.dart';
|
||||
import 'package:linkdy/screens/settings/ui/general_settings/disconnect_modal.dart';
|
||||
|
||||
import 'package:linkdy/providers/app_status_provider.dart';
|
||||
import 'package:linkdy/widgets/section_label.dart';
|
||||
|
||||
class GeneralSettings extends ConsumerWidget {
|
||||
const GeneralSettings({Key? key}) : super(key: key);
|
||||
@@ -17,13 +18,23 @@ class GeneralSettings extends ConsumerWidget {
|
||||
),
|
||||
body: ListView(
|
||||
children: [
|
||||
SectionLabel(label: t.settings.generalSettings.bookmarks),
|
||||
SwitchListTile(
|
||||
title: Text(t.settings.generalSettings.showFavicon),
|
||||
subtitle: Text(t.settings.generalSettings.showFaviconDescription),
|
||||
value: ref.watch(appStatusProvider).showFavicon,
|
||||
onChanged: ref.read(appStatusProvider.notifier).setShowFavicon,
|
||||
),
|
||||
SwitchListTile(
|
||||
title: Text(t.settings.generalSettings.useInAppBrowser),
|
||||
subtitle: Text(t.settings.generalSettings.useInAppBrowserDescription),
|
||||
value: ref.watch(appStatusProvider).useInAppBrowser,
|
||||
onChanged: ref.read(appStatusProvider.notifier).setUseInAppBrowser,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 16),
|
||||
child: Divider(),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
|
||||
Reference in New Issue
Block a user