diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index 9486a7c..736aabb 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -261,6 +261,9 @@ class GlobalConsts { static int maxFileCount = 7; static int maxFileSizeInBytes = 2 * 1024 * 1024; + + static int providerDealerRoleTypeId = 6; + static int providerIndividualRoleTypeId = 5; } class MyAssets { diff --git a/lib/views/advertisement/ad_creation_steps/vehicle_details_container.dart b/lib/views/advertisement/ad_creation_steps/vehicle_details_container.dart index bfbf338..a1501c5 100644 --- a/lib/views/advertisement/ad_creation_steps/vehicle_details_container.dart +++ b/lib/views/advertisement/ad_creation_steps/vehicle_details_container.dart @@ -60,14 +60,22 @@ class VehicleDetails extends StatelessWidget { Builder(builder: (context) { List vehicleSellerTypesDrop = []; for (var element in adVM.vehicleSellerTypes) { + log("${element.id} : ${element.sellerType}"); vehicleSellerTypesDrop.add(DropValue(element.id?.toInt() ?? 0, element.sellerType ?? "", "")); } DropValue? model; + int index = -1; if (AppState().userType == UserType.providerDealer) { - model = vehicleSellerTypesDrop.firstWhere((element) => element.id == 2); + index = vehicleSellerTypesDrop.indexWhere((element) => element.id == GlobalConsts.providerDealerRoleTypeId); } else { - model = vehicleSellerTypesDrop.firstWhere((element) => element.id == 1); + index = vehicleSellerTypesDrop.indexWhere((element) => element.id == GlobalConsts.providerIndividualRoleTypeId); + } + + if (index == -1) { + model = vehicleSellerTypesDrop.first; + } else { + model = vehicleSellerTypesDrop[index]; } adVM.updateSelectionVehicleSellerTypeId(SelectionModel(selectedId: model.id, selectedOption: model.value), needRefresh: false);