Hanim 9f874f30e7 feat: Add dashboard layout with sidebar and main content area
- Implemented AppFooter widget for mobile and desktop views.
- Created ChildrenSidebar widget to display children's information.
- Developed AppLayout to manage app structure with optional footer.
- Added ChildrenSidebar for selecting children and displaying their status.
- Introduced DashboardAppBar for navigation and user actions.
- Built WMainContentArea for displaying assistant details and calendar.
- Created MainContentArea to manage contracts and events display.
- Implemented MessagingSidebar for messaging functionality.
- Updated widget tests to reflect new structure and imports.
2025-08-28 12:58:44 +02:00

155 lines
5.9 KiB
Dart

import 'package:flutter/material.dart';
import 'package:p_tits_pas/models/am_user_registration_data.dart';
import 'package:p_tits_pas/screens/auth/am/am_register_step1_sceen.dart';
import 'package:p_tits_pas/screens/auth/am/am_register_step2_sceen.dart';
import 'package:p_tits_pas/screens/auth/am/am_register_step3_sceen.dart';
import 'package:p_tits_pas/screens/auth/am/am_register_step4_sceen.dart';
import 'package:p_tits_pas/screens/home/parent_screen/ParentDashboardScreen.dart';
import 'package:p_tits_pas/screens/home/parent_screen/find_nanny.dart';
import 'package:p_tits_pas/screens/legal/legal_page.dart';
import 'package:p_tits_pas/screens/legal/privacy_page.dart';
import '../screens/auth/login_screen.dart';
import '../screens/auth/register_choice_screen.dart';
import '../screens/auth/parent/parent_register_step1_screen.dart';
import '../screens/auth/parent/parent_register_step2_screen.dart';
import '../screens/auth/parent/parent_register_step3_screen.dart';
import '../screens/auth/parent/parent_register_step4_screen.dart';
import '../screens/auth/parent/parent_register_step5_screen.dart';
import '../models/parent_user_registration_data.dart';
class AppRouter {
static const String login = '/login';
static const String registerChoice = '/register-choice';
static const String legal = '/legal';
static const String privacy = '/privacy';
static const String parentRegisterStep1 = '/parent-register/step1';
static const String parentRegisterStep2 = '/parent-register/step2';
static const String parentRegisterStep3 = '/parent-register/step3';
static const String parentRegisterStep4 = '/parent-register/step4';
static const String parentRegisterStep5 = '/parent-register/step5';
static const String amRegisterStep1 = '/am-register/step1';
static const String amRegisterStep2 = '/am-register/step2';
static const String amRegisterStep3 = '/am-register/step3';
static const String amRegisterStep4 = '/am-register/step4';
static const String parentDashboard = '/parent-dashboard';
static const String findNanny = '/find-nanny';
static Route<dynamic> generateRoute(RouteSettings settings) {
Widget screen;
bool slideTransition = false;
Object? args = settings.arguments;
Widget buildErrorScreen(String step) {
print("Erreur: Données UserRegistrationData manquantes ou de mauvais type pour l'étape $step");
return const ParentRegisterStep1Screen();
}
switch (settings.name) {
case login:
screen = const LoginPage();
break;
case registerChoice:
screen = const RegisterChoiceScreen();
slideTransition = true;
break;
case legal:
screen = const LegalPage();
slideTransition = true;
break;
case privacy:
screen = const PrivacyPage();
slideTransition = true;
break;
case parentRegisterStep2:
if (args is UserRegistrationData) {
screen = ParentRegisterStep2Screen(registrationData: args);
} else {
screen = buildErrorScreen('2');
}
slideTransition = true;
break;
case parentRegisterStep3:
if (args is UserRegistrationData) {
screen = ParentRegisterStep3Screen(registrationData: args);
} else {
screen = buildErrorScreen('3');
}
slideTransition = true;
break;
case parentRegisterStep4:
if (args is UserRegistrationData) {
screen = ParentRegisterStep4Screen(registrationData: args);
} else {
screen = buildErrorScreen('4');
}
slideTransition = true;
break;
case parentRegisterStep5:
if (args is UserRegistrationData) {
screen = ParentRegisterStep5Screen(registrationData: args);
} else {
screen = buildErrorScreen('5');
}
slideTransition = true;
break;
case amRegisterStep1:
screen = const AmRegisterStep1Screen();
slideTransition = true;
break;
case amRegisterStep2:
if (args is ChildminderRegistrationData) {
screen = AmRegisterStep2Screen(registrationData: args);
} else {
screen = AmRegisterStep2Screen(registrationData: ChildminderRegistrationData());
}
slideTransition = true;
break;
case amRegisterStep3:
if (args is ChildminderRegistrationData) {
screen = AmRegisterStep3Screen(registrationData: args);
} else {
screen = AmRegisterStep3Screen(registrationData: ChildminderRegistrationData());
}
slideTransition = true;
break;
case amRegisterStep4:
if (args is ChildminderRegistrationData) {
screen = AmRegisterStep4Screen(registrationData: args);
} else {
screen = AmRegisterStep4Screen(registrationData: ChildminderRegistrationData());
}
slideTransition = true;
break;
case parentDashboard:
screen = const ParentDashboardScreen();
break;
case findNanny:
screen = const FindNannyScreen();
break;
default:
screen = Scaffold(
body: Center(
child: Text('Route non définie : ${settings.name}'),
),
);
}
if (slideTransition) {
return PageRouteBuilder(
pageBuilder: (context, animation, secondaryAnimation) => screen,
transitionsBuilder: (context, animation, secondaryAnimation, child) {
const begin = Offset(1.0, 0.0);
const end = Offset.zero;
const curve = Curves.easeInOut;
var tween = Tween(begin: begin, end: end).chain(CurveTween(curve: curve));
var offsetAnimation = animation.drive(tween);
return SlideTransition(position: offsetAnimation, child: child);
},
transitionDuration: const Duration(milliseconds: 400),
);
} else {
return MaterialPageRoute(builder: (_) => screen);
}
}
}