feat: Implement agent filtering by integrating a new API endpoint for filterable fields, introducing filter data models, and adding a dedicated filter sheet UI, alongside an updated profile icon.
This commit is contained in:
39
lib/features/agents/data/models/filterable_field.dart
Normal file
39
lib/features/agents/data/models/filterable_field.dart
Normal file
@@ -0,0 +1,39 @@
|
||||
class FilterOption {
|
||||
final String value;
|
||||
final String label;
|
||||
|
||||
const FilterOption({required this.value, required this.label});
|
||||
|
||||
factory FilterOption.fromJson(Map<String, dynamic> json) {
|
||||
return FilterOption(
|
||||
value: json['value'] as String? ?? '',
|
||||
label: json['label'] as String? ?? '',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class FilterableField {
|
||||
final String slug;
|
||||
final String name;
|
||||
final String fieldType;
|
||||
final List<FilterOption> options;
|
||||
|
||||
const FilterableField({
|
||||
required this.slug,
|
||||
required this.name,
|
||||
required this.fieldType,
|
||||
this.options = const [],
|
||||
});
|
||||
|
||||
factory FilterableField.fromJson(Map<String, dynamic> json) {
|
||||
return FilterableField(
|
||||
slug: json['slug'] as String? ?? '',
|
||||
name: json['name'] as String? ?? '',
|
||||
fieldType: json['fieldType'] as String? ?? '',
|
||||
options: (json['options'] as List<dynamic>?)
|
||||
?.map((e) => FilterOption.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
const [],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user