feat: Implement agent network management and refactor app navigation with a new AppShell component.

This commit is contained in:
pradeepkumar
2026-03-08 16:05:08 +05:30
parent b4d22df8ba
commit 0362d7cfe0
25 changed files with 1545 additions and 1423 deletions

View File

@@ -4,31 +4,23 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:real_estate_mobile/core/constants/app_colors.dart'; import 'package:real_estate_mobile/core/constants/app_colors.dart';
import 'package:real_estate_mobile/features/auth/presentation/providers/auth_provider.dart'; import 'package:real_estate_mobile/features/auth/presentation/providers/auth_provider.dart';
import 'package:real_estate_mobile/features/home/presentation/widgets/home_header.dart';
class MessagingShell extends ConsumerWidget { /// Determines which tab is active based on the current route.
final Widget child; int _currentTabIndex(BuildContext context) {
final location = GoRouterState.of(context).matchedLocation;
if (location.startsWith('/messages')) return 2;
if (location.startsWith('/agents/search')) return 1;
if (location.startsWith('/profile')) return 3;
return 0; // home and everything else
}
const MessagingShell({super.key, required this.child}); class AppBottomNavBar extends ConsumerWidget {
const AppBottomNavBar({super.key});
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
return Scaffold( final selectedIndex = _currentTabIndex(context);
backgroundColor: Colors.white,
body: Column(
children: [
SafeArea(
bottom: false,
child: const HomeHeader(),
),
Expanded(child: child),
],
),
bottomNavigationBar: _buildBottomNavBar(context, ref),
);
}
Widget _buildBottomNavBar(BuildContext context, WidgetRef ref) {
return Container( return Container(
decoration: const BoxDecoration( decoration: const BoxDecoration(
color: Colors.white, color: Colors.white,
@@ -43,39 +35,42 @@ class MessagingShell extends ConsumerWidget {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
_buildNavItem( _NavItem(
context: context,
svgPath: 'assets/icons/nav_home_icon.svg', svgPath: 'assets/icons/nav_home_icon.svg',
fallbackIcon: Icons.home, fallbackIcon: Icons.home,
isSelected: false, isSelected: selectedIndex == 0,
onTap: () => context.go('/home'), onTap: () => context.go('/home'),
), ),
_buildNavItem( _NavItem(
context: context,
svgPath: 'assets/icons/nav_list_icon.svg', svgPath: 'assets/icons/nav_list_icon.svg',
fallbackIcon: Icons.list, fallbackIcon: Icons.list,
isSelected: false, isSelected: selectedIndex == 1,
onTap: () => context.push('/agents/search'), onTap: () => context.go('/agents/search'),
), ),
_buildNavItem( _NavItem(
context: context,
svgPath: 'assets/icons/nav_messages_icon.svg', svgPath: 'assets/icons/nav_messages_icon.svg',
fallbackIcon: Icons.chat_bubble, fallbackIcon: Icons.chat_bubble,
isSelected: true, isSelected: selectedIndex == 2,
onTap: () => context.go('/messages'),
),
_buildNavItem(
context: context,
svgPath: 'assets/icons/nav_profile_icon.svg',
fallbackIcon: Icons.person_outline,
isSelected: false,
onTap: () { onTap: () {
final authState = ref.read(authProvider); final authState = ref.read(authProvider);
if (authState.status != AuthStatus.authenticated) { if (authState.status != AuthStatus.authenticated) {
context.push('/login'); context.push('/login');
return; return;
} }
context.push('/profile'); context.go('/messages');
},
),
_NavItem(
svgPath: 'assets/icons/nav_profile_icon.svg',
fallbackIcon: Icons.person_outline,
isSelected: selectedIndex == 3,
onTap: () {
final authState = ref.read(authProvider);
if (authState.status != AuthStatus.authenticated) {
context.push('/login');
return;
}
context.go('/profile');
}, },
), ),
], ],
@@ -84,14 +79,23 @@ class MessagingShell extends ConsumerWidget {
), ),
); );
} }
}
Widget _buildNavItem({ class _NavItem extends StatelessWidget {
required BuildContext context, final String svgPath;
required String svgPath, final IconData fallbackIcon;
required IconData fallbackIcon, final bool isSelected;
required bool isSelected, final VoidCallback onTap;
required VoidCallback onTap,
}) { const _NavItem({
required this.svgPath,
required this.fallbackIcon,
required this.isSelected,
required this.onTap,
});
@override
Widget build(BuildContext context) {
return GestureDetector( return GestureDetector(
onTap: onTap, onTap: onTap,
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
@@ -102,7 +106,8 @@ class MessagingShell extends ConsumerWidget {
width: 24, width: 24,
height: 24, height: 24,
colorFilter: isSelected colorFilter: isSelected
? const ColorFilter.mode(AppColors.primaryDark, BlendMode.srcIn) ? const ColorFilter.mode(
AppColors.primaryDark, BlendMode.srcIn)
: const ColorFilter.mode( : const ColorFilter.mode(
AppColors.accentOrange, BlendMode.srcIn), AppColors.accentOrange, BlendMode.srcIn),
placeholderBuilder: (_) => Icon( placeholderBuilder: (_) => Icon(

View File

@@ -0,0 +1,44 @@
import 'package:flutter/material.dart';
import 'package:real_estate_mobile/core/widgets/app_bottom_nav_bar.dart';
import 'package:real_estate_mobile/features/home/presentation/widgets/home_header.dart';
/// Root shell that provides the persistent header and bottom nav bar.
/// Only the content area (child) swaps when navigating between tabs.
class AppShell extends StatelessWidget {
final Widget child;
const AppShell({super.key, required this.child});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Column(
children: [
SafeArea(
bottom: false,
child: const HomeHeader(),
),
Expanded(
child: AnimatedSwitcher(
duration: const Duration(milliseconds: 200),
switchInCurve: Curves.easeOut,
switchOutCurve: Curves.easeIn,
transitionBuilder: (child, animation) {
return FadeTransition(
opacity: animation,
child: child,
);
},
child: KeyedSubtree(
key: ValueKey(child.runtimeType),
child: child,
),
),
),
],
),
bottomNavigationBar: const AppBottomNavBar(),
);
}
}

View File

@@ -1,12 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:real_estate_mobile/core/constants/app_colors.dart'; import 'package:real_estate_mobile/core/constants/app_colors.dart';
import 'package:real_estate_mobile/core/network/api_client.dart'; import 'package:real_estate_mobile/core/network/api_client.dart';
import 'package:real_estate_mobile/core/widgets/s3_image.dart'; import 'package:real_estate_mobile/core/widgets/s3_image.dart';
import 'package:real_estate_mobile/features/auth/presentation/providers/auth_provider.dart';
import 'package:real_estate_mobile/features/home/presentation/widgets/home_header.dart';
// ── Data models (matching web CMS types) ── // ── Data models (matching web CMS types) ──
@@ -305,21 +302,15 @@ class AboutScreen extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final state = ref.watch(_aboutProvider); final state = ref.watch(_aboutProvider);
return Scaffold( if (state.isLoading) {
backgroundColor: Colors.white, return const Center(
body: SafeArea(
bottom: false,
child: Column(
children: [
const HomeHeader(),
Expanded(
child: state.isLoading
? const Center(
child: CircularProgressIndicator( child: CircularProgressIndicator(
color: AppColors.accentOrange, color: AppColors.accentOrange,
), ),
) );
: SingleChildScrollView( }
return SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(), physics: const AlwaysScrollableScrollPhysics(),
child: Column( child: Column(
children: [ children: [
@@ -349,12 +340,6 @@ class AboutScreen extends ConsumerWidget {
const SizedBox(height: 30), const SizedBox(height: 30),
], ],
), ),
),
),
],
),
),
bottomNavigationBar: _buildBottomNavBar(context, ref),
); );
} }
@@ -854,105 +839,6 @@ class AboutScreen extends ConsumerWidget {
); );
} }
// -- Bottom Navigation Bar --
Widget _buildBottomNavBar(BuildContext context, WidgetRef ref) {
return Container(
decoration: const BoxDecoration(
color: Colors.white,
border: Border(
top: BorderSide(color: Color(0xFFE8E8E8), width: 1),
),
),
child: SafeArea(
top: false,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_buildNavItem(
context: context,
ref: ref,
svgPath: 'assets/icons/nav_home_icon.svg',
fallbackIcon: Icons.home,
isSelected: false,
onTap: () => context.go('/home'),
),
_buildNavItem(
context: context,
ref: ref,
svgPath: 'assets/icons/nav_list_icon.svg',
fallbackIcon: Icons.list,
isSelected: false,
onTap: () => context.push('/agents/search'),
),
_buildNavItem(
context: context,
ref: ref,
svgPath: 'assets/icons/nav_messages_icon.svg',
fallbackIcon: Icons.chat_bubble,
isSelected: false,
onTap: () {
final authState = ref.read(authProvider);
if (authState.status != AuthStatus.authenticated) {
context.push('/login');
return;
}
context.go('/messages');
},
),
_buildNavItem(
context: context,
ref: ref,
svgPath: 'assets/icons/nav_profile_icon.svg',
fallbackIcon: Icons.person_outline,
isSelected: false,
onTap: () {
final authState = ref.read(authProvider);
if (authState.status != AuthStatus.authenticated) {
context.push('/login');
return;
}
context.push('/profile');
},
),
],
),
),
),
);
}
Widget _buildNavItem({
required BuildContext context,
required WidgetRef ref,
required String svgPath,
required IconData fallbackIcon,
required bool isSelected,
required VoidCallback onTap,
}) {
return GestureDetector(
onTap: onTap,
behavior: HitTestBehavior.opaque,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: SvgPicture.asset(
svgPath,
width: 24,
height: 24,
colorFilter: isSelected
? const ColorFilter.mode(AppColors.primaryDark, BlendMode.srcIn)
: const ColorFilter.mode(
AppColors.accentOrange, BlendMode.srcIn),
placeholderBuilder: (_) => Icon(
fallbackIcon,
size: 24,
color: isSelected ? AppColors.primaryDark : AppColors.accentOrange,
),
),
),
);
}
} }
class _TeamMemberPlaceholder extends StatelessWidget { class _TeamMemberPlaceholder extends StatelessWidget {

View File

@@ -195,6 +195,33 @@ class AgentsRepository {
} }
} }
/// Get received connection requests: GET /connection-requests/received?status=...
Future<List<Map<String, dynamic>>> getReceivedRequests(String status) async {
try {
final response = await _dio.get(
'${ApiConstants.connectionRequests}/received',
queryParameters: {'status': status},
);
final data = response.data['data'] as List<dynamic>? ?? [];
return data.cast<Map<String, dynamic>>();
} on DioException catch (_) {
return [];
}
}
/// Respond to connection request: PATCH /connection-requests/{id}/respond
Future<bool> respondToRequest(String requestId, String status) async {
try {
await _dio.patch(
'${ApiConstants.connectionRequests}/$requestId/respond',
data: {'status': status},
);
return true;
} on DioException catch (_) {
return false;
}
}
/// Get agent types: GET /agent-types /// Get agent types: GET /agent-types
/// Response: { success, data: [...] } /// Response: { success, data: [...] }
Future<List<AgentType>> getAgentTypes() async { Future<List<AgentType>> getAgentTypes() async {

View File

@@ -0,0 +1,124 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:real_estate_mobile/features/agents/data/agents_repository.dart';
class AgentNetworkState {
final List<Map<String, dynamic>> pendingRequests;
final List<Map<String, dynamic>> connections;
final bool isLoading;
final String? error;
final Set<String> processingIds;
const AgentNetworkState({
this.pendingRequests = const [],
this.connections = const [],
this.isLoading = true,
this.error,
this.processingIds = const {},
});
AgentNetworkState copyWith({
List<Map<String, dynamic>>? pendingRequests,
List<Map<String, dynamic>>? connections,
bool? isLoading,
String? error,
Set<String>? processingIds,
bool clearError = false,
}) {
return AgentNetworkState(
pendingRequests: pendingRequests ?? this.pendingRequests,
connections: connections ?? this.connections,
isLoading: isLoading ?? this.isLoading,
error: clearError ? null : (error ?? this.error),
processingIds: processingIds ?? this.processingIds,
);
}
}
class AgentNetworkNotifier extends StateNotifier<AgentNetworkState> {
final AgentsRepository _repo;
AgentNetworkNotifier(this._repo) : super(const AgentNetworkState()) {
loadData();
}
Future<void> loadData() async {
state = state.copyWith(isLoading: true, clearError: true);
try {
final results = await Future.wait([
_repo.getReceivedRequests('PENDING'),
_repo.getReceivedRequests('ACCEPTED'),
]);
state = state.copyWith(
pendingRequests: results[0],
connections: results[1],
isLoading: false,
);
} catch (e) {
state = state.copyWith(
isLoading: false,
error: 'Failed to load network data',
);
}
}
Future<void> acceptRequest(String requestId) async {
if (state.processingIds.contains(requestId)) return;
state = state.copyWith(
processingIds: {...state.processingIds, requestId},
);
final success = await _repo.respondToRequest(requestId, 'ACCEPTED');
if (success) {
// Move from pending to connections
final request = state.pendingRequests.firstWhere(
(r) => r['id'] == requestId,
orElse: () => <String, dynamic>{},
);
state = state.copyWith(
pendingRequests:
state.pendingRequests.where((r) => r['id'] != requestId).toList(),
connections: request.isNotEmpty
? [request, ...state.connections]
: state.connections,
processingIds: state.processingIds
.where((id) => id != requestId)
.toSet(),
);
} else {
state = state.copyWith(
processingIds: state.processingIds
.where((id) => id != requestId)
.toSet(),
);
}
}
Future<void> rejectRequest(String requestId) async {
if (state.processingIds.contains(requestId)) return;
state = state.copyWith(
processingIds: {...state.processingIds, requestId},
);
final success = await _repo.respondToRequest(requestId, 'REJECTED');
if (success) {
state = state.copyWith(
pendingRequests:
state.pendingRequests.where((r) => r['id'] != requestId).toList(),
processingIds: state.processingIds
.where((id) => id != requestId)
.toSet(),
);
} else {
state = state.copyWith(
processingIds: state.processingIds
.where((id) => id != requestId)
.toSet(),
);
}
}
}
final agentNetworkProvider =
StateNotifierProvider.autoDispose<AgentNetworkNotifier, AgentNetworkState>(
(ref) => AgentNetworkNotifier(AgentsRepository()),
);

View File

@@ -1,13 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:real_estate_mobile/core/constants/app_colors.dart'; import 'package:real_estate_mobile/core/constants/app_colors.dart';
import 'package:real_estate_mobile/core/widgets/s3_image.dart'; 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_profile.dart';
import 'package:real_estate_mobile/features/agents/presentation/providers/agent_detail_provider.dart'; import 'package:real_estate_mobile/features/agents/presentation/providers/agent_detail_provider.dart';
import 'package:real_estate_mobile/features/auth/presentation/providers/auth_provider.dart'; import 'package:real_estate_mobile/features/auth/presentation/providers/auth_provider.dart';
import 'package:real_estate_mobile/features/home/presentation/widgets/home_header.dart';
class AgentDetailScreen extends ConsumerStatefulWidget { class AgentDetailScreen extends ConsumerStatefulWidget {
final String agentId; final String agentId;
@@ -41,16 +39,14 @@ class _AgentDetailScreenState extends ConsumerState<AgentDetailScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final state = ref.watch(agentDetailProvider(widget.agentId)); final state = ref.watch(agentDetailProvider(widget.agentId));
return Scaffold( if (state.isLoading) {
backgroundColor: Colors.white, return const Center(
body: state.isLoading child: CircularProgressIndicator(color: AppColors.accentOrange));
? const Center( }
child: CircularProgressIndicator(color: AppColors.accentOrange)) if (state.error != null) {
: state.error != null return _buildError(state.error!);
? _buildError(state.error!) }
: _buildContent(state), return _buildContent(state);
bottomNavigationBar: _buildBottomNavBar(),
);
} }
Widget _buildError(String error) { Widget _buildError(String error) {
@@ -86,8 +82,6 @@ class _AgentDetailScreenState extends ConsumerState<AgentDetailScreen> {
return SingleChildScrollView( return SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
SafeArea(bottom: false, child: const HomeHeader()),
// ── Avatar Section ── // ── Avatar Section ──
const SizedBox(height: 16), const SizedBox(height: 16),
_buildAvatarSection(agent), _buildAvatarSection(agent),
@@ -1033,90 +1027,6 @@ class _AgentDetailScreenState extends ConsumerState<AgentDetailScreen> {
); );
} }
// ── Bottom Nav ──
Widget _buildBottomNavBar() {
return Container(
decoration: const BoxDecoration(
color: Colors.white,
border: Border(top: BorderSide(color: Color(0xFFE8E8E8), width: 1)),
),
child: SafeArea(
top: false,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_buildNavItem(
svgPath: 'assets/icons/nav_home_icon.svg',
fallbackIcon: Icons.home,
onTap: () => context.go('/home'),
),
_buildNavItem(
svgPath: 'assets/icons/nav_list_icon.svg',
fallbackIcon: Icons.list,
isSelected: true,
onTap: () => context.go('/agents/search'),
),
_buildNavItem(
svgPath: 'assets/icons/nav_messages_icon.svg',
fallbackIcon: Icons.chat_bubble,
onTap: () {
if (ref.read(authProvider).status !=
AuthStatus.authenticated) {
context.push('/login');
return;
}
context.go('/messages');
},
),
_buildNavItem(
svgPath: 'assets/icons/nav_profile_icon.svg',
fallbackIcon: Icons.person_outline,
onTap: () {
if (ref.read(authProvider).status !=
AuthStatus.authenticated) {
context.push('/login');
return;
}
context.push('/profile');
},
),
],
),
),
),
);
}
Widget _buildNavItem({
required String svgPath,
required IconData fallbackIcon,
bool isSelected = false,
required VoidCallback onTap,
}) {
return GestureDetector(
onTap: onTap,
behavior: HitTestBehavior.opaque,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: SvgPicture.asset(
svgPath,
width: 24,
height: 24,
colorFilter: ColorFilter.mode(
isSelected ? AppColors.primaryDark : AppColors.accentOrange,
BlendMode.srcIn,
),
placeholderBuilder: (_) => Icon(
fallbackIcon,
size: 24,
color: isSelected ? AppColors.primaryDark : AppColors.accentOrange,
),
),
),
);
}
} }
// ── Expandable Chips Section ── // ── Expandable Chips Section ──

