You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
car_common_app/lib/view_models/ad_view_model.dart

58 lines
1.5 KiB
Dart

import 'dart:io';
import 'package:mc_common_app/services/services.dart';
import 'package:mc_common_app/utils/enums.dart';
import 'package:mc_common_app/view_models/base_view_model.dart';
class AdVM extends BaseVM {
final CommonServices commonServices;
AdVM({required this.commonServices});
AdCreationStepsEnum currentProgressStep = AdCreationStepsEnum.vehicleDetails;
void updateCurrentStep() {
switch (currentProgressStep) {
case AdCreationStepsEnum.vehicleDetails:
currentProgressStep = AdCreationStepsEnum.damageParts;
notifyListeners();
break;
case AdCreationStepsEnum.damageParts:
currentProgressStep = AdCreationStepsEnum.adDuration;
notifyListeners();
break;
case AdCreationStepsEnum.adDuration:
currentProgressStep = AdCreationStepsEnum.reviewAd;
notifyListeners();
break;
case AdCreationStepsEnum.reviewAd:
break;
}
}
bool financeAvailableStatus = false;
void updateFinanceAvailableStatus(bool status) {
financeAvailableStatus = status;
notifyListeners();
}
List<File> pickedImages = [];
void removeImageFromList(int index) {
pickedImages.removeAt(index);
notifyListeners();
}
// sourceFlag for Camera = 0
// sourceFlag for Gallery = 1
void pickImageFromPhone(int sourceFlag) async {
File? file = await commonServices.pickImageFromPhone(1);
if (file != null) {
pickedImages.add(file);
notifyListeners();
}
}
}