Added separate car loaded event

This commit is contained in:
Dennis Nemec
2026-01-09 13:02:15 +01:00
parent c2f574014a
commit da0f77e35d
3 changed files with 43 additions and 15 deletions

View File

@ -58,17 +58,10 @@ class _CarManagementPageState extends State<CarManagementPage> {
listener: (context, state) {
if (state is CarsLoaded &&
context.read<TourBloc>().state is TourLoaded) {
var tour =
(context.read<TourBloc>().state as TourLoaded).tour.copyWith();
tour.driver.cars = state.cars;
context.read<TourBloc>().add(
TourUpdated(tour: tour, payments: tour.paymentMethods),
);
context.read<TourBloc>().add(CarsLoadedEvent(cars: state.cars));
}
},
builder: (context, state) {
debugPrint('BlocBuilder rebuilding with state: $state');
if (state is CarsLoading) {
return Center(child: const CircularProgressIndicator());
}