View File

@@ -1,13 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:go_router/go_router.dart';
import 'package:real_estate_mobile/core/constants/app_colors.dart'; import 'package:real_estate_mobile/core/constants/app_colors.dart';
import 'package:real_estate_mobile/core/widgets/s3_image.dart'; 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_profile.dart';
import 'package:real_estate_mobile/features/agents/presentation/providers/agent_detail_provider.dart'; import 'package:real_estate_mobile/features/agents/presentation/providers/agent_detail_provider.dart';
import 'package:real_estate_mobile/features/auth/presentation/providers/auth_provider.dart';
import 'package:real_estate_mobile/features/home/presentation/widgets/home_header.dart';
import 'package:real_estate_mobile/features/profile/data/profile_repository.dart'; import 'package:real_estate_mobile/features/profile/data/profile_repository.dart';
/// Provider that fetches the agent's own profile ID from /agents/profile/me /// Provider that fetches the agent's own profile ID from /agents/profile/me
@@ -30,18 +27,13 @@ class AgentHomeScreen extends ConsumerWidget {
final myProfileAsync = ref.watch(_agentMyProfileProvider); final myProfileAsync = ref.watch(_agentMyProfileProvider);
return myProfileAsync.when( return myProfileAsync.when(
loading: () => const Scaffold( loading: () => const Center(
backgroundColor: Colors.white,
body: Center(
child: CircularProgressIndicator( child: CircularProgressIndicator(
color: AppColors.accentOrange, color: AppColors.accentOrange,
strokeWidth: 2, strokeWidth: 2,
), ),
), ),
), error: (_, __) => Center(
error: (_, __) => Scaffold(
backgroundColor: Colors.white,
body: Center(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
@@ -63,18 +55,14 @@ class AgentHomeScreen extends ConsumerWidget {
], ],
), ),
), ),
),
data: (agentProfileId) { data: (agentProfileId) {
if (agentProfileId == null) { if (agentProfileId == null) {
return const Scaffold( return const Center(
backgroundColor: Colors.white,
body: Center(
child: Text('No agent profile found', child: Text('No agent profile found',
style: TextStyle( style: TextStyle(
fontFamily: 'Fractul', fontFamily: 'Fractul',
fontSize: 16, fontSize: 16,
color: AppColors.primaryDark)), color: AppColors.primaryDark)),
),
); );
} }
return _AgentHomeContent(agentProfileId: agentProfileId); return _AgentHomeContent(agentProfileId: agentProfileId);
@@ -97,16 +85,14 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final state = ref.watch(agentDetailProvider(widget.agentProfileId)); final state = ref.watch(agentDetailProvider(widget.agentProfileId));
return Scaffold( if (state.isLoading) {
backgroundColor: Colors.white, return const Center(
body: state.isLoading child: CircularProgressIndicator(color: AppColors.accentOrange));
? const Center( }
child: CircularProgressIndicator(color: AppColors.accentOrange)) if (state.error != null) {
: state.error != null return _buildError(state.error!);
? _buildError(state.error!) }
: _buildContent(state), return _buildContent(state);
bottomNavigationBar: _buildBottomNavBar(),
);
} }
Widget _buildError(String error) { Widget _buildError(String error) {
@@ -140,8 +126,6 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
return SingleChildScrollView( return SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
SafeArea(bottom: false, child: const HomeHeader()),
const SizedBox(height: 12),
_buildCoverAndAvatar(agent), _buildCoverAndAvatar(agent),
const SizedBox(height: 16), const SizedBox(height: 16),
_buildStatusSection(agent), _buildStatusSection(agent),
@@ -968,97 +952,6 @@ class _AgentHomeContentState extends ConsumerState<_AgentHomeContent> {
); );
} }
// ── Bottom Navigation Bar ──
Widget _buildBottomNavBar() {
return Container(
decoration: const BoxDecoration(
color: Colors.white,
border: Border(
top: BorderSide(color: Color(0xFFE8E8E8), width: 1),
),
),
child: SafeArea(
top: false,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_buildNavItem(
svgPath: 'assets/icons/nav_home_icon.svg',
fallbackIcon: Icons.home,
isSelected: true,
onTap: () {},
),
_buildNavItem(
svgPath: 'assets/icons/nav_list_icon.svg',
fallbackIcon: Icons.list,
isSelected: false,
onTap: () => context.push('/agents/search'),
),
_buildNavItem(
svgPath: 'assets/icons/nav_messages_icon.svg',
fallbackIcon: Icons.chat_bubble,
isSelected: false,
onTap: () {
final authState = ref.read(authProvider);
if (authState.status != AuthStatus.authenticated) {
context.push('/login');
return;
}
context.push('/messages');
},
),
_buildNavItem(
svgPath: 'assets/icons/nav_profile_icon.svg',
fallbackIcon: Icons.person_outline,
isSelected: false,
onTap: () {
final authState = ref.read(authProvider);
if (authState.status != AuthStatus.authenticated) {
context.push('/login');
return;
}
context.push('/profile');
},
),
],
),
),
),
);
}
Widget _buildNavItem({
required String svgPath,
required IconData fallbackIcon,
required bool isSelected,
required VoidCallback onTap,
}) {
return GestureDetector(
onTap: onTap,
behavior: HitTestBehavior.opaque,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: SvgPicture.asset(
svgPath,
width: 24,
height: 24,
colorFilter: isSelected
? const ColorFilter.mode(
AppColors.primaryDark, BlendMode.srcIn)
: const ColorFilter.mode(
AppColors.accentOrange, BlendMode.srcIn),
placeholderBuilder: (_) => Icon(
fallbackIcon,
size: 24,
color:
isSelected ? AppColors.primaryDark : AppColors.accentOrange,
),
),
),
);
}
} }
// ── Testimonial Card (same as agent detail screen) ── // ── Testimonial Card (same as agent detail screen) ──

