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.
36 lines
1.3 KiB
Dart
36 lines
1.3 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/common_services.dart';
|
|
|
|
class ProvidersVM extends ChangeNotifier {
|
|
final CommonRepo commonRepo;
|
|
final CommonAppServices commonServices;
|
|
|
|
ProvidersVM({required this.commonServices, required this.commonRepo});
|
|
|
|
List<FilterListModel> providersFilterOptions = [];
|
|
|
|
populateProvidersFilterList() {
|
|
providersFilterOptions.clear();
|
|
providersFilterOptions = [
|
|
FilterListModel(title: "All Providers", isSelected: true, id: -1),
|
|
FilterListModel(title: "Maintenance", isSelected: false, id: 0),
|
|
FilterListModel(title: "Oil Service", isSelected: false, id: 1),
|
|
FilterListModel(title: "Accessories", isSelected: false, id: 2),
|
|
FilterListModel(title: "Tire Service", isSelected: false, id: 3),
|
|
FilterListModel(title: "Dent and Paint", isSelected: false, id: 4),
|
|
];
|
|
notifyListeners();
|
|
}
|
|
|
|
applyFilterOnProviders({required int index}) {
|
|
if (providersFilterOptions.isEmpty) return;
|
|
for (var value in providersFilterOptions) {
|
|
value.isSelected = false;
|
|
}
|
|
providersFilterOptions[index].isSelected = true;
|
|
notifyListeners();
|
|
}
|
|
}
|