Line data Source code
1 : // Copyright 2023 The terCAD team. All rights reserved.
2 : // Use of this source code is governed by a CC BY-NC-ND 4.0 license that can be found in the LICENSE file.
3 :
4 : import 'package:app_finance/_classes/storage/app_preferences.dart';
5 : import 'package:material_ui/material_ui.dart';
6 :
7 : class AppStartOfMonth extends ValueNotifier<int> {
8 2 : static get state => get();
9 :
10 3 : AppStartOfMonth() : super(state);
11 :
12 3 : static int get() => int.tryParse(AppPreferences.get(AppPreferences.prefMonthStartDay) ?? '') ?? 1;
13 :
14 0 : Future<void> set(int newValue) async {
15 0 : if (newValue != value) {
16 0 : value = newValue;
17 0 : await AppPreferences.set(AppPreferences.prefMonthStartDay, value.toString());
18 0 : notifyListeners();
19 : }
20 : }
21 : }
|