feat: Implement agent network management and refactor app navigation with a new AppShell component.
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
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: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/data/models/agent_profile.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';
|
||||
|
||||
class AgentDetailScreen extends ConsumerStatefulWidget {
|
||||
final String agentId;
|
||||
@@ -41,16 +39,14 @@ class _AgentDetailScreenState extends ConsumerState<AgentDetailScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
final state = ref.watch(agentDetailProvider(widget.agentId));
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
body: state.isLoading
|
||||
? const Center(
|
||||
child: CircularProgressIndicator(color: AppColors.accentOrange))
|
||||
: state.error != null
|
||||
? _buildError(state.error!)
|
||||
: _buildContent(state),
|
||||
bottomNavigationBar: _buildBottomNavBar(),
|
||||
);
|
||||
if (state.isLoading) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(color: AppColors.accentOrange));
|
||||
}
|
||||
if (state.error != null) {
|
||||
return _buildError(state.error!);
|
||||
}
|
||||
return _buildContent(state);
|
||||
}
|
||||
|
||||
Widget _buildError(String error) {
|
||||
@@ -86,8 +82,6 @@ class _AgentDetailScreenState extends ConsumerState<AgentDetailScreen> {
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
SafeArea(bottom: false, child: const HomeHeader()),
|
||||
|
||||
// ── Avatar Section ──
|
||||
const SizedBox(height: 16),
|
||||
_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 ──
|
||||
|
||||
Reference in New Issue
Block a user