View File

@@ -0,0 +1,521 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import 'package:intl/intl.dart';
import 'package:real_estate_mobile/core/constants/app_colors.dart';
import 'package:real_estate_mobile/core/widgets/s3_image.dart';
import 'package:real_estate_mobile/features/agents/presentation/providers/agent_network_provider.dart';
class AgentNetworkScreen extends ConsumerWidget {
const AgentNetworkScreen({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final state = ref.watch(agentNetworkProvider);
if (state.isLoading) {
return const Center(
child: CircularProgressIndicator(color: AppColors.accentOrange));
}
if (state.error != null) {
return _buildError(context, ref, state.error!);
}
return _buildContent(context, ref, state);
}
Widget _buildError(BuildContext context, WidgetRef ref, String error) {
return Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(Icons.error_outline,
size: 48, color: AppColors.accentOrange),
const SizedBox(height: 16),
Text(error,
style: const TextStyle(
fontFamily: 'Fractul',
fontSize: 16,
fontWeight: FontWeight.w600,
color: AppColors.primaryDark,
)),
const SizedBox(height: 12),
TextButton(
onPressed: () =>
ref.read(agentNetworkProvider.notifier).loadData(),
child: const Text('Try Again',
style: TextStyle(color: AppColors.accentOrange)),
),
],
),
);
}
Widget _buildContent(
BuildContext context, WidgetRef ref, AgentNetworkState state) {
return RefreshIndicator(
color: AppColors.accentOrange,
onRefresh: () => ref.read(agentNetworkProvider.notifier).loadData(),
child: SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 12),
// ── Pending Requests Section ──
if (state.pendingRequests.isNotEmpty) ...[
_buildSectionHeader('Pending Requests',
count: state.pendingRequests.length),
const SizedBox(height: 12),
...state.pendingRequests.map((request) => _RequestCard(
data: request,
isProcessing:
state.processingIds.contains(request['id']),
)),
const SizedBox(height: 16),
Divider(
color: AppColors.primaryDark.withValues(alpha: 0.1),
height: 1),
const SizedBox(height: 16),
],
// ── Manage My Network Section ──
_buildManageNetworkHeader(context),
const SizedBox(height: 12),
if (state.connections.isEmpty)
_buildEmptyState(
icon: Icons.people_outline,
message: 'No connections yet',
subtitle:
'When you accept connection requests, they will appear here.',
)
else
...state.connections
.map((conn) => _ConnectionCard(data: conn)),
const SizedBox(height: 24),
],
),
),
);
}
Widget _buildSectionHeader(String title, {int? count}) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Row(
children: [
Text(
title,
style: const TextStyle(
fontFamily: 'Fractul',
fontSize: 16,
fontWeight: FontWeight.w600,
color: AppColors.primaryDark,
),
),
if (count != null && count > 0) ...[
const SizedBox(width: 8),
Container(
padding:
const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
decoration: BoxDecoration(
color: AppColors.accentOrange,
borderRadius: BorderRadius.circular(10),
),
child: Text(
'$count',
style: const TextStyle(
fontFamily: 'Fractul',
fontSize: 12,
fontWeight: FontWeight.w600,
color: Colors.white,
),
),
),
],
],
),
);
}
Widget _buildManageNetworkHeader(BuildContext context) {
return Container(
margin: const EdgeInsets.symmetric(horizontal: 0),
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 14),
decoration: BoxDecoration(
border: Border.all(
color: AppColors.primaryDark.withValues(alpha: 0.1),
width: 0.5),
borderRadius: BorderRadius.circular(7),
),
child: Row(
children: [
const Text(
'Manage My Network',
style: TextStyle(
fontFamily: 'Fractul',
fontSize: 14,
fontWeight: FontWeight.w600,
color: AppColors.primaryDark,
),
),
const Spacer(),
Icon(Icons.arrow_forward,
size: 20,
color: AppColors.primaryDark.withValues(alpha: 0.7)),
],
),
);
}
Widget _buildEmptyState({
required IconData icon,
required String message,
String? subtitle,
}) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 40),
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(icon, size: 48, color: AppColors.primaryDark.withValues(alpha: 0.3)),
const SizedBox(height: 12),
Text(
message,
style: const TextStyle(
fontFamily: 'Fractul',
fontSize: 16,
fontWeight: FontWeight.w600,
color: AppColors.primaryDark,
),
),
if (subtitle != null) ...[
const SizedBox(height: 6),
Text(
subtitle,
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: 'SourceSerif4',
fontSize: 14,
color: AppColors.primaryDark.withValues(alpha: 0.6),
),
),
],
],
),
),
);
}
}
// ── Relative time formatting (same as web) ──
String _formatRelativeTime(String? dateStr) {
if (dateStr == null || dateStr.isEmpty) return '';
try {
final date = DateTime.parse(dateStr);
final now = DateTime.now();
final diff = now.difference(date);
if (diff.inSeconds < 60) return 'Just now';
if (diff.inMinutes < 60) return '${diff.inMinutes}m ago';
if (diff.inHours < 24) return '${diff.inHours}h ago';
if (diff.inDays < 7) return '${diff.inDays}d ago';
return DateFormat('MMM d').format(date);
} catch (_) {
return '';
}
}
// ── Date formatting for connections ──
String _formatConnectedDate(String? dateStr) {
if (dateStr == null || dateStr.isEmpty) return '';
try {
final date = DateTime.parse(dateStr);
return 'Connected on ${DateFormat('MMM d, y').format(date)}';
} catch (_) {
return '';
}
}
// ── Request Card (pending connection requests with accept/reject) ──
class _RequestCard extends ConsumerWidget {
final Map<String, dynamic> data;
final bool isProcessing;
const _RequestCard({required this.data, required this.isProcessing});
@override
Widget build(BuildContext context, WidgetRef ref) {
final user = data['user'] as Map<String, dynamic>? ?? {};
final userName =
user['email'] as String? ?? user['name'] as String? ?? 'User';
final avatar = user['avatar'] as String?;
final message = data['message'] as String?;
final requestId = data['id'] as String;
final createdAt = data['createdAt'] as String?;
final relativeTime = _formatRelativeTime(createdAt);
return Opacity(
opacity: isProcessing ? 0.5 : 1.0,
child: AbsorbPointer(
absorbing: isProcessing,
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
child: Row(
children: [
// Avatar
ClipOval(
child: SizedBox(
width: 56,
height: 56,
child: avatar != null && avatar.isNotEmpty
? S3Image(
imageUrl: avatar,
width: 56,
height: 56,
fit: BoxFit.cover,
)
: Container(
color: const Color(0xFFE0E0E0),
child: const Icon(Icons.person,
size: 28, color: AppColors.primaryDark),
),
),
),
const SizedBox(width: 12),
// Name + message + time
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Flexible(
child: Text(
userName,
style: const TextStyle(
fontFamily: 'Fractul',
fontSize: 14,
fontWeight: FontWeight.w500,
color: AppColors.primaryDark,
),
overflow: TextOverflow.ellipsis,
),
),
const SizedBox(width: 4),
Icon(Icons.verified_user_outlined,
size: 16,
color: AppColors.primaryDark
.withValues(alpha: 0.5)),
],
),
if (message != null && message.isNotEmpty)
Text(
message,
style: const TextStyle(
fontFamily: 'SourceSerif4',
fontSize: 14,
color: AppColors.primaryDark,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Row(
children: [
Icon(Icons.link,
size: 14,
color: AppColors.primaryDark
.withValues(alpha: 0.5)),
const SizedBox(width: 4),
const Text(
'Mutual Connection',
style: TextStyle(
fontFamily: 'SourceSerif4',
fontSize: 14,
fontWeight: FontWeight.w200,
color: AppColors.primaryDark,
),
),
if (relativeTime.isNotEmpty) ...[
const Spacer(),
Text(
relativeTime,
style: TextStyle(
fontFamily: 'SourceSerif4',
fontSize: 12,
color: AppColors.primaryDark
.withValues(alpha: 0.5),
),
),
],
],
),
],
),
),
const SizedBox(width: 8),
// Reject button (X)
GestureDetector(
onTap: () => ref
.read(agentNetworkProvider.notifier)
.rejectRequest(requestId),
child: Container(
width: 33,
height: 31,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color:
AppColors.primaryDark.withValues(alpha: 0.3),
width: 1),
),
child: Icon(Icons.close,
size: 18,
color:
AppColors.primaryDark.withValues(alpha: 0.6)),
),
),
const SizedBox(width: 10),
// Accept button (checkmark)
GestureDetector(
onTap: () => ref
.read(agentNetworkProvider.notifier)
.acceptRequest(requestId),
child: Container(
width: 33,
height: 31,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: AppColors.accentOrange,
),
child: const Icon(Icons.check,
size: 20, color: Colors.white),
),
),
],
),
),
),
);
}
}
// ── Connection Card (accepted connections in Manage My Network) ──
class _ConnectionCard extends StatelessWidget {
final Map<String, dynamic> data;
const _ConnectionCard({required this.data});
@override
Widget build(BuildContext context) {
final user = data['user'] as Map<String, dynamic>? ?? {};
final userName =
user['email'] as String? ?? user['name'] as String? ?? 'User';
final userEmail = user['email'] as String? ?? '';
final avatar = user['avatar'] as String?;
final respondedAt = data['respondedAt'] as String?;
final connectedDate = _formatConnectedDate(respondedAt);
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
child: Row(
children: [
// Avatar
ClipOval(
child: SizedBox(
width: 56,
height: 56,
child: avatar != null && avatar.isNotEmpty
? S3Image(
imageUrl: avatar,
width: 56,
height: 56,
fit: BoxFit.cover,
)
: Container(
color: const Color(0xFFE0E0E0),
child: const Icon(Icons.person,
size: 28, color: AppColors.primaryDark),
),
),
),
const SizedBox(width: 12),
// Name + email + connected date
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Flexible(
child: Text(
userName,
style: const TextStyle(
fontFamily: 'Fractul',
fontSize: 14,
fontWeight: FontWeight.w500,
color: AppColors.primaryDark,
),
overflow: TextOverflow.ellipsis,
),
),
const SizedBox(width: 4),
Icon(Icons.verified_user_outlined,
size: 16,
color: AppColors.primaryDark
.withValues(alpha: 0.5)),
],
),
if (userEmail.isNotEmpty)
Text(
userEmail,
style: TextStyle(
fontFamily: 'SourceSerif4',
fontSize: 13,
color:
AppColors.primaryDark.withValues(alpha: 0.6),
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
if (connectedDate.isNotEmpty)
Text(
connectedDate,
style: TextStyle(
fontFamily: 'SourceSerif4',
fontSize: 12,
color:
AppColors.primaryDark.withValues(alpha: 0.5),
),
),
],
),
),
const SizedBox(width: 8),
// Message button
GestureDetector(
onTap: () {
// Navigate to messages — if we have userId, could create/open conversation
context.push('/messages');
},
child: Container(
width: 36,
height: 36,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: AppColors.accentOrange.withValues(alpha: 0.1),
),
child: const Icon(Icons.chat_bubble_outline,
size: 18, color: AppColors.accentOrange),
),
),
],
),
);
}
}

