mirror of
https://github.com/jagandeepbrar/lunasea.git
synced 2026-08-30 20:24:25 +00:00
feat(calendar): remove option to show previous days in schedule view, now always shows them
This commit is contained in:
@@ -13,8 +13,7 @@ enum DashboardDatabase<T> with LunaTableMixin<T> {
|
||||
CALENDAR_ENABLE_RADARR<bool>(true),
|
||||
CALENDAR_ENABLE_SONARR<bool>(true),
|
||||
CALENDAR_DAYS_PAST<int>(14),
|
||||
CALENDAR_DAYS_FUTURE<int>(14),
|
||||
CALENDAR_SHOW_PAST_DAYS<bool>(false);
|
||||
CALENDAR_DAYS_FUTURE<int>(14);
|
||||
|
||||
@override
|
||||
LunaTable get table => LunaTable.dashboard;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lunasea/database/tables/dashboard.dart';
|
||||
import 'package:lunasea/extensions/scroll_controller.dart';
|
||||
import 'package:lunasea/vendor.dart';
|
||||
|
||||
@@ -63,18 +62,12 @@ class _State extends State<ScheduleView> {
|
||||
|
||||
for (final key in keys) {
|
||||
final selected = context.read<ModuleState>().selected;
|
||||
final today = context.read<ModuleState>().today;
|
||||
|
||||
bool pastDays = DashboardDatabase.CALENDAR_SHOW_PAST_DAYS.read();
|
||||
bool dayInFuture = key.isAfter(today.subtract(const Duration(days: 1)));
|
||||
bool hasEvents = widget.events[key]?.isNotEmpty ?? false;
|
||||
bool isSelected = selected.isAtSameMomentAs(key);
|
||||
|
||||
if (isSelected) {
|
||||
if (selected.isAtSameMomentAs(key)) {
|
||||
offsetOfSelected = offset;
|
||||
}
|
||||
|
||||
if ((pastDays || dayInFuture) && hasEvents) {
|
||||
final hasEvents = widget.events[key]?.isNotEmpty ?? false;
|
||||
if (hasEvents) {
|
||||
final built = _buildDay(key);
|
||||
offset += built.item2;
|
||||
days.addAll(built.item1);
|
||||
|
||||
@@ -45,7 +45,6 @@ class _State extends State<ConfigurationDashboardCalendarRoute>
|
||||
children: [
|
||||
_futureDays(),
|
||||
_pastDays(),
|
||||
_pastDaysInSchedule(),
|
||||
LunaDivider(),
|
||||
_startingDay(),
|
||||
_startingSize(),
|
||||
@@ -58,19 +57,6 @@ class _State extends State<ConfigurationDashboardCalendarRoute>
|
||||
);
|
||||
}
|
||||
|
||||
Widget _pastDaysInSchedule() {
|
||||
const _db = DashboardDatabase.CALENDAR_SHOW_PAST_DAYS;
|
||||
return _db.listenableBuilder(
|
||||
builder: (context, _) => LunaBlock(
|
||||
title: 'settings.PastDaysInScheduleView'.tr(),
|
||||
trailing: LunaSwitch(
|
||||
value: _db.read(),
|
||||
onChanged: _db.update,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _pastDays() {
|
||||
const _db = DashboardDatabase.CALENDAR_DAYS_PAST;
|
||||
return _db.listenableBuilder(
|
||||
|
||||
Reference in New Issue
Block a user