feat(app): календарь выплат сеткой по месяцам
Месячная сетка с дивидендами, купонами, амортизациями и погашениями по дням, выплаченными и ожидаемыми, с сводкой за месяц и списком выплат выбранного дня. Раскладка без прокрутки страницы: высота ячеек подстраивается под окно, на широком экране список справа. Прежний список остался вторым режимом.
This commit is contained in:
@@ -32,6 +32,34 @@ final incomeCalendarProvider =
|
||||
);
|
||||
});
|
||||
|
||||
enum CalendarView { month, list }
|
||||
|
||||
/// The calendar opens as a month grid; the list of the coming payments is the other view.
|
||||
final calendarViewProvider = StateProvider<CalendarView>(
|
||||
(ref) => CalendarView.month,
|
||||
);
|
||||
|
||||
/// The month the grid shows, as the first day of it.
|
||||
final calendarMonthProvider = StateProvider<DateTime>((ref) {
|
||||
final now = DateTime.now();
|
||||
return DateTime(now.year, now.month);
|
||||
});
|
||||
|
||||
/// Every payment of one month, the paid ones included: a calendar of a month is the record of
|
||||
/// it as well as the plan. Keyed by the first day of the month.
|
||||
final incomeMonthProvider = FutureProvider.autoDispose
|
||||
.family<Cached<IncomeCalendar>, DateTime>((ref, month) async {
|
||||
final scope = ref.watch(scopeProvider);
|
||||
return ref
|
||||
.watch(incomeApiProvider)
|
||||
.calendar(
|
||||
scope: scope,
|
||||
dateFrom: DateTime(month.year, month.month, 1),
|
||||
dateTo: DateTime(month.year, month.month + 1, 0),
|
||||
includePaid: true,
|
||||
);
|
||||
});
|
||||
|
||||
/// How far the history goes back, in months.
|
||||
final historyMonthsProvider = StateProvider<int>((ref) => 24);
|
||||
|
||||
@@ -62,6 +90,7 @@ final incomeForecastProvider =
|
||||
|
||||
void invalidateIncomeProviders(WidgetRef ref) {
|
||||
ref.invalidate(incomeCalendarProvider);
|
||||
ref.invalidate(incomeMonthProvider);
|
||||
ref.invalidate(incomeHistoryProvider);
|
||||
ref.invalidate(incomeForecastProvider);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user