View File

@@ -8,8 +8,6 @@ import 'package:real_estate_mobile/features/agents/data/models/agent_profile.dar
import 'package:real_estate_mobile/features/agents/data/models/agent_type.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/providers/search_agents_provider.dart';
import 'package:real_estate_mobile/features/agents/presentation/widgets/agent_filter_sheet.dart'; import 'package:real_estate_mobile/features/agents/presentation/widgets/agent_filter_sheet.dart';
import 'package:real_estate_mobile/features/auth/presentation/providers/auth_provider.dart';
import 'package:real_estate_mobile/features/home/presentation/widgets/home_header.dart';
class AgentSearchScreen extends ConsumerStatefulWidget { class AgentSearchScreen extends ConsumerStatefulWidget {
final String? initialQuery; final String? initialQuery;
@@ -79,23 +77,14 @@ class _AgentSearchScreenState extends ConsumerState<AgentSearchScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final state = ref.watch(searchAgentsProvider); final state = ref.watch(searchAgentsProvider);
return Scaffold( return Column(
backgroundColor: Colors.white,
body: Column(
children: [ children: [
// Shared header
SafeArea(
bottom: false,
child: const HomeHeader(),
),
_buildSearchBar(), _buildSearchBar(),
const SizedBox(height: 12), const SizedBox(height: 12),
_buildFilterChips(state.agentTypes, state.selectedAgentTypeId), _buildFilterChips(state.agentTypes, state.selectedAgentTypeId),
const SizedBox(height: 12), const SizedBox(height: 12),
Expanded(child: _buildAgentList(state)), Expanded(child: _buildAgentList(state)),
], ],
),
bottomNavigationBar: _buildBottomNavBar(),
); );
} }
@@ -359,99 +348,6 @@ class _AgentSearchScreenState extends ConsumerState<AgentSearchScreen> {
); );
} }
// ── Bottom Navigation Bar (shared style matching HomeScreen) ──
Widget _buildBottomNavBar() {
return Container(
decoration: const BoxDecoration(
color: Colors.white,
border: Border(
top: BorderSide(color: Color(0xFFE8E8E8), width: 1),
),
),
child: SafeArea(
top: false,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_buildNavItem(
index: 0,
svgPath: 'assets/icons/nav_home_icon.svg',
fallbackIcon: Icons.home,
isSelected: false,
onTap: () => context.go('/home'),
),
_buildNavItem(
index: 1,
svgPath: 'assets/icons/nav_list_icon.svg',
fallbackIcon: Icons.list,
isSelected: true,
onTap: () {},
),
_buildNavItem(
index: 2,
svgPath: 'assets/icons/nav_messages_icon.svg',
fallbackIcon: Icons.chat_bubble,
isSelected: false,
onTap: () {
final authState = ref.read(authProvider);
if (authState.status != AuthStatus.authenticated) {
context.push('/login');
return;
}
context.go('/messages');
},
),
_buildNavItem(
index: 3,
svgPath: 'assets/icons/nav_profile_icon.svg',
fallbackIcon: Icons.person_outline,
isSelected: false,
onTap: () {
final authState = ref.read(authProvider);
if (authState.status != AuthStatus.authenticated) {
context.push('/login');
return;
}
context.push('/profile');
},
),
],
),
),
),
);
}
Widget _buildNavItem({
required int index,
required String svgPath,
required IconData fallbackIcon,
required bool isSelected,
required VoidCallback onTap,
}) {
return GestureDetector(
onTap: onTap,
behavior: HitTestBehavior.opaque,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: SvgPicture.asset(
svgPath,
width: 24,
height: 24,
colorFilter: isSelected
? const ColorFilter.mode(AppColors.primaryDark, BlendMode.srcIn)
: const ColorFilter.mode(AppColors.accentOrange, BlendMode.srcIn),
placeholderBuilder: (_) => Icon(
fallbackIcon,
size: 24,
color: isSelected ? AppColors.primaryDark : AppColors.accentOrange,
),
),
),
);
}
} }
// --- Agent Card Widget matching Figma design --- // --- Agent Card Widget matching Figma design ---

View File

