added fading scroll; widget refactorings
This commit is contained in:
@@ -10,7 +10,7 @@ FutureOr<bool> widgetPinnable(WidgetPinnableRef ref) async {
|
|||||||
return await HomeWidget.isRequestPinWidgetSupported() ?? false;
|
return await HomeWidget.isRequestPinWidgetSupported() ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@riverpod
|
@Riverpod()
|
||||||
Raw<Stream<ReceivedParameter>> appWidgetLaunchStream(
|
Raw<Stream<ReceivedParameter>> appWidgetLaunchStream(
|
||||||
AppWidgetLaunchStreamRef ref,
|
AppWidgetLaunchStreamRef ref,
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ final widgetPinnableProvider = FutureProvider<bool>.internal(
|
|||||||
|
|
||||||
typedef WidgetPinnableRef = FutureProviderRef<bool>;
|
typedef WidgetPinnableRef = FutureProviderRef<bool>;
|
||||||
String _$appWidgetLaunchStreamHash() =>
|
String _$appWidgetLaunchStreamHash() =>
|
||||||
r'1cda869c62e270be74efcb9b052bc498cfbd98a5';
|
r'8c5e21346d492f89f546b4e32135a283719e70e1';
|
||||||
|
|
||||||
/// See also [appWidgetLaunchStream].
|
/// See also [appWidgetLaunchStream].
|
||||||
@ProviderFor(appWidgetLaunchStream)
|
@ProviderFor(appWidgetLaunchStream)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:fading_scroll/fading_scroll.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
@@ -26,55 +27,61 @@ class BangCategoriesScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
body: categoriesAsync.when(
|
body: categoriesAsync.when(
|
||||||
data: (categories) {
|
data: (categories) {
|
||||||
return SingleChildScrollView(
|
return FadingScroll(
|
||||||
child: HookBuilder(
|
fadingSize: 25,
|
||||||
builder: (context) {
|
builder: (context, controller) {
|
||||||
final expanded = useState(<String>{});
|
return SingleChildScrollView(
|
||||||
|
controller: controller,
|
||||||
|
child: HookBuilder(
|
||||||
|
builder: (context) {
|
||||||
|
final expanded = useState(<String>{});
|
||||||
|
|
||||||
return ExpansionPanelList(
|
return ExpansionPanelList(
|
||||||
expansionCallback: (index, expand) {
|
expansionCallback: (index, expand) {
|
||||||
final key = categories.keys.elementAt(index);
|
final key = categories.keys.elementAt(index);
|
||||||
if (!expanded.value.contains(key)) {
|
if (!expanded.value.contains(key)) {
|
||||||
expanded.value = {...expanded.value, key};
|
expanded.value = {...expanded.value, key};
|
||||||
} else {
|
} else {
|
||||||
expanded.value = {...expanded.value}..remove(key);
|
expanded.value = {...expanded.value}..remove(key);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
children: categories.entries
|
children: categories.entries
|
||||||
.map(
|
.map(
|
||||||
(category) => ExpansionPanel(
|
(category) => ExpansionPanel(
|
||||||
canTapOnHeader: true,
|
canTapOnHeader: true,
|
||||||
isExpanded: expanded.value.contains(category.key),
|
isExpanded: expanded.value.contains(category.key),
|
||||||
headerBuilder: (context, isExpanded) => ListTile(
|
headerBuilder: (context, isExpanded) => ListTile(
|
||||||
title: Text(category.key),
|
title: Text(category.key),
|
||||||
),
|
),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: const EdgeInsets.only(left: 16.0),
|
padding: const EdgeInsets.only(left: 16.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: category.value
|
children: category.value
|
||||||
.map(
|
.map(
|
||||||
(subCategory) => ListTile(
|
(subCategory) => ListTile(
|
||||||
title: Text(subCategory),
|
title: Text(subCategory),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await context.push(
|
await context.push(
|
||||||
BangSubCategoryRoute(
|
BangSubCategoryRoute(
|
||||||
category: category.key,
|
category: category.key,
|
||||||
subCategory: subCategory,
|
subCategory: subCategory,
|
||||||
).location,
|
).location,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
),
|
.toList(),
|
||||||
)
|
);
|
||||||
.toList(),
|
},
|
||||||
);
|
),
|
||||||
},
|
);
|
||||||
),
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
error: (error, stackTrace) => Center(
|
error: (error, stackTrace) => Center(
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:fading_scroll/fading_scroll.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
@@ -61,24 +62,30 @@ class BangSearchScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
body: resultsAsync.when(
|
body: resultsAsync.when(
|
||||||
skipLoadingOnReload: true,
|
skipLoadingOnReload: true,
|
||||||
data: (bangs) => ListView.builder(
|
data: (bangs) => FadingScroll(
|
||||||
itemCount: bangs.length,
|
fadingSize: 25,
|
||||||
itemBuilder: (context, index) {
|
builder: (context, controller) {
|
||||||
final bang = bangs[index];
|
return ListView.builder(
|
||||||
return BangDetails(
|
controller: controller,
|
||||||
bang,
|
itemCount: bangs.length,
|
||||||
onTap: () {
|
itemBuilder: (context, index) {
|
||||||
ref
|
final bang = bangs[index];
|
||||||
.read(selectedBangTriggerProvider().notifier)
|
return BangDetails(
|
||||||
.setTrigger(bang.trigger);
|
bang,
|
||||||
|
onTap: () {
|
||||||
|
ref
|
||||||
|
.read(selectedBangTriggerProvider().notifier)
|
||||||
|
.setTrigger(bang.trigger);
|
||||||
|
|
||||||
if (ref.read(bottomSheetProvider) is! CreateTab) {
|
if (ref.read(bottomSheetProvider) is! CreateTab) {
|
||||||
ref.read(bottomSheetProvider.notifier).show(
|
ref.read(bottomSheetProvider.notifier).show(
|
||||||
CreateTab(preferredTool: KagiTool.search),
|
CreateTab(preferredTool: KagiTool.search),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
context.go(KagiRoute().location);
|
context.go(KagiRoute().location);
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:fading_scroll/fading_scroll.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
@@ -29,19 +30,26 @@ class ChatArchiveListScreen extends HookConsumerWidget {
|
|||||||
enabled: chatsAsync.isLoading,
|
enabled: chatsAsync.isLoading,
|
||||||
child: chatsAsync.when(
|
child: chatsAsync.when(
|
||||||
data: (chats) {
|
data: (chats) {
|
||||||
return ListView.builder(
|
return FadingScroll(
|
||||||
itemCount: chats.length,
|
fadingSize: 25,
|
||||||
itemBuilder: (context, index) {
|
builder: (context, controller) {
|
||||||
final chat = chats[index];
|
return ListView.builder(
|
||||||
|
controller: controller,
|
||||||
|
itemCount: chats.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final chat = chats[index];
|
||||||
|
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(chat.toString()),
|
title: Text(chat.toString()),
|
||||||
subtitle: (chat.dateTime != null)
|
subtitle: (chat.dateTime != null)
|
||||||
? Text(chat.dateTime!.formatWithMinutePrecision())
|
? Text(chat.dateTime!.formatWithMinutePrecision())
|
||||||
: null,
|
: null,
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await context.push(
|
await context.push(
|
||||||
ChatArchiveDetailRoute(fileName: chat.fileName).location,
|
ChatArchiveDetailRoute(fileName: chat.fileName)
|
||||||
|
.location,
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:fading_scroll/fading_scroll.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||||
@@ -60,43 +61,52 @@ class ChatArchiveSearchScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
body: resultsAsync.when(
|
body: resultsAsync.when(
|
||||||
skipLoadingOnReload: true,
|
skipLoadingOnReload: true,
|
||||||
data: (chats) => ListView.builder(
|
data: (chats) => FadingScroll(
|
||||||
itemCount: chats.length,
|
fadingSize: 25,
|
||||||
itemBuilder: (context, index) {
|
builder: (context, controller) {
|
||||||
final chat = chats[index];
|
return ListView.builder(
|
||||||
final chatEntity = ChatEntity.fromFileName(chat.fileName);
|
controller: controller,
|
||||||
|
itemCount: chats.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final chat = chats[index];
|
||||||
|
final chatEntity = ChatEntity.fromFileName(chat.fileName);
|
||||||
|
|
||||||
return Card(
|
return Card(
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await context.push(
|
await context.push(
|
||||||
ChatArchiveDetailRoute(fileName: chat.fileName).location,
|
ChatArchiveDetailRoute(fileName: chat.fileName)
|
||||||
);
|
.location,
|
||||||
},
|
);
|
||||||
child: Padding(
|
},
|
||||||
padding: const EdgeInsets.all(16.0),
|
child: Padding(
|
||||||
child: Column(
|
padding: const EdgeInsets.all(16.0),
|
||||||
mainAxisSize: MainAxisSize.min,
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
Markdown(
|
children: [
|
||||||
shrinkWrap: true,
|
Markdown(
|
||||||
padding: EdgeInsets.zero,
|
shrinkWrap: true,
|
||||||
data: '## ${chat.title}',
|
padding: EdgeInsets.zero,
|
||||||
|
data: '## ${chat.title}',
|
||||||
|
),
|
||||||
|
if (chatEntity.dateTime != null)
|
||||||
|
Text(
|
||||||
|
chatEntity.dateTime!.formatWithMinutePrecision(),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Markdown(
|
||||||
|
shrinkWrap: true,
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
data: chat.contentSnippet,
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
if (chatEntity.dateTime != null)
|
),
|
||||||
Text(chatEntity.dateTime!.formatWithMinutePrecision()),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Markdown(
|
|
||||||
shrinkWrap: true,
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
data: chat.contentSnippet,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
),
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
|
||||||
import 'package:flutter_material_design_icons/flutter_material_design_icons.dart';
|
import 'package:flutter_material_design_icons/flutter_material_design_icons.dart';
|
||||||
import 'package:lensai/features/web_view/domain/entities/web_view_page.dart';
|
import 'package:lensai/features/web_view/domain/entities/web_view_page.dart';
|
||||||
import 'package:lensai/features/web_view/presentation/widgets/favicon.dart';
|
import 'package:lensai/features/web_view/presentation/widgets/favicon.dart';
|
||||||
import 'package:lensai/features/web_view/presentation/widgets/web_view.dart';
|
|
||||||
import 'package:text_scroll/text_scroll.dart';
|
import 'package:text_scroll/text_scroll.dart';
|
||||||
|
|
||||||
class AppBarTitle extends HookWidget {
|
class AppBarTitle extends StatelessWidget {
|
||||||
final WebView activeWebView;
|
final WebViewPage page;
|
||||||
|
|
||||||
final void Function()? onTap;
|
final void Function()? onTap;
|
||||||
|
|
||||||
const AppBarTitle({required this.activeWebView, this.onTap, super.key});
|
const AppBarTitle({required this.page, this.onTap, super.key});
|
||||||
|
|
||||||
Icon _securityStatusIcon(BuildContext context, WebViewPage page) {
|
Icon _securityStatusIcon(BuildContext context, WebViewPage page) {
|
||||||
if (page.url.isScheme('http')) {
|
if (page.url.isScheme('http')) {
|
||||||
@@ -36,8 +34,6 @@ class AppBarTitle extends HookWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final page = useValueListenable(activeWebView.page);
|
|
||||||
|
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:fading_scroll/fading_scroll.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart' show rootBundle;
|
import 'package:flutter/services.dart' show rootBundle;
|
||||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||||
@@ -22,115 +23,127 @@ class LandingContent extends HookConsumerWidget {
|
|||||||
() async => rootBundle.loadString('assets/landing/changelog.md'),
|
() async => rootBundle.loadString('assets/landing/changelog.md'),
|
||||||
);
|
);
|
||||||
|
|
||||||
return SingleChildScrollView(
|
return FadingScroll(
|
||||||
child: Column(
|
fadingSize: 25,
|
||||||
children: [
|
builder: (context, controller) {
|
||||||
Text(
|
return SingleChildScrollView(
|
||||||
'Lensai',
|
controller: controller,
|
||||||
style: textTheme.titleLarge?.copyWith(fontWeight: FontWeight.bold),
|
child: Column(
|
||||||
textAlign: TextAlign.center,
|
children: [
|
||||||
),
|
Text(
|
||||||
Text(
|
'Lensai',
|
||||||
'The Privacy-Focused & AI-Powered Research Browser with Kagi integration',
|
style:
|
||||||
style: textTheme.titleMedium,
|
textTheme.titleLarge?.copyWith(fontWeight: FontWeight.bold),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
FractionallySizedBox(
|
Padding(
|
||||||
widthFactor: 0.5,
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||||
child: Image.asset('assets/icon/icon.png'),
|
child: Text(
|
||||||
),
|
'The Privacy-Focused & AI-Powered Research Browser with Kagi integration',
|
||||||
const LandingAction(),
|
style: textTheme.titleMedium,
|
||||||
Consumer(
|
textAlign: TextAlign.center,
|
||||||
builder: (context, ref, child) {
|
),
|
||||||
final errors = ref.watch(
|
),
|
||||||
appInitializationServiceProvider
|
FractionallySizedBox(
|
||||||
.select((result) => result.valueOrNull?.errors),
|
widthFactor: 0.5,
|
||||||
);
|
child: Image.asset('assets/icon/icon.png'),
|
||||||
|
),
|
||||||
|
const LandingAction(),
|
||||||
|
Consumer(
|
||||||
|
builder: (context, ref, child) {
|
||||||
|
final errors = ref.watch(
|
||||||
|
appInitializationServiceProvider
|
||||||
|
.select((result) => result.valueOrNull?.errors),
|
||||||
|
);
|
||||||
|
|
||||||
if (errors == null || errors.isEmpty) {
|
if (errors == null || errors.isEmpty) {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
...errors.map(
|
...errors.map(
|
||||||
(error) {
|
(error) {
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||||
child: ErrorContainer(
|
child: ErrorContainer(
|
||||||
content: Column(
|
content: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'Error during App Initialization!',
|
'Error during App Initialization!',
|
||||||
style: theme.textTheme.titleMedium,
|
style: theme.textTheme.titleMedium,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
error.message,
|
||||||
|
style: theme.textTheme.titleSmall,
|
||||||
|
),
|
||||||
|
if (error.details != null)
|
||||||
|
Text(error.details.toString()),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
Text(
|
),
|
||||||
error.message,
|
);
|
||||||
style: theme.textTheme.titleSmall,
|
},
|
||||||
),
|
),
|
||||||
if (error.details != null)
|
const SizedBox(
|
||||||
Text(error.details.toString()),
|
height: 8,
|
||||||
],
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||||
|
child: SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
child: FilledButton.tonalIcon(
|
||||||
|
onPressed: () async {
|
||||||
|
await ref
|
||||||
|
.read(
|
||||||
|
appInitializationServiceProvider.notifier)
|
||||||
|
.reinitialize();
|
||||||
|
},
|
||||||
|
style: OutlinedButton.styleFrom(
|
||||||
|
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||||
|
),
|
||||||
|
label: const Text('Restart App'),
|
||||||
|
icon: const Icon(Icons.refresh_outlined),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 8,
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
|
||||||
child: SizedBox(
|
|
||||||
width: double.infinity,
|
|
||||||
child: FilledButton.tonalIcon(
|
|
||||||
onPressed: () async {
|
|
||||||
await ref
|
|
||||||
.read(appInitializationServiceProvider.notifier)
|
|
||||||
.reinitialize();
|
|
||||||
},
|
|
||||||
style: OutlinedButton.styleFrom(
|
|
||||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
||||||
),
|
|
||||||
label: const Text('Restart App'),
|
|
||||||
icon: const Icon(Icons.refresh_outlined),
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
);
|
||||||
],
|
},
|
||||||
);
|
),
|
||||||
},
|
Markdown(
|
||||||
|
data: descriptionAsset.data ?? '',
|
||||||
|
onTapLink: (text, href, title) async {
|
||||||
|
if (href != null) {
|
||||||
|
await ref
|
||||||
|
.read(switchNewTabControllerProvider.notifier)
|
||||||
|
.add(Uri.parse(href));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selectable: true,
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Changelog',
|
||||||
|
style:
|
||||||
|
textTheme.titleLarge?.copyWith(fontWeight: FontWeight.bold),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
Markdown(
|
||||||
|
data: changelogAsset.data ?? '',
|
||||||
|
selectable: true,
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
Markdown(
|
);
|
||||||
data: descriptionAsset.data ?? '',
|
},
|
||||||
onTapLink: (text, href, title) async {
|
|
||||||
if (href != null) {
|
|
||||||
await ref
|
|
||||||
.read(switchNewTabControllerProvider.notifier)
|
|
||||||
.add(Uri.parse(href));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selectable: true,
|
|
||||||
shrinkWrap: true,
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'Changelog',
|
|
||||||
style: textTheme.titleLarge?.copyWith(fontWeight: FontWeight.bold),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
Markdown(
|
|
||||||
data: changelogAsset.data ?? '',
|
|
||||||
selectable: true,
|
|
||||||
shrinkWrap: true,
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:fading_scroll/fading_scroll.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||||
@@ -82,377 +83,386 @@ class SettingsScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: const Text('Settings')),
|
appBar: AppBar(title: const Text('Settings')),
|
||||||
body: ListView(
|
body: FadingScroll(
|
||||||
children: [
|
fadingSize: 25,
|
||||||
_buildSection(theme, 'Kagi'),
|
builder: (context, controller) {
|
||||||
Padding(
|
return ListView(
|
||||||
padding: const EdgeInsets.only(
|
controller: controller,
|
||||||
left: 16,
|
children: [
|
||||||
right: 16,
|
_buildSection(theme, 'Kagi'),
|
||||||
bottom: 8,
|
Padding(
|
||||||
),
|
padding: const EdgeInsets.only(
|
||||||
child: TextField(
|
left: 16,
|
||||||
enableIMEPersonalizedLearning: false,
|
right: 16,
|
||||||
autocorrect: false,
|
bottom: 8,
|
||||||
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(
|
child: TextField(
|
||||||
onPressed: () {
|
enableIMEPersonalizedLearning: false,
|
||||||
hideSessionText.value = !hideSessionText.value;
|
autocorrect: false,
|
||||||
},
|
controller: kagiSessionTextController,
|
||||||
icon: Icon(
|
obscureText: hideSessionText.value,
|
||||||
hideSessionText.value
|
decoration: InputDecoration(
|
||||||
? Icons.visibility
|
label: const Text('Kagi Session Token'),
|
||||||
: Icons.visibility_off,
|
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'),
|
||||||
SwitchListTile.adaptive(
|
subtitle: const Text(
|
||||||
title: const Text('Show Early Access Features'),
|
"Displays Kagi's early access features in the UI. As an Ultimate subscriber, you will likely want to have this enabled.",
|
||||||
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,
|
|
||||||
),
|
),
|
||||||
Center(
|
value: settings.showEarlyAccessFeatures,
|
||||||
child: SegmentedButton<ThemeMode>(
|
onChanged: (value) async {
|
||||||
segments: const [
|
await ref.read(saveSettingsControllerProvider.notifier).save(
|
||||||
ButtonSegment(
|
(currentSettings) => currentSettings.copyWith
|
||||||
value: ThemeMode.system,
|
.showEarlyAccessFeatures(value),
|
||||||
icon: Icon(Icons.brightness_auto),
|
);
|
||||||
label: Text('System'),
|
},
|
||||||
|
),
|
||||||
|
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'),
|
||||||
SwitchListTile.adaptive(
|
subtitle: const Text(
|
||||||
title: const Text('Incognito Mode'),
|
'Deletes all browsing data upon app restart for enhanced privacy.',
|
||||||
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.',
|
|
||||||
),
|
),
|
||||||
Padding(
|
value: settings.incognitoMode,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
onChanged: (value) async {
|
||||||
child: Center(
|
await ref.read(saveSettingsControllerProvider.notifier).save(
|
||||||
child: SegmentedButton<KagiTool>(
|
(currentSettings) =>
|
||||||
emptySelectionAllowed: true,
|
currentSettings.copyWith.incognitoMode(value),
|
||||||
segments: [
|
);
|
||||||
ButtonSegment(
|
},
|
||||||
value: KagiTool.search,
|
),
|
||||||
icon: Icon(KagiTool.search.icon),
|
SwitchListTile.adaptive(
|
||||||
label: const Text('Search'),
|
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(
|
SwitchListTile.adaptive(
|
||||||
value: KagiTool.assistant,
|
title: const Text('Quick Action - STT'),
|
||||||
icon: Icon(KagiTool.assistant.icon),
|
subtitle: const Text(
|
||||||
label: const Text('Assistant'),
|
'Quick option will open with speech-to-text input.',
|
||||||
),
|
),
|
||||||
],
|
value: settings.quickActionVoiceInput,
|
||||||
selected: {
|
onChanged: (settings.quickAction != null)
|
||||||
if (settings.quickAction != null) settings.quickAction!,
|
? (value) async {
|
||||||
},
|
|
||||||
onSelectionChanged: (value) async {
|
|
||||||
await ref
|
await ref
|
||||||
.read(saveSettingsControllerProvider.notifier)
|
.read(saveSettingsControllerProvider.notifier)
|
||||||
.save(
|
.save(
|
||||||
(currentSettings) =>
|
(currentSettings) => currentSettings.copyWith
|
||||||
currentSettings.copyWith.quickAction(
|
.quickActionVoiceInput(value),
|
||||||
value.isNotEmpty ? value.first : null,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
),
|
: null,
|
||||||
),
|
),
|
||||||
),
|
_buildSection(theme, 'Content Blocking'),
|
||||||
],
|
SwitchListTile.adaptive(
|
||||||
),
|
title: const Text('Enable Content Blocking'),
|
||||||
),
|
subtitle: const Text(
|
||||||
SwitchListTile.adaptive(
|
'Prevents access to unwanted websites and ads, as defined in the selected lists below.',
|
||||||
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'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
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(
|
suffix: FilledButton.icon(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await ref
|
await ref
|
||||||
.read(bangDataRepositoryProvider.notifier)
|
.read(bangDataRepositoryProvider.notifier)
|
||||||
.clearIconData();
|
.resetFrequencies();
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.delete),
|
icon: const Icon(Icons.delete),
|
||||||
label: const Text('Clear'),
|
label: const Text('Clear'),
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
},
|
Consumer(
|
||||||
),
|
builder: (context, ref, child) {
|
||||||
_buildSubSection(theme, 'Repositories'),
|
final size = ref.watch(
|
||||||
const BangGroupListTile(
|
bangIconCacheSizeMegabytesProvider.select(
|
||||||
group: BangGroup.general,
|
(value) => value.valueOrNull,
|
||||||
title: 'General Bangs',
|
),
|
||||||
subtitle: 'Automatically syncs every 7 days',
|
);
|
||||||
),
|
|
||||||
const BangGroupListTile(
|
return CustomListTile(
|
||||||
group: BangGroup.assistant,
|
title: 'Icon Cache',
|
||||||
title: 'Assistant Bangs',
|
subtitle: 'Stored favicons for Bangs',
|
||||||
subtitle: 'Automatically syncs every 7 days',
|
content: Padding(
|
||||||
),
|
padding: const EdgeInsets.only(top: 8.0),
|
||||||
const BangGroupListTile(
|
child: DefaultTextStyle(
|
||||||
group: BangGroup.kagi,
|
style: GoogleFonts.robotoMono(
|
||||||
title: 'Kagi Bangs',
|
textStyle: DefaultTextStyle.of(context).style,
|
||||||
subtitle: 'Automatically syncs every 7 days',
|
),
|
||||||
),
|
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',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ final _sharingIntentTransformer =
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
@riverpod
|
@Riverpod()
|
||||||
Raw<Stream<ReceivedParameter>> sharingIntentStream(SharingIntentStreamRef ref) {
|
Raw<Stream<ReceivedParameter>> sharingIntentStream(SharingIntentStreamRef ref) {
|
||||||
final initialStream = FlutterSharingIntent.instance
|
final initialStream = FlutterSharingIntent.instance
|
||||||
// ignore: discarded_futures
|
// ignore: discarded_futures
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ part of 'sharing_intent.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$sharingIntentStreamHash() =>
|
String _$sharingIntentStreamHash() =>
|
||||||
r'e396c15da84d6e726f9e77996ef9d2422f6269e1';
|
r'ce060aadf885ab0a14d90acfe986447ecb05f4f9';
|
||||||
|
|
||||||
/// See also [sharingIntentStream].
|
/// See also [sharingIntentStream].
|
||||||
@ProviderFor(sharingIntentStream)
|
@ProviderFor(sharingIntentStream)
|
||||||
|
|||||||
Reference in New Issue
Block a user