Files
ingtrakapp/lib/providers/preferences_provider.dart
T

27 lines
733 B
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/// 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);
}
}