|
|
|
|
@ -3,6 +3,7 @@ import 'package:mc_common_app/classes/app_state.dart';
|
|
|
|
|
import 'package:mc_common_app/config/dependencies.dart';
|
|
|
|
|
import 'package:mc_common_app/config/routes.dart';
|
|
|
|
|
import 'package:mc_common_app/extensions/int_extensions.dart';
|
|
|
|
|
import 'package:mc_common_app/extensions/string_extensions.dart';
|
|
|
|
|
import 'package:mc_common_app/models/advertisment_models/ad_details_model.dart';
|
|
|
|
|
import 'package:mc_common_app/models/widgets_models.dart';
|
|
|
|
|
import 'package:mc_common_app/theme/colors.dart';
|
|
|
|
|
@ -26,11 +27,7 @@ class AdsFragment extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
List<AdDetailsModel> getAdsList(AdVM adVM) {
|
|
|
|
|
if (adVM.isExploreAdsTapped) {
|
|
|
|
|
if (adVM.exploreAdsFilteredList.isNotEmpty) {
|
|
|
|
|
return adVM.exploreAdsFilteredList;
|
|
|
|
|
} else {
|
|
|
|
|
return adVM.exploreAds;
|
|
|
|
|
}
|
|
|
|
|
return adVM.exploreAdsFilteredList;
|
|
|
|
|
}
|
|
|
|
|
if (adVM.myAdsFilteredList.isNotEmpty) {
|
|
|
|
|
return adVM.myAdsFilteredList;
|
|
|
|
|
@ -80,18 +77,21 @@ class AdsFragment extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).horPaddingMain(),
|
|
|
|
|
if (adVM.isExploreAdsTapped && adVM.exploreAds.isNotEmpty) ...[
|
|
|
|
|
if (adVM.isExploreAdsTapped) ...[
|
|
|
|
|
16.height,
|
|
|
|
|
FiltersList(filterList: adVM.exploreAdsFilterOptions, onFilterTapped: (index, selectedFilterId) => adVM.applyFilterOnExploreAds(index: index), needLeftPadding: false)
|
|
|
|
|
FiltersList(
|
|
|
|
|
filterList: adVM.exploreAdsFilterOptions,
|
|
|
|
|
onFilterTapped: (index, selectedFilterId) => adVM.applyFilterOnExploreAds(index: index, createdByRoleFilter: selectedFilterId.toCreatedByRoleEnum()),
|
|
|
|
|
needLeftPadding: false)
|
|
|
|
|
.paddingOnly(left: 21),
|
|
|
|
|
],
|
|
|
|
|
if (!adVM.isExploreAdsTapped && adVM.myAds.isNotEmpty) ...[
|
|
|
|
|
if (!adVM.isExploreAdsTapped) ...[
|
|
|
|
|
16.height,
|
|
|
|
|
FiltersList(
|
|
|
|
|
filterList: adVM.myAdsFilterOptions,
|
|
|
|
|
onFilterTapped: (index, selectedFilterId) => adVM.applyFilterOnMyAds(index: index, selectedFilterId: selectedFilterId),
|
|
|
|
|
needLeftPadding: false)
|
|
|
|
|
.paddingOnly(left: 21),
|
|
|
|
|
filterList: adVM.myAdsFilterOptions,
|
|
|
|
|
onFilterTapped: (index, selectedFilterId) => adVM.applyFilterOnMyAds(index: index, adPostStatusEnum: selectedFilterId.toAdPostEnum()),
|
|
|
|
|
needLeftPadding: false,
|
|
|
|
|
).paddingOnly(left: 21),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
@ -113,22 +113,6 @@ class AdsFragment extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
floatingActionButton: FloatingActionButton(
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
final adVM = context.read<AdVM>();
|
|
|
|
|
if (adVM.vehicleTypes.isEmpty) {
|
|
|
|
|
await adVM.getVehicleTypes();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (adVM.vehicleAdsDurations.isEmpty) {
|
|
|
|
|
await adVM.getVehicleAdsDuration();
|
|
|
|
|
}
|
|
|
|
|
adVM.updateVehicleAdDurationId(
|
|
|
|
|
SelectionModel(
|
|
|
|
|
selectedId: adVM.vehicleAdsDurations.first.id ?? 0,
|
|
|
|
|
selectedOption: "${adVM.vehicleAdsDurations.first.days} Days",
|
|
|
|
|
itemPrice: adVM.vehicleAdsDurations.first.price!.toInt().toString(),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
navigateWithName(context, AppRoutes.selectAdTypeView, arguments: injector.get<AppState>().currentAppType == AppType.provider);
|
|
|
|
|
},
|
|
|
|
|
backgroundColor: MyColors.darkPrimaryColor,
|
|
|
|
|
|