mangayomi/lib/modules/more/settings/browse/browse_screen.dart
2024-12-14 12:38:56 +02:00

79 lines
3.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:mangayomi/providers/l10n_providers.dart';
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
import 'package:mangayomi/modules/more/settings/browse/providers/browse_state_provider.dart';
class BrowseSScreen extends ConsumerWidget {
const BrowseSScreen({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final onlyIncludePinnedSource = ref.watch(onlyIncludePinnedSourceStateProvider);
final checkForExtensionUpdates = ref.watch(checkForExtensionsUpdateStateProvider);
final autoUpdateExtensions = ref.watch(autoUpdateExtensionsStateProvider);
final l10n = l10nLocalizations(context);
return Scaffold(
appBar: AppBar(
title: Text(l10n!.browse),
),
body: SingleChildScrollView(
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(bottom: 30, top: 20),
child: Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 15),
child: Row(
children: [
Text(l10n.extensions, style: TextStyle(fontSize: 13, color: context.primaryColor)),
],
),
),
SwitchListTile(
value: checkForExtensionUpdates,
title: Text(l10n.check_for_extension_updates),
onChanged: (value) {
ref.read(checkForExtensionsUpdateStateProvider.notifier).set(value);
}),
if (checkForExtensionUpdates)
SwitchListTile(
value: autoUpdateExtensions,
title: Text(l10n.auto_extensions_updates),
subtitle: Text(l10n.auto_extensions_updates_subtitle,
style: TextStyle(fontSize: 11, color: context.secondaryColor)),
onChanged: (value) {
ref.read(autoUpdateExtensionsStateProvider.notifier).set(value);
}),
],
),
),
Padding(
padding: const EdgeInsets.only(bottom: 30),
child: Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 15),
child: Row(
children: [
Text(l10n.global_search, style: TextStyle(fontSize: 13, color: context.primaryColor)),
],
),
),
SwitchListTile(
value: onlyIncludePinnedSource,
title: Text(l10n.only_include_pinned_sources),
onChanged: (value) {
ref.read(onlyIncludePinnedSourceStateProvider.notifier).set(value);
}),
],
),
),
],
),
),
);
}
}