look aheead limit defined by user

This commit is contained in:
davmar
2026-09-10 09:31:11 +02:00
parent 200ff72e2e
commit 7437cc90ce
5 changed files with 92 additions and 24 deletions
+27
View File
@@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../providers/bank_provider.dart';
import '../providers/preferences_provider.dart';
import '../providers/theme_provider.dart';
import '../utils/connect_bank.dart';
import '../utils/constants.dart';
@@ -110,6 +111,7 @@ class SettingsScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
final themeController = context.watch<ThemeController>();
final prefs = context.watch<PreferencesController>();
final bank = context.watch<BankController>();
final theme = Theme.of(context);
@@ -150,6 +152,31 @@ class SettingsScreen extends StatelessWidget {
},
),
const SizedBox(height: 28),
Text('Look ahead', style: theme.textTheme.titleMedium),
const SizedBox(height: 8),
Card(
child: ListTile(
leading: const Icon(Icons.event_repeat_outlined),
title: const Text('Projection horizon'),
subtitle: Text(
'Navigate up to ${prefs.lookAheadMaxYears} year'
'${prefs.lookAheadMaxYears == 1 ? '' : 's'} ahead',
),
trailing: DropdownButton<int>(
value: prefs.lookAheadMaxYears,
underline: const SizedBox.shrink(),
items: [
for (final y in const [1, 2, 3, 5, 7, 10, 15, 20, 30])
DropdownMenuItem(value: y, child: Text('$y')),
],
onChanged: (value) {
if (value == null) return;
prefs.setLookAheadMaxYears(value);
},
),
),
),
const SizedBox(height: 28),
Text('Backend', style: theme.textTheme.titleMedium),
const SizedBox(height: 8),
Card(