@@ -51,7 +51,8 @@ class AuthState {
class AuthNotifier extends StateNotifier<AuthState> { class AuthNotifier extends StateNotifier<AuthState> {
final AuthRepository _repository; final AuthRepository _repository;
AuthNotifier(this._repository) : super(const AuthState()) { AuthNotifier(this._repository)
: super(const AuthState(status: AuthStatus.loading)) {
// Wire up force logout callback so API client can reset auth state // Wire up force logout callback so API client can reset auth state
// when token refresh fails // when token refresh fails
ApiClient.onForceLogout = () { ApiClient.onForceLogout = () {
@@ -61,14 +62,14 @@ class AuthNotifier extends StateNotifier<AuthState> {
} }
Future<void> checkAuthStatus() async { Future<void> checkAuthStatus() async {
state = state.copyWith(status: AuthStatus.loading);
final token = await SecureStorage.getAccessToken(); final token = await SecureStorage.getAccessToken();
if (token == null) { if (token == null) {
state = state.copyWith(status: AuthStatus.initial); state = state.copyWith(status: AuthStatus.initial);
return; return;
} }
state = state.copyWith(status: AuthStatus.loading);
try { try {
final user = await _repository.getMe(); final user = await _repository.getMe();
state = state.copyWith( state = state.copyWith(

View File

@@ -1,19 +1,15 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:real_estate_mobile/core/constants/app_colors.dart'; import 'package:real_estate_mobile/core/constants/app_colors.dart';
import 'package:real_estate_mobile/features/auth/presentation/providers/auth_provider.dart';
import 'package:real_estate_mobile/features/home/presentation/widgets/home_header.dart';
class ContactScreen extends ConsumerStatefulWidget { class ContactScreen extends StatefulWidget {
const ContactScreen({super.key}); const ContactScreen({super.key});
@override @override
ConsumerState<ContactScreen> createState() => _ContactScreenState(); State<ContactScreen> createState() => _ContactScreenState();
} }
class _ContactScreenState extends ConsumerState<ContactScreen> { class _ContactScreenState extends State<ContactScreen> {
final _nameController = TextEditingController(); final _nameController = TextEditingController();
final _emailController = TextEditingController(); final _emailController = TextEditingController();
final _phoneController = TextEditingController(); final _phoneController = TextEditingController();
@@ -31,16 +27,7 @@ class _ContactScreenState extends ConsumerState<ContactScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return ListView(
backgroundColor: Colors.white,
body: Column(
children: [
SafeArea(
bottom: false,
child: const HomeHeader(),
),
Expanded(
child: ListView(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
children: [ children: [
const SizedBox(height: 18), const SizedBox(height: 18),
@@ -55,11 +42,6 @@ class _ContactScreenState extends ConsumerState<ContactScreen> {
_buildFindAgentSection(), _buildFindAgentSection(),
const SizedBox(height: 30), const SizedBox(height: 30),
], ],
),
),
],
),
bottomNavigationBar: _buildBottomNavBar(),
); );
} }
@@ -599,93 +581,4 @@ class _ContactScreenState extends ConsumerState<ContactScreen> {
}); });
} }
// -- Bottom Navigation Bar --
Widget _buildBottomNavBar() {
return Container(
decoration: const BoxDecoration(
color: Colors.white,
border: Border(
top: BorderSide(color: Color(0xFFE8E8E8), width: 1),
),
),
child: SafeArea(
top: false,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_buildNavItem(
svgPath: 'assets/icons/nav_home_icon.svg',
fallbackIcon: Icons.home,
isSelected: false,
onTap: () => context.go('/home'),
),
_buildNavItem(
svgPath: 'assets/icons/nav_list_icon.svg',
fallbackIcon: Icons.list,
isSelected: false,
onTap: () => context.push('/agents/search'),
),
_buildNavItem(
svgPath: 'assets/icons/nav_messages_icon.svg',
fallbackIcon: Icons.chat_bubble,
isSelected: false,
onTap: () {
final authState = ref.read(authProvider);
if (authState.status != AuthStatus.authenticated) {
context.push('/login');
return;
}
context.go('/messages');
},
),
_buildNavItem(
svgPath: 'assets/icons/nav_profile_icon.svg',
fallbackIcon: Icons.person_outline,
isSelected: false,
onTap: () {
final authState = ref.read(authProvider);
if (authState.status != AuthStatus.authenticated) {
context.push('/login');
return;
}
context.push('/profile');
},
),
],
),
),
),
);
}
Widget _buildNavItem({
required String svgPath,
required IconData fallbackIcon,
required bool isSelected,
required VoidCallback onTap,
}) {
return GestureDetector(
onTap: onTap,
behavior: HitTestBehavior.opaque,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: SvgPicture.asset(
svgPath,
width: 24,
height: 24,
colorFilter: isSelected
? const ColorFilter.mode(AppColors.primaryDark, BlendMode.srcIn)
: const ColorFilter.mode(
AppColors.accentOrange, BlendMode.srcIn),
placeholderBuilder: (_) => Icon(
fallbackIcon,
size: 24,
color: isSelected ? AppColors.primaryDark : AppColors.accentOrange,
),
),
),
);
}
} }

View File

@@ -1,11 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:go_router/go_router.dart';
import 'package:real_estate_mobile/core/constants/app_colors.dart'; import 'package:real_estate_mobile/core/constants/app_colors.dart';
import 'package:real_estate_mobile/core/network/api_client.dart'; import 'package:real_estate_mobile/core/network/api_client.dart';
import 'package:real_estate_mobile/features/auth/presentation/providers/auth_provider.dart';
import 'package:real_estate_mobile/features/home/presentation/widgets/home_header.dart';
// ── Data models ── // ── Data models ──
@@ -181,21 +178,13 @@ class FaqScreen extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final state = ref.watch(faqProvider); final state = ref.watch(faqProvider);
return Scaffold( if (state.isLoading) {
backgroundColor: Colors.white, return const Center(
body: Column( child: CircularProgressIndicator(color: AppColors.accentOrange),
children: [ );
SafeArea( }
bottom: false,
child: const HomeHeader(), return ListView(
),
Expanded(
child: state.isLoading
? const Center(
child: CircularProgressIndicator(
color: AppColors.accentOrange),
)
: ListView(
padding: const EdgeInsets.fromLTRB(0, 20, 0, 30), padding: const EdgeInsets.fromLTRB(0, 20, 0, 30),
children: [ children: [
// Title // Title
@@ -227,107 +216,9 @@ class FaqScreen extends ConsumerWidget {
// Still Need Help section // Still Need Help section
const _StillNeedHelpSection(), const _StillNeedHelpSection(),
], ],
),
),
],
),
bottomNavigationBar: _buildBottomNavBar(context, ref),
); );
} }
Widget _buildBottomNavBar(BuildContext context, WidgetRef ref) {
return Container(
decoration: const BoxDecoration(
color: Colors.white,
border: Border(
top: BorderSide(color: Color(0xFFE8E8E8), width: 1),
),
),
child: SafeArea(
top: false,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_buildNavItem(
context: context,
svgPath: 'assets/icons/nav_home_icon.svg',
fallbackIcon: Icons.home,
isSelected: false,
onTap: () => context.go('/home'),
),
_buildNavItem(
context: context,
svgPath: 'assets/icons/nav_list_icon.svg',
fallbackIcon: Icons.list,
isSelected: false,
onTap: () => context.push('/agents/search'),
),
_buildNavItem(
context: context,
svgPath: 'assets/icons/nav_messages_icon.svg',
fallbackIcon: Icons.chat_bubble,
isSelected: false,
onTap: () {
final authState = ref.read(authProvider);
if (authState.status != AuthStatus.authenticated) {
context.push('/login');
return;
}
context.go('/messages');
},
),
_buildNavItem(
context: context,
svgPath: 'assets/icons/nav_profile_icon.svg',
fallbackIcon: Icons.person_outline,
isSelected: false,
onTap: () {
final authState = ref.read(authProvider);
if (authState.status != AuthStatus.authenticated) {
context.push('/login');
return;
}
context.push('/profile');
},
),
],
),
),
),
);
}
Widget _buildNavItem({
required BuildContext context,
required String svgPath,
required IconData fallbackIcon,
required bool isSelected,
required VoidCallback onTap,
}) {
return GestureDetector(
onTap: onTap,
behavior: HitTestBehavior.opaque,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: SvgPicture.asset(
svgPath,
width: 24,
height: 24,
colorFilter: isSelected
? const ColorFilter.mode(AppColors.primaryDark, BlendMode.srcIn)
: const ColorFilter.mode(
AppColors.accentOrange, BlendMode.srcIn),
placeholderBuilder: (_) => Icon(
fallbackIcon,
size: 24,
color: isSelected ? AppColors.primaryDark : AppColors.accentOrange,
),
),
),
);
}
} }
// ── Accordion item ── // ── Accordion item ──

View File

