Added components to article

This commit is contained in:
Dennis Nemec
2026-05-11 17:12:05 +02:00
parent 2470299a10
commit ac6b03227d
37 changed files with 1189 additions and 513 deletions

View File

@ -24,7 +24,7 @@ class CarSelectBloc extends Bloc<CarSelectEvent, CarSelectState> {
try {
emit(CarSelectLoading());
final CarSelection? stored = await repository.getSelection();
final CarSelection? stored = await repository.getSelection(event.userId);
final today = DateTime.now();
final bool validForToday =
@ -72,6 +72,7 @@ class CarSelectBloc extends Bloc<CarSelectEvent, CarSelectState> {
try {
final today = DateTime.now();
await repository.saveSelection(
event.userId,
CarSelection(
date: today,
selectedCarId: event.car.id,

View File

@ -2,14 +2,20 @@ import 'package:hl_lieferservice/model/car.dart';
abstract class CarSelectEvent {}
/// Fired at app startup to check if a car has already been selected for today.
class CarSelectLoad extends CarSelectEvent {}
/// Fired at app startup to check if a car has already been selected for today
/// for the given user.
class CarSelectLoad extends CarSelectEvent {
final String userId;
CarSelectLoad({required this.userId});
}
/// Fired when the driver confirms their car choice for the day.
class CarSelectConfirm extends CarSelectEvent {
final String userId;
final Car car;
CarSelectConfirm({required this.car});
CarSelectConfirm({required this.userId, required this.car});
}
/// Fired when the driver wants to switch to a different car.
@ -22,4 +28,4 @@ class CarSelectCancel extends CarSelectEvent {
final Car car;
CarSelectCancel({required this.car});
}
}