update onboarding ai features
This commit is contained in:
@@ -6,6 +6,7 @@ import 'package:weblibre/core/providers/defaults.dart';
|
||||
import 'package:weblibre/core/providers/router.dart';
|
||||
import 'package:weblibre/features/geckoview/domain/repositories/tab.dart';
|
||||
import 'package:weblibre/features/onboarding/presentation/pages/abstract/i_form_page.dart';
|
||||
import 'package:weblibre/features/onboarding/presentation/pages/ai_configuration.dart';
|
||||
import 'package:weblibre/features/onboarding/presentation/pages/default_search.dart';
|
||||
import 'package:weblibre/features/onboarding/presentation/pages/permissions.dart';
|
||||
import 'package:weblibre/features/onboarding/presentation/pages/ublock_opt_in.dart';
|
||||
@@ -29,12 +30,18 @@ class OnboardingScreen extends HookConsumerWidget {
|
||||
final pageController = usePageController();
|
||||
|
||||
final pages = useMemoized<List<Widget>>(() {
|
||||
return [
|
||||
const WelcomePage(),
|
||||
const DefaultSearchPage(),
|
||||
UBlockOptInPage(formKey: GlobalKey<FormState>()),
|
||||
PermissionsPage(formKey: GlobalKey<FormState>()),
|
||||
];
|
||||
switch (currentRevision) {
|
||||
case 1:
|
||||
return [const AiConfigurationPage()];
|
||||
default:
|
||||
return [
|
||||
const WelcomePage(),
|
||||
const DefaultSearchPage(),
|
||||
const AiConfigurationPage(),
|
||||
UBlockOptInPage(formKey: GlobalKey<FormState>()),
|
||||
PermissionsPage(formKey: GlobalKey<FormState>()),
|
||||
];
|
||||
}
|
||||
}, [currentRevision, targetRevision]);
|
||||
|
||||
final lastPage = useRef(pageController.initialPage);
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_material_design_icons/flutter_material_design_icons.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:weblibre/features/settings/presentation/controllers/save_settings.dart';
|
||||
import 'package:weblibre/features/user/data/models/general_settings.dart';
|
||||
import 'package:weblibre/features/user/domain/repositories/general_settings.dart';
|
||||
|
||||
class AiConfigurationPage extends HookConsumerWidget {
|
||||
const AiConfigurationPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
final enableLocalAiFeatures = ref.watch(
|
||||
generalSettingsRepositoryProvider.select(
|
||||
(settings) => settings.enableLocalAiFeatures,
|
||||
),
|
||||
);
|
||||
|
||||
return ListView(
|
||||
children: [
|
||||
const SizedBox(height: 24),
|
||||
Center(
|
||||
child: Text('AI Features', style: theme.textTheme.headlineMedium),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
SwitchListTile.adaptive(
|
||||
title: const Text('On Device AI'),
|
||||
subtitle: const Text(
|
||||
'Local on-device features including container topic and tab suggestions',
|
||||
),
|
||||
secondary: const Icon(MdiIcons.creation),
|
||||
value: enableLocalAiFeatures,
|
||||
onChanged: (value) async {
|
||||
await ref
|
||||
.read(saveGeneralSettingsControllerProvider.notifier)
|
||||
.save(
|
||||
(currentSettings) =>
|
||||
currentSettings.copyWith.enableLocalAiFeatures(value),
|
||||
);
|
||||
},
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 24, vertical: 24),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
),
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onError,
|
||||
height: 1.4,
|
||||
),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: 'Things to keep in mind\n\n',
|
||||
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onError,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
const TextSpan(text: '• '),
|
||||
const TextSpan(
|
||||
text:
|
||||
'WebLibre uses a local AI model to read your open tab titles and suggest container tabs and names. Everything happens on your device.\n\n',
|
||||
),
|
||||
const TextSpan(text: '• '),
|
||||
const TextSpan(
|
||||
text:
|
||||
'AI enhancements operate entirely within your browser, keeping all data on your device. Local AI processing respects your privacy and provides faster suggestions for container groups and names. You can control this behavior anytime through settings.\n\n',
|
||||
),
|
||||
const TextSpan(text: '• '),
|
||||
const TextSpan(
|
||||
text:
|
||||
'AI can sometimes make mistakes, so please review suggested group names and tab selections.',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ part 'onboarding.g.dart';
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
class OnboardingRepository extends _$OnboardingRepository {
|
||||
static const targetRevision = 1;
|
||||
static const targetRevision = 2;
|
||||
|
||||
Future<int?> getCurrentRevision() {
|
||||
return ref
|
||||
|
||||
@@ -7,7 +7,7 @@ part of 'onboarding.dart';
|
||||
// **************************************************************************
|
||||
|
||||
String _$onboardingRepositoryHash() =>
|
||||
r'37b76aa313ae6dfed6ab5695b4df8c4a0cfe0483';
|
||||
r'937a5fe08c09cc0475270d3707bfb6f087bcf123';
|
||||
|
||||
/// See also [OnboardingRepository].
|
||||
@ProviderFor(OnboardingRepository)
|
||||
|
||||
Reference in New Issue
Block a user