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_customer_app/lib/view_models/ad_view_model.dart

44 lines
1.0 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(AdCreationStepsEnum stepsEnum) {
currentProgressStep = stepsEnum;
notifyListeners();
}
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();
}
}
}