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:
@@ -7,6 +7,7 @@ import 'package:real_estate_mobile/core/widgets/s3_image.dart';
|
||||
import 'package:real_estate_mobile/features/agents/data/models/agent_profile.dart';
|
||||
import 'package:real_estate_mobile/features/agents/data/models/agent_type.dart';
|
||||
import 'package:real_estate_mobile/features/agents/presentation/providers/search_agents_provider.dart';
|
||||
import 'package:real_estate_mobile/features/agents/presentation/widgets/agent_filter_sheet.dart';
|
||||
import 'package:real_estate_mobile/features/home/presentation/widgets/home_header.dart';
|
||||
|
||||
class AgentSearchScreen extends ConsumerStatefulWidget {
|
||||
@@ -52,6 +53,27 @@ class _AgentSearchScreenState extends ConsumerState<AgentSearchScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
void _openFilterSheet() {
|
||||
final state = ref.read(searchAgentsProvider);
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder: (_) => AgentFilterSheet(
|
||||
filterFields: state.filterFields,
|
||||
agentTypes: state.agentTypes,
|
||||
currentFilters: state.activeFilters,
|
||||
selectedAgentTypeId: state.selectedAgentTypeId,
|
||||
onApply: (filters) {
|
||||
ref.read(searchAgentsProvider.notifier).applyFilters(filters);
|
||||
},
|
||||
onClearAll: () {
|
||||
ref.read(searchAgentsProvider.notifier).clearFilters();
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final state = ref.watch(searchAgentsProvider);
|
||||
@@ -222,20 +244,23 @@ class _AgentSearchScreenState extends ConsumerState<AgentSearchScreen> {
|
||||
const SizedBox(width: 8),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 24),
|
||||
child: Container(
|
||||
width: 39,
|
||||
height: 27,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
border: Border.all(
|
||||
color: AppColors.primaryDark,
|
||||
width: 0.1,
|
||||
child: GestureDetector(
|
||||
onTap: () => _openFilterSheet(),
|
||||
child: Container(
|
||||
width: 39,
|
||||
height: 27,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
border: Border.all(
|
||||
color: AppColors.primaryDark,
|
||||
width: 0.1,
|
||||
),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.tune,
|
||||
color: AppColors.primaryDark,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.tune,
|
||||
color: AppColors.primaryDark,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user