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/appointments_view_model.dart

34 lines
1.1 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:mc_common_app/models/widgets_models.dart';
import 'package:mc_common_app/repositories/common_repo.dart';
import 'package:mc_common_app/services/services.dart';
class AppointmentsVM extends ChangeNotifier {
final CommonRepo commonRepo;
final CommonServices commonServices;
AppointmentsVM({required this.commonServices, required this.commonRepo});
List<FilterListModel> appointmentsFilterOptions = [];
populateAppointmentsFilterList() {
appointmentsFilterOptions.clear();
appointmentsFilterOptions = [
FilterListModel(title: "All Appointments", isSelected: true),
FilterListModel(title: "Booked", isSelected: false),
FilterListModel(title: "Confirmed", isSelected: false),
FilterListModel(title: "Arrived", isSelected: false),
];
notifyListeners();
}
applyFilterOnAppointmentsVM({required int index}) {
if (appointmentsFilterOptions.isEmpty) return;
for (var value in appointmentsFilterOptions) {
value.isSelected = false;
}
appointmentsFilterOptions[index].isSelected = true;
notifyListeners();
}
}