e_receipt_mobile/lib/presentation/settings/settings_screen.dart
2026-02-15 01:11:20 +06:30

66 lines
2.0 KiB
Dart

import 'package:e_receipt_mobile/presentation/settings/theme_mode_provider.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
class SettingsScreen extends ConsumerWidget {
const SettingsScreen({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final selectedMode = ref.watch(appThemeModeProvider);
return Scaffold(
appBar: AppBar(
title: const Text('Settings'),
centerTitle: true,
),
body: ListView(
padding: const EdgeInsets.all(16),
children: [
Text(
'Theme',
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: 8),
Card(
child: Column(
children: [
RadioListTile<ThemeMode>(
title: const Text('Light'),
value: ThemeMode.light,
groupValue: selectedMode,
onChanged: (value) {
if (value != null) {
ref.read(appThemeModeProvider.notifier).state = value;
}
},
),
RadioListTile<ThemeMode>(
title: const Text('Dark'),
value: ThemeMode.dark,
groupValue: selectedMode,
onChanged: (value) {
if (value != null) {
ref.read(appThemeModeProvider.notifier).state = value;
}
},
),
RadioListTile<ThemeMode>(
title: const Text('System'),
value: ThemeMode.system,
groupValue: selectedMode,
onChanged: (value) {
if (value != null) {
ref.read(appThemeModeProvider.notifier).state = value;
}
},
),
],
),
),
],
),
);
}
}