implemented RMV commute integration in the timetable, added Nominatim geocoding for home station lookup, created CommuteCubit for daily trip management with TTL caching, and introduced specialized timetable tiles, detail sheets, and settings for transit connections and walking buffers
This commit is contained in:
@@ -1,17 +1,43 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import '../../../view/pages/timetable/data/timetable_name_mode.dart';
|
||||
import '../api/connect/rmv/rmv_models.dart';
|
||||
import '../view/pages/timetable/data/timetable_name_mode.dart';
|
||||
|
||||
part 'timetable_settings.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class TimetableSettings {
|
||||
bool connectDoubleLessons;
|
||||
TimetableNameMode timetableNameMode;
|
||||
|
||||
/// Show RMV transit cards before the first lesson and after the last lesson
|
||||
/// of each day.
|
||||
bool showCommuteInTimetable;
|
||||
|
||||
/// The user's home RMV stop. Resolved via Nominatim → nearbyStops in the
|
||||
/// settings flow; once stored it is used directly for all trip lookups.
|
||||
StopLocation? homeStation;
|
||||
|
||||
/// Free-text label of the address the user entered (for display purposes
|
||||
/// only — the actual lookup uses [homeStation]).
|
||||
String? homeAddressLabel;
|
||||
|
||||
/// School-side stop. Default-resolved via `searchStops("Fulda Marianum")`
|
||||
/// on the first activation of [showCommuteInTimetable].
|
||||
StopLocation? schoolStation;
|
||||
|
||||
/// Minutes added as a walking buffer between the stop and the first lesson
|
||||
/// (and analogously after the last lesson).
|
||||
int commuteBufferMinutes;
|
||||
|
||||
TimetableSettings({
|
||||
required this.connectDoubleLessons,
|
||||
required this.timetableNameMode,
|
||||
this.showCommuteInTimetable = false,
|
||||
this.homeStation,
|
||||
this.homeAddressLabel,
|
||||
this.schoolStation,
|
||||
this.commuteBufferMinutes = 5,
|
||||
});
|
||||
|
||||
factory TimetableSettings.fromJson(Map<String, dynamic> json) =>
|
||||
|
||||
@@ -6,20 +6,35 @@ part of 'timetable_settings.dart';
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
TimetableSettings _$TimetableSettingsFromJson(Map<String, dynamic> json) =>
|
||||
TimetableSettings(
|
||||
connectDoubleLessons: json['connectDoubleLessons'] as bool,
|
||||
timetableNameMode: $enumDecode(
|
||||
_$TimetableNameModeEnumMap,
|
||||
json['timetableNameMode'],
|
||||
),
|
||||
);
|
||||
TimetableSettings _$TimetableSettingsFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => TimetableSettings(
|
||||
connectDoubleLessons: json['connectDoubleLessons'] as bool,
|
||||
timetableNameMode: $enumDecode(
|
||||
_$TimetableNameModeEnumMap,
|
||||
json['timetableNameMode'],
|
||||
),
|
||||
showCommuteInTimetable: json['showCommuteInTimetable'] as bool? ?? false,
|
||||
homeStation: json['homeStation'] == null
|
||||
? null
|
||||
: StopLocation.fromJson(json['homeStation'] as Map<String, dynamic>),
|
||||
homeAddressLabel: json['homeAddressLabel'] as String?,
|
||||
schoolStation: json['schoolStation'] == null
|
||||
? null
|
||||
: StopLocation.fromJson(json['schoolStation'] as Map<String, dynamic>),
|
||||
commuteBufferMinutes: (json['commuteBufferMinutes'] as num?)?.toInt() ?? 5,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$TimetableSettingsToJson(
|
||||
TimetableSettings instance,
|
||||
) => <String, dynamic>{
|
||||
'connectDoubleLessons': instance.connectDoubleLessons,
|
||||
'timetableNameMode': _$TimetableNameModeEnumMap[instance.timetableNameMode]!,
|
||||
'showCommuteInTimetable': instance.showCommuteInTimetable,
|
||||
'homeStation': instance.homeStation?.toJson(),
|
||||
'homeAddressLabel': instance.homeAddressLabel,
|
||||
'schoolStation': instance.schoolStation?.toJson(),
|
||||
'commuteBufferMinutes': instance.commuteBufferMinutes,
|
||||
};
|
||||
|
||||
const _$TimetableNameModeEnumMap = {
|
||||
|
||||
Reference in New Issue
Block a user