@@ -1,68 +1,21 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:go_router/go_router.dart';
import 'package:real_estate_mobile/core/constants/app_colors.dart'; import 'package:real_estate_mobile/core/constants/app_colors.dart';
import 'package:real_estate_mobile/features/auth/presentation/providers/auth_provider.dart';
import 'package:real_estate_mobile/features/home/presentation/widgets/featured_professionals_section.dart'; import 'package:real_estate_mobile/features/home/presentation/widgets/featured_professionals_section.dart';
import 'package:real_estate_mobile/features/home/presentation/widgets/features_section.dart'; import 'package:real_estate_mobile/features/home/presentation/widgets/features_section.dart';
import 'package:real_estate_mobile/features/home/presentation/widgets/hero_section.dart'; import 'package:real_estate_mobile/features/home/presentation/widgets/hero_section.dart';
import 'package:real_estate_mobile/features/home/presentation/widgets/home_header.dart';
import 'package:real_estate_mobile/features/home/presentation/widgets/testimonials_section.dart'; import 'package:real_estate_mobile/features/home/presentation/widgets/testimonials_section.dart';
import 'package:real_estate_mobile/features/home/presentation/widgets/top_professionals_section.dart'; import 'package:real_estate_mobile/features/home/presentation/widgets/top_professionals_section.dart';
import 'package:real_estate_mobile/features/home/presentation/widgets/trust_stats_section.dart'; import 'package:real_estate_mobile/features/home/presentation/widgets/trust_stats_section.dart';
class HomeScreen extends ConsumerStatefulWidget { class HomeScreen extends ConsumerWidget {
const HomeScreen({super.key}); const HomeScreen({super.key});
@override @override
ConsumerState<HomeScreen> createState() => _HomeScreenState(); Widget build(BuildContext context, WidgetRef ref) {
}
class _HomeScreenState extends ConsumerState<HomeScreen> {
int _selectedIndex = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
body: _buildBody(),
bottomNavigationBar: _buildBottomNavBar(),
);
}
Widget _buildBody() {
// Only Home tab (index 0) has content for now
switch (_selectedIndex) {
case 0:
return _buildHomeContent();
case 1:
case 2:
case 3:
default:
return Center(
child: Text(
['Home', 'Listings', 'Messages', 'Profile'][_selectedIndex],
style: const TextStyle(
fontFamily: 'Fractul',
fontSize: 18,
fontWeight: FontWeight.w600,
color: AppColors.primaryDark,
),
),
);
}
}
Widget _buildHomeContent() {
return SingleChildScrollView( return SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
// Header
SafeArea(
bottom: false,
child: const HomeHeader(),
),
// Hero Section with Search // Hero Section with Search
const HeroSection(), const HeroSection(),
const SizedBox(height: 40), const SizedBox(height: 40),
@@ -94,102 +47,6 @@ class _HomeScreenState extends ConsumerState<HomeScreen> {
); );
} }
// ── Bottom Navigation Bar (matches Figma node 49:6485) ──
Widget _buildBottomNavBar() {
return Container(
decoration: const BoxDecoration(
color: Colors.white,
border: Border(
top: BorderSide(color: Color(0xFFE8E8E8), width: 1),
),
),
child: SafeArea(
top: false,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_buildNavItem(
index: 0,
svgPath: 'assets/icons/nav_home_icon.svg',
fallbackIcon: Icons.home,
),
_buildNavItem(
index: 1,
svgPath: 'assets/icons/nav_list_icon.svg',
fallbackIcon: Icons.list,
),
_buildNavItem(
index: 2,
svgPath: 'assets/icons/nav_messages_icon.svg',
fallbackIcon: Icons.chat_bubble,
),
_buildNavItem(
index: 3,
svgPath: 'assets/icons/nav_profile_icon.svg',
fallbackIcon: Icons.person_outline,
),
],
),
),
),
);
}
Widget _buildNavItem({
required int index,
required String svgPath,
required IconData fallbackIcon,
}) {
final isSelected = _selectedIndex == index;
return GestureDetector(
onTap: () {
if (index == 1) {
context.push('/agents/search');
return;
}
if (index == 2) {
final authState = ref.read(authProvider);
if (authState.status != AuthStatus.authenticated) {
context.push('/login');
return;
}
context.push('/messages');
return;
}
if (index == 3) {
final authState = ref.read(authProvider);
if (authState.status != AuthStatus.authenticated) {
context.push('/login');
return;
}
context.push('/profile');
return;
}
setState(() => _selectedIndex = index);
},
behavior: HitTestBehavior.opaque,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: SvgPicture.asset(
svgPath,
width: 24,
height: 24,
colorFilter: isSelected
? const ColorFilter.mode(AppColors.primaryDark, BlendMode.srcIn)
: const ColorFilter.mode(AppColors.accentOrange, BlendMode.srcIn),
placeholderBuilder: (_) => Icon(
fallbackIcon,
size: 24,
color: isSelected ? AppColors.primaryDark : AppColors.accentOrange,
),
),
),
);
}
Widget _buildFooter() { Widget _buildFooter() {
return Container( return Container(
width: double.infinity, width: double.infinity,

View File

@@ -68,6 +68,10 @@ class _MenuDrawer extends ConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final authState = ref.watch(authProvider);
final isAuthenticated = authState.status == AuthStatus.authenticated;
final user = authState.user;
return DraggableScrollableSheet( return DraggableScrollableSheet(
initialChildSize: 0.85, initialChildSize: 0.85,
minChildSize: 0.5, minChildSize: 0.5,
@@ -76,7 +80,7 @@ class _MenuDrawer extends ConsumerWidget {
return Container( return Container(
decoration: const BoxDecoration( decoration: const BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.vertical(top: Radius.circular(20)), borderRadius: BorderRadius.vertical(top: Radius.circular(15)),
), ),
child: Column( child: Column(
children: [ children: [
@@ -90,10 +94,18 @@ class _MenuDrawer extends ConsumerWidget {
borderRadius: BorderRadius.circular(2), borderRadius: BorderRadius.circular(2),
), ),
), ),
const SizedBox(height: 16), const SizedBox(height: 12),
// Header with logo and close
// Header bar with logo and close button
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 24), padding: const EdgeInsets.symmetric(horizontal: 16),
child: Container(
padding:
const EdgeInsets.symmetric(horizontal: 23, vertical: 12),
decoration: BoxDecoration(
color: const Color(0xFF648188),
borderRadius: BorderRadius.circular(10),
),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
@@ -104,138 +116,198 @@ class _MenuDrawer extends ConsumerWidget {
), ),
GestureDetector( GestureDetector(
onTap: () => Navigator.pop(context), onTap: () => Navigator.pop(context),
child: Container(
width: 32,
height: 32,
decoration: BoxDecoration(
color: AppColors.inputFill,
borderRadius: BorderRadius.circular(8),
),
child: const Icon( child: const Icon(
Icons.close, Icons.close,
color: AppColors.primaryDark, color: AppColors.primaryDark,
size: 20, size: 24,
),
), ),
), ),
], ],
), ),
), ),
const SizedBox(height: 24), ),
const SizedBox(height: 20),
// Profile section (when authenticated)
if (isAuthenticated && user != null) ...[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Row(
children: [
// Avatar
Container(
width: 70,
height: 70,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: AppColors.inputFill,
border: Border.all(
color: AppColors.divider,
width: 1,
),
),
child: ClipOval(
child: user.avatar != null
? Image.network(
user.avatar!,
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) =>
const Icon(
Icons.person,
size: 36,
color: AppColors.hintText,
),
)
: const Icon(
Icons.person,
size: 36,
color: AppColors.hintText,
),
),
),
const SizedBox(width: 12),
// Name and welcome text
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Welcome Back,',
style: TextStyle(
fontFamily: 'Fractul',
fontSize: 14,
fontWeight: FontWeight.w300,
color: Colors.black,
),
),
const SizedBox(height: 2),
Text.rich(
TextSpan(
children: [
TextSpan(
text: user.firstName ?? '',
style: const TextStyle(
fontFamily: 'Fractul',
fontSize: 14,
fontWeight: FontWeight.w700,
color: AppColors.primaryDark,
),
),
TextSpan(
text:
' ${user.lastName ?? ''}',
style: const TextStyle(
fontFamily: 'Fractul',
fontSize: 14,
fontWeight: FontWeight.w400,
color: AppColors.primaryDark,
),
),
],
),
),
],
),
],
),
),
const SizedBox(height: 20),
],
const Divider(color: AppColors.divider, height: 1), const Divider(color: AppColors.divider, height: 1),
// Menu items // Menu items
Expanded( Expanded(
child: ListView( child: ListView(
controller: scrollController, controller: scrollController,
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 8), padding: EdgeInsets.zero,
children: [ children: [
_buildMenuItem( _buildMenuItem(
context, context,
icon: Icons.home_outlined, icon: Icons.school_rounded,
label: 'Home',
onTap: () {
Navigator.pop(context);
context.go('/home');
},
),
_buildMenuItem(
context,
icon: Icons.school_outlined,
label: 'Education', label: 'Education',
onTap: () => Navigator.pop(context), onTap: () => Navigator.pop(context),
), ),
const Divider(color: AppColors.divider, height: 1),
_buildMenuItem( _buildMenuItem(
context, context,
icon: Icons.info_outline, icon: Icons.help_rounded,
label: "Faq's",
onTap: () {
Navigator.pop(context);
context.push('/faq');
},
),
const Divider(color: AppColors.divider, height: 1),
_buildMenuItem(
context,
icon: Icons.info_rounded,
label: 'About Us', label: 'About Us',
onTap: () { onTap: () {
Navigator.pop(context); Navigator.pop(context);
context.push('/about'); context.push('/about');
}, },
), ),
const Divider(color: AppColors.divider, height: 1),
_buildMenuItem( _buildMenuItem(
context, context,
icon: Icons.help_outline, icon: Icons.call_rounded,
label: "FAQ's", label: 'Call Us',
onTap: () { showChevron: false,
Navigator.pop(context);
context.push('/faq');
},
),
_buildMenuItem(
context,
icon: Icons.mail_outline,
label: 'Contact',
onTap: () { onTap: () {
Navigator.pop(context); Navigator.pop(context);
context.push('/contact'); context.push('/contact');
}, },
), ),
const SizedBox(height: 16),
const Divider(color: AppColors.divider, height: 1), const Divider(color: AppColors.divider, height: 1),
const SizedBox(height: 16), ],
if (ref.watch(authProvider).status ==
AuthStatus.authenticated) ...[
_buildMenuItem(
context,
icon: Icons.person_outline,
label: 'Account Settings',
onTap: () {
Navigator.pop(context);
context.push('/profile');
},
), ),
_buildMenuItem(
context,
icon: Icons.notifications_outlined,
label: 'Notification Settings',
onTap: () {
Navigator.pop(context);
context.push('/profile');
},
), ),
const SizedBox(height: 16),
const Divider(color: AppColors.divider, height: 1), // Bottom section: Log Out or Login buttons
const SizedBox(height: 24), Padding(
// Log Out button padding:
const EdgeInsets.symmetric(horizontal: 24, vertical: 24),
child: isAuthenticated
? // Log Out button - filled orange
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
child: OutlinedButton.icon( height: 54,
child: ElevatedButton.icon(
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
ref.read(authProvider.notifier).logout(); ref.read(authProvider.notifier).logout();
}, },
icon: const Icon( icon: const Icon(
Icons.logout, Icons.logout_rounded,
color: AppColors.accentOrange, color: AppColors.primaryDark,
size: 20, size: 24,
), ),
label: const Text( label: const Text(
'Log Out', 'Log Out',
style: TextStyle( style: TextStyle(
fontFamily: 'Fractul', fontFamily: 'Fractul',
fontSize: 16, fontSize: 14,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: AppColors.accentOrange, color: AppColors.primaryDark,
), ),
), ),
style: OutlinedButton.styleFrom( style: ElevatedButton.styleFrom(
padding: backgroundColor: AppColors.accentOrange,
const EdgeInsets.symmetric(vertical: 16), elevation: 0,
side: const BorderSide(
color: AppColors.accentOrange,
width: 1.5,
),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15), borderRadius: BorderRadius.circular(15),
), ),
), ),
), ),
), )
] else ...[ : // Login / Sign Up buttons
// Login button Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
height: 54,
child: ElevatedButton.icon( child: ElevatedButton.icon(
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
@@ -257,8 +329,7 @@ class _MenuDrawer extends ConsumerWidget {
), ),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: AppColors.accentOrange, backgroundColor: AppColors.accentOrange,
padding: elevation: 0,
const EdgeInsets.symmetric(vertical: 16),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15), borderRadius: BorderRadius.circular(15),
), ),
@@ -266,9 +337,9 @@ class _MenuDrawer extends ConsumerWidget {
), ),
), ),
const SizedBox(height: 12), const SizedBox(height: 12),
// Sign Up button
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
height: 54,
child: OutlinedButton.icon( child: OutlinedButton.icon(
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
@@ -289,8 +360,6 @@ class _MenuDrawer extends ConsumerWidget {
), ),
), ),
style: OutlinedButton.styleFrom( style: OutlinedButton.styleFrom(
padding:
const EdgeInsets.symmetric(vertical: 16),
side: const BorderSide( side: const BorderSide(
color: AppColors.accentOrange, color: AppColors.accentOrange,
width: 1.5, width: 1.5,
@@ -302,7 +371,6 @@ class _MenuDrawer extends ConsumerWidget {
), ),
), ),
], ],
],
), ),
), ),
], ],
@@ -317,26 +385,27 @@ class _MenuDrawer extends ConsumerWidget {
required IconData icon, required IconData icon,
required String label, required String label,
required VoidCallback onTap, required VoidCallback onTap,
bool showChevron = true,
}) { }) {
return InkWell( return InkWell(
onTap: onTap, onTap: onTap,
borderRadius: BorderRadius.circular(10),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(vertical: 14), padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 18),
child: Row( child: Row(
children: [ children: [
Icon(icon, color: AppColors.primaryDark, size: 24), Icon(icon, color: AppColors.accentOrange, size: 30),
const SizedBox(width: 16), const SizedBox(width: 20),
Text( Text(
label, label,
style: const TextStyle( style: const TextStyle(
fontFamily: 'Fractul', fontFamily: 'Fractul',
fontSize: 16, fontSize: 14,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w700,
color: AppColors.primaryDark, color: AppColors.primaryDark,
), ),
), ),
const Spacer(), const Spacer(),
if (showChevron)
const Icon( const Icon(
Icons.chevron_right, Icons.chevron_right,
color: AppColors.hintText, color: AppColors.hintText,

View File

@@ -1201,21 +1201,8 @@ class _ChatScreenState extends ConsumerState<ChatScreen> {
// Text input pill with send icon inside // Text input pill with send icon inside
Expanded( Expanded(
child: Container( child: SizedBox(
height: 44, height: 44,
margin: const EdgeInsets.only(left: 4),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(22),
border: Border.all(
color: AppColors.primaryDark,
width: 1.5,
),
),
clipBehavior: Clip.antiAlias,
child: Row(
children: [
Expanded(
child: TextField( child: TextField(
controller: _messageController, controller: _messageController,
focusNode: _messageFocusNode, focusNode: _messageFocusNode,
@@ -1227,30 +1214,44 @@ class _ChatScreenState extends ConsumerState<ChatScreen> {
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: AppColors.primaryDark, color: AppColors.primaryDark,
), ),
decoration: const InputDecoration( decoration: InputDecoration(
hintText: 'Write a Message', hintText: 'Write a Message',
hintStyle: TextStyle( hintStyle: const TextStyle(
fontFamily: 'Fractul', fontFamily: 'Fractul',
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: AppColors.primaryDark, color: AppColors.primaryDark,
), ),
contentPadding: EdgeInsets.symmetric( contentPadding: const EdgeInsets.symmetric(
horizontal: 18, horizontal: 18,
vertical: 10, vertical: 12,
), ),
border: InputBorder.none, border: OutlineInputBorder(
enabledBorder: InputBorder.none, borderRadius: BorderRadius.circular(22),
focusedBorder: InputBorder.none, borderSide: const BorderSide(
color: AppColors.primaryDark,
width: 1.5,
), ),
), ),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(22),
borderSide: const BorderSide(
color: AppColors.primaryDark,
width: 1.5,
), ),
// Send arrow inside the pill ),
GestureDetector( focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(22),
borderSide: const BorderSide(
color: AppColors.primaryDark,
width: 1.5,
),
),
suffixIcon: GestureDetector(
onTap: _sendMessage, onTap: _sendMessage,
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
child: Padding( child: const Padding(
padding: const EdgeInsets.only(right: 14), padding: EdgeInsets.only(right: 4),
child: Icon( child: Icon(
Icons.send, Icons.send,
size: 20, size: 20,
@@ -1258,7 +1259,11 @@ class _ChatScreenState extends ConsumerState<ChatScreen> {
), ),
), ),
), ),
], suffixIconConstraints: const BoxConstraints(
minWidth: 40,
minHeight: 20,
),
),
), ),
), ),
), ),

View File

@@ -62,20 +62,11 @@ class _ConversationsScreenState extends ConsumerState<ConversationsScreen> {
// -- Header with back arrow, search, icons -- // -- Header with back arrow, search, icons --
Widget _buildHeader() { Widget _buildHeader() {
return Container( return Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 12), padding: const EdgeInsets.fromLTRB(16, 8, 16, 12),
child: Container(
height: 48,
decoration: BoxDecoration(
border: Border.all(
color: AppColors.primaryDark.withValues(alpha: 0.2),
width: 1,
),
borderRadius: BorderRadius.circular(15),
),
child: Row( child: Row(
children: [ children: [
// Back arrow // Back arrow (outside the search box)
GestureDetector( GestureDetector(
onTap: () { onTap: () {
if (_isSearchActive) { if (_isSearchActive) {
@@ -89,7 +80,7 @@ class _ConversationsScreenState extends ConsumerState<ConversationsScreen> {
}, },
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
child: const Padding( child: const Padding(
padding: EdgeInsets.symmetric(horizontal: 14), padding: EdgeInsets.only(right: 10),
child: Icon( child: Icon(
Icons.arrow_back_ios_new, Icons.arrow_back_ios_new,
size: 16, size: 16,
@@ -97,8 +88,16 @@ class _ConversationsScreenState extends ConsumerState<ConversationsScreen> {
), ),
), ),
), ),
// Search text or input // Search box with border
Expanded( Expanded(
child: GestureDetector(
onTap: () {
if (!_isSearchActive) {
setState(() => _isSearchActive = true);
}
},
child: SizedBox(
height: 44,
child: _isSearchActive child: _isSearchActive
? TextField( ? TextField(
controller: _searchController, controller: _searchController,
@@ -109,21 +108,62 @@ class _ConversationsScreenState extends ConsumerState<ConversationsScreen> {
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: AppColors.primaryDark, color: AppColors.primaryDark,
), ),
decoration: const InputDecoration( decoration: InputDecoration(
hintText: 'Search Messages', hintText: 'Search Messages',
hintStyle: TextStyle( hintStyle: const TextStyle(
fontFamily: 'Fractul', fontFamily: 'Fractul',
fontSize: 15, fontSize: 15,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: AppColors.hintText, color: AppColors.hintText,
), ),
border: InputBorder.none, contentPadding: const EdgeInsets.symmetric(
contentPadding: EdgeInsets.zero, horizontal: 18,
isDense: true, vertical: 12,
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(22),
borderSide: BorderSide(
color: AppColors.primaryDark
.withValues(alpha: 0.25),
),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(22),
borderSide: BorderSide(
color: AppColors.primaryDark
.withValues(alpha: 0.25),
),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(22),
borderSide: BorderSide(
color: AppColors.primaryDark
.withValues(alpha: 0.4),
),
),
suffixIcon: _searchController.text.isNotEmpty
? IconButton(
icon: const Icon(Icons.close, size: 18),
color: AppColors.hintText,
onPressed: () {
_searchController.clear();
setState(() {});
},
)
: null,
), ),
) )
: GestureDetector( : Container(
onTap: () => setState(() => _isSearchActive = true), alignment: Alignment.centerLeft,
decoration: BoxDecoration(
border: Border.all(
color: AppColors.primaryDark
.withValues(alpha: 0.25),
),
borderRadius: BorderRadius.circular(22),
),
padding:
const EdgeInsets.symmetric(horizontal: 18),
child: const Text( child: const Text(
'Search Messages', 'Search Messages',
style: TextStyle( style: TextStyle(
@@ -135,25 +175,38 @@ class _ConversationsScreenState extends ConsumerState<ConversationsScreen> {
), ),
), ),
), ),
// Search icon ),
),
const SizedBox(width: 10),
// Search icon (outside the search box)
GestureDetector( GestureDetector(
onTap: () => setState(() => _isSearchActive = true), onTap: () {
setState(() {
if (_isSearchActive) {
_isSearchActive = false;
_searchController.clear();
} else {
_isSearchActive = true;
}
});
},
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
child: const Padding( child: Padding(
padding: EdgeInsets.symmetric(horizontal: 10), padding: const EdgeInsets.all(4),
child: Icon( child: Icon(
Icons.search, _isSearchActive ? Icons.close : Icons.search,
size: 22, size: 22,
color: AppColors.primaryDark, color: AppColors.primaryDark,
), ),
), ),
), ),
// Three dots menu const SizedBox(width: 8),
// Three dots menu (outside the search box)
GestureDetector( GestureDetector(
onTap: () {}, onTap: () {},
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
child: const Padding( child: const Padding(
padding: EdgeInsets.only(right: 14, left: 2), padding: EdgeInsets.all(4),
child: Icon( child: Icon(
Icons.more_horiz, Icons.more_horiz,
size: 22, size: 22,
@@ -163,7 +216,6 @@ class _ConversationsScreenState extends ConsumerState<ConversationsScreen> {
), ),
], ],
), ),
),
); );
} }

View File

@@ -1,10 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:real_estate_mobile/core/constants/app_colors.dart'; import 'package:real_estate_mobile/core/constants/app_colors.dart';
import 'package:real_estate_mobile/features/auth/presentation/providers/auth_provider.dart';
import 'package:real_estate_mobile/features/home/presentation/widgets/home_header.dart';
import 'package:real_estate_mobile/features/profile/presentation/providers/profile_provider.dart'; import 'package:real_estate_mobile/features/profile/presentation/providers/profile_provider.dart';
class ProfileSettingsScreen extends ConsumerStatefulWidget { class ProfileSettingsScreen extends ConsumerStatefulWidget {
@@ -121,22 +118,15 @@ class _ProfileSettingsScreenState extends ConsumerState<ProfileSettingsScreen> {
} }
}); });
return Scaffold( if (profileState.isLoading) {
backgroundColor: Colors.white, return const Center(
body: Column(
children: [
SafeArea(
bottom: false,
child: const HomeHeader(),
),
Expanded(
child: profileState.isLoading
? const Center(
child: CircularProgressIndicator( child: CircularProgressIndicator(
color: AppColors.accentOrange, color: AppColors.accentOrange,
), ),
) );
: Column( }
return Column(
children: [ children: [
const SizedBox(height: 16), const SizedBox(height: 16),
_buildTabBar(), _buildTabBar(),
@@ -149,11 +139,6 @@ class _ProfileSettingsScreenState extends ConsumerState<ProfileSettingsScreen> {
: _buildPrivacyTab(), : _buildPrivacyTab(),
), ),
], ],
),
),
],
),
bottomNavigationBar: _buildBottomNavBar(),
); );
} }
@@ -983,87 +968,4 @@ class _ProfileSettingsScreenState extends ConsumerState<ProfileSettingsScreen> {
); );
} }
// ── Bottom Navigation Bar ──
Widget _buildBottomNavBar() {
return Container(
decoration: const BoxDecoration(
color: Colors.white,
border: Border(
top: BorderSide(color: Color(0xFFE8E8E8), width: 1),
),
),
child: SafeArea(
top: false,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_buildNavItem(
svgPath: 'assets/icons/nav_home_icon.svg',
fallbackIcon: Icons.home,
isSelected: false,
onTap: () => context.go('/home'),
),
_buildNavItem(
svgPath: 'assets/icons/nav_list_icon.svg',
fallbackIcon: Icons.list,
isSelected: false,
onTap: () => context.push('/agents/search'),
),
_buildNavItem(
svgPath: 'assets/icons/nav_messages_icon.svg',
fallbackIcon: Icons.chat_bubble,
isSelected: false,
onTap: () {
final authState = ref.read(authProvider);
if (authState.status != AuthStatus.authenticated) {
context.push('/login');
return;
}
context.go('/messages');
},
),
_buildNavItem(
svgPath: 'assets/icons/nav_profile_icon.svg',
fallbackIcon: Icons.person_outline,
isSelected: true,
onTap: () {},
),
],
),
),
),
);
}
Widget _buildNavItem({
required String svgPath,
required IconData fallbackIcon,
required bool isSelected,
required VoidCallback onTap,
}) {
return GestureDetector(
onTap: onTap,
behavior: HitTestBehavior.opaque,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: SvgPicture.asset(
svgPath,
width: 24,
height: 24,
colorFilter: isSelected
? const ColorFilter.mode(AppColors.primaryDark, BlendMode.srcIn)
: const ColorFilter.mode(
AppColors.accentOrange, BlendMode.srcIn),
placeholderBuilder: (_) => Icon(
fallbackIcon,
size: 24,
color: isSelected ? AppColors.primaryDark : AppColors.accentOrange,
),
),
),
);
}
} }

View File

@@ -1,6 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:real_estate_mobile/core/constants/app_colors.dart';
import 'package:real_estate_mobile/core/widgets/app_shell.dart';
import 'package:real_estate_mobile/features/auth/presentation/providers/auth_provider.dart'; import 'package:real_estate_mobile/features/auth/presentation/providers/auth_provider.dart';
import 'package:real_estate_mobile/features/auth/presentation/screens/login_screen.dart'; import 'package:real_estate_mobile/features/auth/presentation/screens/login_screen.dart';
import 'package:real_estate_mobile/features/auth/presentation/screens/signup_screen.dart'; import 'package:real_estate_mobile/features/auth/presentation/screens/signup_screen.dart';
@@ -10,16 +12,16 @@ import 'package:real_estate_mobile/features/faq/presentation/screens/faq_screen.
import 'package:real_estate_mobile/features/home/presentation/screens/home_screen.dart'; import 'package:real_estate_mobile/features/home/presentation/screens/home_screen.dart';
import 'package:real_estate_mobile/features/messaging/presentation/screens/conversations_screen.dart'; import 'package:real_estate_mobile/features/messaging/presentation/screens/conversations_screen.dart';
import 'package:real_estate_mobile/features/messaging/presentation/screens/chat_screen.dart'; import 'package:real_estate_mobile/features/messaging/presentation/screens/chat_screen.dart';
import 'package:real_estate_mobile/features/messaging/presentation/screens/messaging_shell.dart';
import 'package:real_estate_mobile/features/agents/presentation/screens/agent_home_screen.dart'; import 'package:real_estate_mobile/features/agents/presentation/screens/agent_home_screen.dart';
import 'package:real_estate_mobile/features/contact/presentation/screens/contact_screen.dart'; import 'package:real_estate_mobile/features/contact/presentation/screens/contact_screen.dart';
import 'package:real_estate_mobile/features/about/presentation/screens/about_screen.dart'; import 'package:real_estate_mobile/features/about/presentation/screens/about_screen.dart';
import 'package:real_estate_mobile/features/agents/presentation/screens/agent_network_screen.dart';
import 'package:real_estate_mobile/features/profile/presentation/screens/profile_settings_screen.dart'; import 'package:real_estate_mobile/features/profile/presentation/screens/profile_settings_screen.dart';
final routerProvider = Provider<GoRouter>((ref) { final routerProvider = Provider<GoRouter>((ref) {
final authRefreshNotifier = _AuthRefreshNotifier(); final authRefreshNotifier = _AuthRefreshNotifier();
ref.listen(authProvider, (_, __) { ref.listen(authProvider, (previous, next) {
authRefreshNotifier.notify(); authRefreshNotifier.notify();
}); });
@@ -60,6 +62,7 @@ final routerProvider = Provider<GoRouter>((ref) {
return null; return null;
}, },
routes: [ routes: [
// Auth routes (no shell — full screen)
GoRoute( GoRoute(
path: '/login', path: '/login',
builder: (context, state) => const LoginScreen(), builder: (context, state) => const LoginScreen(),
@@ -68,6 +71,11 @@ final routerProvider = Provider<GoRouter>((ref) {
path: '/signup', path: '/signup',
builder: (context, state) => const SignupScreen(), builder: (context, state) => const SignupScreen(),
), ),
// All main app routes wrapped in AppShell (shared header + bottom nav)
ShellRoute(
builder: (context, state, child) => AppShell(child: child),
routes: [
GoRoute( GoRoute(
path: '/home', path: '/home',
builder: (context, state) => const _HomeRouteWrapper(), builder: (context, state) => const _HomeRouteWrapper(),
@@ -86,9 +94,6 @@ final routerProvider = Provider<GoRouter>((ref) {
return AgentDetailScreen(agentId: id); return AgentDetailScreen(agentId: id);
}, },
), ),
ShellRoute(
builder: (context, state, child) => MessagingShell(child: child),
routes: [
GoRoute( GoRoute(
path: '/messages', path: '/messages',
builder: (context, state) => const ConversationsScreen(), builder: (context, state) => const ConversationsScreen(),
@@ -100,8 +105,6 @@ final routerProvider = Provider<GoRouter>((ref) {
return ChatScreen(conversationId: id); return ChatScreen(conversationId: id);
}, },
), ),
],
),
GoRoute( GoRoute(
path: '/faq', path: '/faq',
builder: (context, state) => const FaqScreen(), builder: (context, state) => const FaqScreen(),
@@ -114,21 +117,40 @@ final routerProvider = Provider<GoRouter>((ref) {
path: '/about', path: '/about',
builder: (context, state) => const AboutScreen(), builder: (context, state) => const AboutScreen(),
), ),
GoRoute(
path: '/agent/network',
builder: (context, state) => const AgentNetworkScreen(),
),
GoRoute( GoRoute(
path: '/profile', path: '/profile',
builder: (context, state) => const ProfileSettingsScreen(), builder: (context, state) => const ProfileSettingsScreen(),
), ),
], ],
),
],
); );
}); });
/// Reactively switches between HomeScreen and AgentHomeScreen based on auth. /// Reactively switches between HomeScreen and AgentHomeScreen based on auth.
/// Shows a loading indicator while auth status is being determined to prevent
/// flashing the wrong screen on refresh.
class _HomeRouteWrapper extends ConsumerWidget { class _HomeRouteWrapper extends ConsumerWidget {
const _HomeRouteWrapper(); const _HomeRouteWrapper();
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final authState = ref.watch(authProvider); final authState = ref.watch(authProvider);
// Show loader while auth is initializing or loading
if (authState.status == AuthStatus.initial ||
authState.status == AuthStatus.loading) {
return const Center(
child: CircularProgressIndicator(
color: AppColors.accentOrange,
),
);
}
if (authState.status == AuthStatus.authenticated && if (authState.status == AuthStatus.authenticated &&
authState.user?.role == 'AGENT') { authState.user?.role == 'AGENT') {
return const AgentHomeScreen(); return const AgentHomeScreen();

View File

@@ -7,6 +7,7 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <emoji_picker_flutter/emoji_picker_flutter_plugin.h> #include <emoji_picker_flutter/emoji_picker_flutter_plugin.h>
#include <file_selector_linux/file_selector_plugin.h>
#include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h> #include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h> #include <url_launcher_linux/url_launcher_plugin.h>
@@ -14,6 +15,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) emoji_picker_flutter_registrar = g_autoptr(FlPluginRegistrar) emoji_picker_flutter_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "EmojiPickerFlutterPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "EmojiPickerFlutterPlugin");
emoji_picker_flutter_plugin_register_with_registrar(emoji_picker_flutter_registrar); emoji_picker_flutter_plugin_register_with_registrar(emoji_picker_flutter_registrar);
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar = g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin");
flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_registrar); flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_registrar);

View File

@@ -4,6 +4,7 @@
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
emoji_picker_flutter emoji_picker_flutter
file_selector_linux
flutter_secure_storage_linux flutter_secure_storage_linux
url_launcher_linux url_launcher_linux
) )

View File

@@ -6,6 +6,7 @@ import FlutterMacOS
import Foundation import Foundation
import emoji_picker_flutter import emoji_picker_flutter
import file_selector_macos
import flutter_secure_storage_macos import flutter_secure_storage_macos
import path_provider_foundation import path_provider_foundation
import shared_preferences_foundation import shared_preferences_foundation
@@ -14,6 +15,7 @@ import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
EmojiPickerFlutterPlugin.register(with: registry.registrar(forPlugin: "EmojiPickerFlutterPlugin")) EmojiPickerFlutterPlugin.register(with: registry.registrar(forPlugin: "EmojiPickerFlutterPlugin"))
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin")) FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))

View File

@@ -193,6 +193,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.1.2" version: "3.1.2"
cross_file:
dependency: transitive
description:
name: cross_file
sha256: "28bb3ae56f117b5aec029d702a90f57d285cd975c3c5c281eaca38dbc47c5937"
url: "https://pub.dev"
source: hosted
version: "0.3.5+2"
crypto: crypto:
dependency: transitive dependency: transitive
description: description:
@@ -281,6 +289,38 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "7.0.1" version: "7.0.1"
file_selector_linux:
dependency: transitive
description:
name: file_selector_linux
sha256: "2567f398e06ac72dcf2e98a0c95df2a9edd03c2c2e0cacd4780f20cdf56263a0"
url: "https://pub.dev"
source: hosted
version: "0.9.4"
file_selector_macos:
dependency: transitive
description:
name: file_selector_macos
sha256: "5e0bbe9c312416f1787a68259ea1505b52f258c587f12920422671807c4d618a"
url: "https://pub.dev"
source: hosted
version: "0.9.5"
file_selector_platform_interface:
dependency: transitive
description:
name: file_selector_platform_interface
sha256: "35e0bd61ebcdb91a3505813b055b09b79dfdc7d0aee9c09a7ba59ae4bb13dc85"
url: "https://pub.dev"
source: hosted
version: "2.7.0"
file_selector_windows:
dependency: transitive
description:
name: file_selector_windows
sha256: "62197474ae75893a62df75939c777763d39c2bc5f73ce5b88497208bc269abfd"
url: "https://pub.dev"
source: hosted
version: "0.9.3+5"
fixnum: fixnum:
dependency: transitive dependency: transitive
description: description:
@@ -326,6 +366,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "6.0.0" version: "6.0.0"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
sha256: ee8068e0e1cd16c4a82714119918efdeed33b3ba7772c54b5d094ab53f9b7fd1
url: "https://pub.dev"
source: hosted
version: "2.0.33"
flutter_riverpod: flutter_riverpod:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -480,6 +528,70 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "4.8.0" version: "4.8.0"
image_picker:
dependency: "direct main"
description:
name: image_picker
sha256: "784210112be18ea55f69d7076e2c656a4e24949fa9e76429fe53af0c0f4fa320"
url: "https://pub.dev"
source: hosted
version: "1.2.1"
image_picker_android:
dependency: transitive
description:
name: image_picker_android
sha256: eda9b91b7e266d9041084a42d605a74937d996b87083395c5e47835916a86156
url: "https://pub.dev"
source: hosted
version: "0.8.13+14"
image_picker_for_web:
dependency: transitive
description:
name: image_picker_for_web
sha256: "66257a3191ab360d23a55c8241c91a6e329d31e94efa7be9cf7a212e65850214"
url: "https://pub.dev"
source: hosted
version: "3.1.1"
image_picker_ios:
dependency: transitive
description:
name: image_picker_ios
sha256: b9c4a438a9ff4f60808c9cf0039b93a42bb6c2211ef6ebb647394b2b3fa84588
url: "https://pub.dev"
source: hosted
version: "0.8.13+6"
image_picker_linux:
dependency: transitive
description:
name: image_picker_linux
sha256: "1f81c5f2046b9ab724f85523e4af65be1d47b038160a8c8deed909762c308ed4"
url: "https://pub.dev"
source: hosted
version: "0.2.2"
image_picker_macos:
dependency: transitive
description:
name: image_picker_macos
sha256: "86f0f15a309de7e1a552c12df9ce5b59fe927e71385329355aec4776c6a8ec91"
url: "https://pub.dev"
source: hosted
version: "0.2.2+1"
image_picker_platform_interface:
dependency: transitive
description:
name: image_picker_platform_interface
sha256: "567e056716333a1647c64bb6bd873cff7622233a5c3f694be28a583d4715690c"
url: "https://pub.dev"
source: hosted
version: "2.11.1"
image_picker_windows:
dependency: transitive
description:
name: image_picker_windows
sha256: d248c86554a72b5495a31c56f060cf73a41c7ff541689327b1a7dbccc33adfae
url: "https://pub.dev"
source: hosted
version: "0.2.2"
intl: intl:
dependency: "direct main" dependency: "direct main"
description: description:

View File

@@ -50,6 +50,7 @@ dependencies:
intl: ^0.20.2 intl: ^0.20.2
logger: ^2.5.0 logger: ^2.5.0
flutter_dotenv: ^5.2.1 flutter_dotenv: ^5.2.1
image_picker: ^1.2.1
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

View File

@@ -7,12 +7,15 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <emoji_picker_flutter/emoji_picker_flutter_plugin_c_api.h> #include <emoji_picker_flutter/emoji_picker_flutter_plugin_c_api.h>
#include <file_selector_windows/file_selector_windows.h>
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h> #include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h> #include <url_launcher_windows/url_launcher_windows.h>
void RegisterPlugins(flutter::PluginRegistry* registry) { void RegisterPlugins(flutter::PluginRegistry* registry) {
EmojiPickerFlutterPluginCApiRegisterWithRegistrar( EmojiPickerFlutterPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("EmojiPickerFlutterPluginCApi")); registry->GetRegistrarForPlugin("EmojiPickerFlutterPluginCApi"));
FileSelectorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FileSelectorWindows"));
FlutterSecureStorageWindowsPluginRegisterWithRegistrar( FlutterSecureStorageWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin")); registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin"));
UrlLauncherWindowsRegisterWithRegistrar( UrlLauncherWindowsRegisterWithRegistrar(

View File

@@ -4,6 +4,7 @@
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
emoji_picker_flutter emoji_picker_flutter
file_selector_windows
flutter_secure_storage_windows flutter_secure_storage_windows
url_launcher_windows url_launcher_windows
) )