Added separate car loaded event
This commit is contained in:
@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user