added fading scroll; widget refactorings
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:fading_scroll/fading_scroll.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
@@ -82,377 +83,386 @@ class SettingsScreen extends HookConsumerWidget {
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Settings')),
|
||||
body: ListView(
|
||||
children: [
|
||||
_buildSection(theme, 'Kagi'),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 16,
|
||||
right: 16,
|
||||
bottom: 8,
|
||||
),
|
||||
child: TextField(
|
||||
enableIMEPersonalizedLearning: false,
|
||||
autocorrect: false,
|
||||
controller: kagiSessionTextController,
|
||||
obscureText: hideSessionText.value,
|
||||
decoration: InputDecoration(
|
||||
label: const Text('Kagi Session Token'),
|
||||
hintText: 'https://kagi.com/search?token=...',
|
||||
helperMaxLines: 2,
|
||||
helper: Markdown(
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.zero,
|
||||
data:
|
||||
'You can visit your [Kagi Account Settings](user_details) to get your Session Link.',
|
||||
onTapLink: (text, href, title) async {
|
||||
if (href == 'user_details') {
|
||||
await ui_helper.launchUrlFeedback(
|
||||
context,
|
||||
Uri.parse(
|
||||
'https://kagi.com/settings?p=user_details',
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
body: FadingScroll(
|
||||
fadingSize: 25,
|
||||
builder: (context, controller) {
|
||||
return ListView(
|
||||
controller: controller,
|
||||
children: [
|
||||
_buildSection(theme, 'Kagi'),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 16,
|
||||
right: 16,
|
||||
bottom: 8,
|
||||
),
|
||||
suffixIcon: IconButton(
|
||||
onPressed: () {
|
||||
hideSessionText.value = !hideSessionText.value;
|
||||
},
|
||||
icon: Icon(
|
||||
hideSessionText.value
|
||||
? Icons.visibility
|
||||
: Icons.visibility_off,
|
||||
child: TextField(
|
||||
enableIMEPersonalizedLearning: false,
|
||||
autocorrect: false,
|
||||
controller: kagiSessionTextController,
|
||||
obscureText: hideSessionText.value,
|
||||
decoration: InputDecoration(
|
||||
label: const Text('Kagi Session Token'),
|
||||
hintText: 'https://kagi.com/search?token=...',
|
||||
helperMaxLines: 2,
|
||||
helper: Markdown(
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.zero,
|
||||
data:
|
||||
'You can visit your [Kagi Account Settings](user_details) to get your Session Link.',
|
||||
onTapLink: (text, href, title) async {
|
||||
if (href == 'user_details') {
|
||||
await ui_helper.launchUrlFeedback(
|
||||
context,
|
||||
Uri.parse(
|
||||
'https://kagi.com/settings?p=user_details',
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
suffixIcon: IconButton(
|
||||
onPressed: () {
|
||||
hideSessionText.value = !hideSessionText.value;
|
||||
},
|
||||
icon: Icon(
|
||||
hideSessionText.value
|
||||
? Icons.visibility
|
||||
: Icons.visibility_off,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SwitchListTile.adaptive(
|
||||
title: const Text('Show Early Access Features'),
|
||||
subtitle: const Text(
|
||||
"Displays Kagi's early access features in the UI. As an Ultimate subscriber, you will likely want to have this enabled.",
|
||||
),
|
||||
value: settings.showEarlyAccessFeatures,
|
||||
onChanged: (value) async {
|
||||
await ref.read(saveSettingsControllerProvider.notifier).save(
|
||||
(currentSettings) =>
|
||||
currentSettings.copyWith.showEarlyAccessFeatures(value),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
_buildSection(theme, 'General'),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Theme',
|
||||
style: theme.textTheme.bodyLarge,
|
||||
SwitchListTile.adaptive(
|
||||
title: const Text('Show Early Access Features'),
|
||||
subtitle: const Text(
|
||||
"Displays Kagi's early access features in the UI. As an Ultimate subscriber, you will likely want to have this enabled.",
|
||||
),
|
||||
Center(
|
||||
child: SegmentedButton<ThemeMode>(
|
||||
segments: const [
|
||||
ButtonSegment(
|
||||
value: ThemeMode.system,
|
||||
icon: Icon(Icons.brightness_auto),
|
||||
label: Text('System'),
|
||||
value: settings.showEarlyAccessFeatures,
|
||||
onChanged: (value) async {
|
||||
await ref.read(saveSettingsControllerProvider.notifier).save(
|
||||
(currentSettings) => currentSettings.copyWith
|
||||
.showEarlyAccessFeatures(value),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
_buildSection(theme, 'General'),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Theme',
|
||||
style: theme.textTheme.bodyLarge,
|
||||
),
|
||||
Center(
|
||||
child: SegmentedButton<ThemeMode>(
|
||||
segments: const [
|
||||
ButtonSegment(
|
||||
value: ThemeMode.system,
|
||||
icon: Icon(Icons.brightness_auto),
|
||||
label: Text('System'),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: ThemeMode.light,
|
||||
icon: Icon(Icons.light_mode),
|
||||
label: Text('Light'),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: ThemeMode.dark,
|
||||
icon: Icon(Icons.dark_mode),
|
||||
label: Text('Dark'),
|
||||
),
|
||||
],
|
||||
selected: {settings.themeMode},
|
||||
onSelectionChanged: (value) async {
|
||||
await ref
|
||||
.read(saveSettingsControllerProvider.notifier)
|
||||
.save(
|
||||
(currentSettings) => currentSettings.copyWith
|
||||
.themeMode(value.first),
|
||||
);
|
||||
},
|
||||
),
|
||||
ButtonSegment(
|
||||
value: ThemeMode.light,
|
||||
icon: Icon(Icons.light_mode),
|
||||
label: Text('Light'),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: ThemeMode.dark,
|
||||
icon: Icon(Icons.dark_mode),
|
||||
label: Text('Dark'),
|
||||
),
|
||||
],
|
||||
selected: {settings.themeMode},
|
||||
onSelectionChanged: (value) async {
|
||||
await ref
|
||||
.read(saveSettingsControllerProvider.notifier)
|
||||
.save(
|
||||
(currentSettings) =>
|
||||
currentSettings.copyWith.themeMode(value.first),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SwitchListTile.adaptive(
|
||||
title: const Text('Incognito Mode'),
|
||||
subtitle: const Text(
|
||||
'Deletes all browsing data upon app restart for enhanced privacy.',
|
||||
),
|
||||
value: settings.incognitoMode,
|
||||
onChanged: (value) async {
|
||||
await ref.read(saveSettingsControllerProvider.notifier).save(
|
||||
(currentSettings) =>
|
||||
currentSettings.copyWith.incognitoMode(value),
|
||||
);
|
||||
},
|
||||
),
|
||||
SwitchListTile.adaptive(
|
||||
title: const Text('Enable JavaScript'),
|
||||
subtitle: const Text(
|
||||
'While turning off JavaScript boosts security, privacy, and speed, it may cause some sites to not work as intended.',
|
||||
),
|
||||
value: settings.enableJavascript,
|
||||
onChanged: (value) async {
|
||||
await ref.read(saveSettingsControllerProvider.notifier).save(
|
||||
(currentSettings) =>
|
||||
currentSettings.copyWith.enableJavascript(value),
|
||||
);
|
||||
},
|
||||
),
|
||||
SwitchListTile.adaptive(
|
||||
title: const Text('Block HTTP Protocol'),
|
||||
subtitle: const Text(
|
||||
'Prevents the loading of unsecure HTTP content. When enabled, only secure HTTPS content is allowed.',
|
||||
),
|
||||
value: settings.blockHttpProtocol,
|
||||
onChanged: (value) async {
|
||||
await ref.read(saveSettingsControllerProvider.notifier).save(
|
||||
(currentSettings) =>
|
||||
currentSettings.copyWith.blockHttpProtocol(value),
|
||||
);
|
||||
},
|
||||
),
|
||||
SwitchListTile.adaptive(
|
||||
title: const Text('Launch Links Externally'),
|
||||
subtitle: const Text(
|
||||
'Opens all links (except for kagi.com) in your default browser.',
|
||||
),
|
||||
value: settings.launchUrlExternal,
|
||||
onChanged: (value) async {
|
||||
await ref.read(saveSettingsControllerProvider.notifier).save(
|
||||
(currentSettings) =>
|
||||
currentSettings.copyWith.launchUrlExternal(value),
|
||||
);
|
||||
},
|
||||
),
|
||||
SwitchListTile.adaptive(
|
||||
title: const Text('Enable Reader Mode'),
|
||||
subtitle: const Text(
|
||||
'Optional browser app bar tool that extracts and simplifies web pages for improved readability by removing ads, sidebars, and other non-essential elements.',
|
||||
),
|
||||
value: settings.enableReadability,
|
||||
onChanged: (value) async {
|
||||
await ref.read(saveSettingsControllerProvider.notifier).save(
|
||||
(currentSettings) =>
|
||||
currentSettings.copyWith.enableReadability(value),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
_buildSection(theme, 'Appearance'),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const CustomListTile(
|
||||
title: 'Quick Action',
|
||||
subtitle:
|
||||
'Appears in the browser app bar between website title and tab count.',
|
||||
),
|
||||
SwitchListTile.adaptive(
|
||||
title: const Text('Incognito Mode'),
|
||||
subtitle: const Text(
|
||||
'Deletes all browsing data upon app restart for enhanced privacy.',
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: Center(
|
||||
child: SegmentedButton<KagiTool>(
|
||||
emptySelectionAllowed: true,
|
||||
segments: [
|
||||
ButtonSegment(
|
||||
value: KagiTool.search,
|
||||
icon: Icon(KagiTool.search.icon),
|
||||
label: const Text('Search'),
|
||||
value: settings.incognitoMode,
|
||||
onChanged: (value) async {
|
||||
await ref.read(saveSettingsControllerProvider.notifier).save(
|
||||
(currentSettings) =>
|
||||
currentSettings.copyWith.incognitoMode(value),
|
||||
);
|
||||
},
|
||||
),
|
||||
SwitchListTile.adaptive(
|
||||
title: const Text('Enable JavaScript'),
|
||||
subtitle: const Text(
|
||||
'While turning off JavaScript boosts security, privacy, and speed, it may cause some sites to not work as intended.',
|
||||
),
|
||||
value: settings.enableJavascript,
|
||||
onChanged: (value) async {
|
||||
await ref.read(saveSettingsControllerProvider.notifier).save(
|
||||
(currentSettings) =>
|
||||
currentSettings.copyWith.enableJavascript(value),
|
||||
);
|
||||
},
|
||||
),
|
||||
SwitchListTile.adaptive(
|
||||
title: const Text('Block HTTP Protocol'),
|
||||
subtitle: const Text(
|
||||
'Prevents the loading of unsecure HTTP content. When enabled, only secure HTTPS content is allowed.',
|
||||
),
|
||||
value: settings.blockHttpProtocol,
|
||||
onChanged: (value) async {
|
||||
await ref.read(saveSettingsControllerProvider.notifier).save(
|
||||
(currentSettings) =>
|
||||
currentSettings.copyWith.blockHttpProtocol(value),
|
||||
);
|
||||
},
|
||||
),
|
||||
SwitchListTile.adaptive(
|
||||
title: const Text('Launch Links Externally'),
|
||||
subtitle: const Text(
|
||||
'Opens all links (except for kagi.com) in your default browser.',
|
||||
),
|
||||
value: settings.launchUrlExternal,
|
||||
onChanged: (value) async {
|
||||
await ref.read(saveSettingsControllerProvider.notifier).save(
|
||||
(currentSettings) =>
|
||||
currentSettings.copyWith.launchUrlExternal(value),
|
||||
);
|
||||
},
|
||||
),
|
||||
SwitchListTile.adaptive(
|
||||
title: const Text('Enable Reader Mode'),
|
||||
subtitle: const Text(
|
||||
'Optional browser app bar tool that extracts and simplifies web pages for improved readability by removing ads, sidebars, and other non-essential elements.',
|
||||
),
|
||||
value: settings.enableReadability,
|
||||
onChanged: (value) async {
|
||||
await ref.read(saveSettingsControllerProvider.notifier).save(
|
||||
(currentSettings) =>
|
||||
currentSettings.copyWith.enableReadability(value),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
_buildSection(theme, 'Appearance'),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const CustomListTile(
|
||||
title: 'Quick Action',
|
||||
subtitle:
|
||||
'Appears in the browser app bar between website title and tab count.',
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: Center(
|
||||
child: SegmentedButton<KagiTool>(
|
||||
emptySelectionAllowed: true,
|
||||
segments: [
|
||||
ButtonSegment(
|
||||
value: KagiTool.search,
|
||||
icon: Icon(KagiTool.search.icon),
|
||||
label: const Text('Search'),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: KagiTool.summarizer,
|
||||
icon: Icon(KagiTool.summarizer.icon),
|
||||
label: const Text('Summarizer'),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: KagiTool.assistant,
|
||||
icon: Icon(KagiTool.assistant.icon),
|
||||
label: const Text('Assistant'),
|
||||
),
|
||||
],
|
||||
selected: {
|
||||
if (settings.quickAction != null)
|
||||
settings.quickAction!,
|
||||
},
|
||||
onSelectionChanged: (value) async {
|
||||
await ref
|
||||
.read(saveSettingsControllerProvider.notifier)
|
||||
.save(
|
||||
(currentSettings) =>
|
||||
currentSettings.copyWith.quickAction(
|
||||
value.isNotEmpty ? value.first : null,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
ButtonSegment(
|
||||
value: KagiTool.summarizer,
|
||||
icon: Icon(KagiTool.summarizer.icon),
|
||||
label: const Text('Summarizer'),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: KagiTool.assistant,
|
||||
icon: Icon(KagiTool.assistant.icon),
|
||||
label: const Text('Assistant'),
|
||||
),
|
||||
],
|
||||
selected: {
|
||||
if (settings.quickAction != null) settings.quickAction!,
|
||||
},
|
||||
onSelectionChanged: (value) async {
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SwitchListTile.adaptive(
|
||||
title: const Text('Quick Action - STT'),
|
||||
subtitle: const Text(
|
||||
'Quick option will open with speech-to-text input.',
|
||||
),
|
||||
value: settings.quickActionVoiceInput,
|
||||
onChanged: (settings.quickAction != null)
|
||||
? (value) async {
|
||||
await ref
|
||||
.read(saveSettingsControllerProvider.notifier)
|
||||
.save(
|
||||
(currentSettings) =>
|
||||
currentSettings.copyWith.quickAction(
|
||||
value.isNotEmpty ? value.first : null,
|
||||
),
|
||||
(currentSettings) => currentSettings.copyWith
|
||||
.quickActionVoiceInput(value),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SwitchListTile.adaptive(
|
||||
title: const Text('Quick Action - STT'),
|
||||
subtitle: const Text(
|
||||
'Quick option will open with speech-to-text input.',
|
||||
),
|
||||
value: settings.quickActionVoiceInput,
|
||||
onChanged: (settings.quickAction != null)
|
||||
? (value) async {
|
||||
await ref
|
||||
.read(saveSettingsControllerProvider.notifier)
|
||||
.save(
|
||||
(currentSettings) => currentSettings.copyWith
|
||||
.quickActionVoiceInput(value),
|
||||
);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
_buildSection(theme, 'Content Blocking'),
|
||||
SwitchListTile.adaptive(
|
||||
title: const Text('Enable Content Blocking'),
|
||||
subtitle: const Text(
|
||||
'Prevents access to unwanted websites and ads, as defined in the selected lists below.',
|
||||
),
|
||||
value: settings.enableContentBlocking,
|
||||
onChanged: (value) async {
|
||||
await ref.read(saveSettingsControllerProvider.notifier).save(
|
||||
(currentSettings) =>
|
||||
currentSettings.copyWith.enableContentBlocking(value),
|
||||
);
|
||||
},
|
||||
),
|
||||
_buildSubSection(theme, 'Lists'),
|
||||
HostListTile(
|
||||
enableContentBlocking: settings.enableContentBlocking,
|
||||
enableHostLists: settings.enableHostList,
|
||||
source: HostSource.stevenBlackUnified,
|
||||
title: 'StevenBlack: Unified',
|
||||
subtitle: 'Blocks domains containing adware, malware and trackers.',
|
||||
),
|
||||
HostListTile(
|
||||
enableContentBlocking: settings.enableContentBlocking,
|
||||
enableHostLists: settings.enableHostList,
|
||||
source: HostSource.stevenBlackFakeNews,
|
||||
title: 'StevenBlack: Fake News',
|
||||
subtitle: 'Blocks domains known for spreading fake news.',
|
||||
),
|
||||
HostListTile(
|
||||
enableContentBlocking: settings.enableContentBlocking,
|
||||
enableHostLists: settings.enableHostList,
|
||||
source: HostSource.stevenBlackGambling,
|
||||
title: 'StevenBlack: Gambling',
|
||||
subtitle: 'Blocks domains related to gambling.',
|
||||
),
|
||||
HostListTile(
|
||||
enableContentBlocking: settings.enableContentBlocking,
|
||||
enableHostLists: settings.enableHostList,
|
||||
source: HostSource.stevenBlackPorn,
|
||||
title: 'StevenBlack: Porn',
|
||||
subtitle: 'Blocks adult content domains.',
|
||||
),
|
||||
HostListTile(
|
||||
enableContentBlocking: settings.enableContentBlocking,
|
||||
enableHostLists: settings.enableHostList,
|
||||
source: HostSource.stevenBlackSocial,
|
||||
title: 'StevenBlack: Social',
|
||||
subtitle: 'Blocks social media domains.',
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
_buildSection(theme, 'Bangs'),
|
||||
CustomListTile(
|
||||
title: 'Bang Frequencies',
|
||||
subtitle: 'Tracked usage for Bang recommendations',
|
||||
suffix: FilledButton.icon(
|
||||
onPressed: () async {
|
||||
await ref
|
||||
.read(bangDataRepositoryProvider.notifier)
|
||||
.resetFrequencies();
|
||||
},
|
||||
icon: const Icon(Icons.delete),
|
||||
label: const Text('Clear'),
|
||||
),
|
||||
),
|
||||
Consumer(
|
||||
builder: (context, ref, child) {
|
||||
final size = ref.watch(
|
||||
bangIconCacheSizeMegabytesProvider.select(
|
||||
(value) => value.valueOrNull,
|
||||
),
|
||||
);
|
||||
|
||||
return CustomListTile(
|
||||
title: 'Icon Cache',
|
||||
subtitle: 'Stored favicons for Bangs',
|
||||
content: Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: DefaultTextStyle(
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: DefaultTextStyle.of(context).style,
|
||||
),
|
||||
child: Table(
|
||||
columnWidths: const {0: FixedColumnWidth(100)},
|
||||
children: [
|
||||
TableRow(
|
||||
children: [
|
||||
const Text('Size'),
|
||||
Text('${size?.toStringAsFixed(2) ?? 0} MB'),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
}
|
||||
: null,
|
||||
),
|
||||
_buildSection(theme, 'Content Blocking'),
|
||||
SwitchListTile.adaptive(
|
||||
title: const Text('Enable Content Blocking'),
|
||||
subtitle: const Text(
|
||||
'Prevents access to unwanted websites and ads, as defined in the selected lists below.',
|
||||
),
|
||||
value: settings.enableContentBlocking,
|
||||
onChanged: (value) async {
|
||||
await ref.read(saveSettingsControllerProvider.notifier).save(
|
||||
(currentSettings) => currentSettings.copyWith
|
||||
.enableContentBlocking(value),
|
||||
);
|
||||
},
|
||||
),
|
||||
_buildSubSection(theme, 'Lists'),
|
||||
HostListTile(
|
||||
enableContentBlocking: settings.enableContentBlocking,
|
||||
enableHostLists: settings.enableHostList,
|
||||
source: HostSource.stevenBlackUnified,
|
||||
title: 'StevenBlack: Unified',
|
||||
subtitle:
|
||||
'Blocks domains containing adware, malware and trackers.',
|
||||
),
|
||||
HostListTile(
|
||||
enableContentBlocking: settings.enableContentBlocking,
|
||||
enableHostLists: settings.enableHostList,
|
||||
source: HostSource.stevenBlackFakeNews,
|
||||
title: 'StevenBlack: Fake News',
|
||||
subtitle: 'Blocks domains known for spreading fake news.',
|
||||
),
|
||||
HostListTile(
|
||||
enableContentBlocking: settings.enableContentBlocking,
|
||||
enableHostLists: settings.enableHostList,
|
||||
source: HostSource.stevenBlackGambling,
|
||||
title: 'StevenBlack: Gambling',
|
||||
subtitle: 'Blocks domains related to gambling.',
|
||||
),
|
||||
HostListTile(
|
||||
enableContentBlocking: settings.enableContentBlocking,
|
||||
enableHostLists: settings.enableHostList,
|
||||
source: HostSource.stevenBlackPorn,
|
||||
title: 'StevenBlack: Porn',
|
||||
subtitle: 'Blocks adult content domains.',
|
||||
),
|
||||
HostListTile(
|
||||
enableContentBlocking: settings.enableContentBlocking,
|
||||
enableHostLists: settings.enableHostList,
|
||||
source: HostSource.stevenBlackSocial,
|
||||
title: 'StevenBlack: Social',
|
||||
subtitle: 'Blocks social media domains.',
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
_buildSection(theme, 'Bangs'),
|
||||
CustomListTile(
|
||||
title: 'Bang Frequencies',
|
||||
subtitle: 'Tracked usage for Bang recommendations',
|
||||
suffix: FilledButton.icon(
|
||||
onPressed: () async {
|
||||
await ref
|
||||
.read(bangDataRepositoryProvider.notifier)
|
||||
.clearIconData();
|
||||
.resetFrequencies();
|
||||
},
|
||||
icon: const Icon(Icons.delete),
|
||||
label: const Text('Clear'),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
_buildSubSection(theme, 'Repositories'),
|
||||
const BangGroupListTile(
|
||||
group: BangGroup.general,
|
||||
title: 'General Bangs',
|
||||
subtitle: 'Automatically syncs every 7 days',
|
||||
),
|
||||
const BangGroupListTile(
|
||||
group: BangGroup.assistant,
|
||||
title: 'Assistant Bangs',
|
||||
subtitle: 'Automatically syncs every 7 days',
|
||||
),
|
||||
const BangGroupListTile(
|
||||
group: BangGroup.kagi,
|
||||
title: 'Kagi Bangs',
|
||||
subtitle: 'Automatically syncs every 7 days',
|
||||
),
|
||||
],
|
||||
),
|
||||
Consumer(
|
||||
builder: (context, ref, child) {
|
||||
final size = ref.watch(
|
||||
bangIconCacheSizeMegabytesProvider.select(
|
||||
(value) => value.valueOrNull,
|
||||
),
|
||||
);
|
||||
|
||||
return CustomListTile(
|
||||
title: 'Icon Cache',
|
||||
subtitle: 'Stored favicons for Bangs',
|
||||
content: Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: DefaultTextStyle(
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: DefaultTextStyle.of(context).style,
|
||||
),
|
||||
child: Table(
|
||||
columnWidths: const {0: FixedColumnWidth(100)},
|
||||
children: [
|
||||
TableRow(
|
||||
children: [
|
||||
const Text('Size'),
|
||||
Text('${size?.toStringAsFixed(2) ?? 0} MB'),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
suffix: FilledButton.icon(
|
||||
onPressed: () async {
|
||||
await ref
|
||||
.read(bangDataRepositoryProvider.notifier)
|
||||
.clearIconData();
|
||||
},
|
||||
icon: const Icon(Icons.delete),
|
||||
label: const Text('Clear'),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
_buildSubSection(theme, 'Repositories'),
|
||||
const BangGroupListTile(
|
||||
group: BangGroup.general,
|
||||
title: 'General Bangs',
|
||||
subtitle: 'Automatically syncs every 7 days',
|
||||
),
|
||||
const BangGroupListTile(
|
||||
group: BangGroup.assistant,
|
||||
title: 'Assistant Bangs',
|
||||
subtitle: 'Automatically syncs every 7 days',
|
||||
),
|
||||
const BangGroupListTile(
|
||||
group: BangGroup.kagi,
|
||||
title: 'Kagi Bangs',
|
||||
subtitle: 'Automatically syncs every 7 days',
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user