look aheead limit defined by user

This commit is contained in:
davmar
2026-09-10 09:31:16 +02:00
parent 7437cc90ce
commit 2698e3bf75
+26
View File
@@ -0,0 +1,26 @@
/// App preferences beyond theme (Look ahead horizon, etc.).
library;
import 'package:flutter/foundation.dart';
import '../services/storage_service.dart';
class PreferencesController extends ChangeNotifier {
PreferencesController(this._storage) {
_lookAheadMaxYears = _storage.lookAheadMaxYears;
}
final StorageService _storage;
late int _lookAheadMaxYears;
/// Years ahead Look ahead can navigate (1–30, default 5).
int get lookAheadMaxYears => _lookAheadMaxYears;
Future<void> setLookAheadMaxYears(int years) async {
final next = years.clamp(1, 30);
if (next == _lookAheadMaxYears) return;
_lookAheadMaxYears = next;
notifyListeners();
await _storage.setLookAheadMaxYears(next);
}
}