import 'package:flutter/widgets.dart'; import 'package:go_router/go_router.dart'; import 'package:latlong2/latlong.dart'; import '../../features/mapflow/presentation/admin_voice_experiences_screen.dart'; import '../../features/mapflow/presentation/mapflow_shell.dart'; class AddExperienceArgs { const AddExperienceArgs({ required this.coordinate, required this.hasTelegramAuth, }); final LatLng? coordinate; final bool hasTelegramAuth; } GoRouter createAppRouter() { return GoRouter( errorBuilder: (context, state) => const MapflowShell(), routes: [ GoRoute( path: '/', builder: (context, state) => const MapflowShell(), routes: [ GoRoute( path: 'experience/new', pageBuilder: (context, state) { final extra = state.extra; final args = extra is AddExperienceArgs ? extra : const AddExperienceArgs( coordinate: null, hasTelegramAuth: true, ); return CustomTransitionPage( fullscreenDialog: true, key: state.pageKey, child: AddExperienceFlow( coordinate: args.coordinate, hasTelegramAuth: args.hasTelegramAuth, ), transitionsBuilder: (context, animation, _, child) { return SlideTransition( position: Tween( begin: const Offset(0, 1), end: Offset.zero, ).animate(animation), child: child, ); }, ); }, ), GoRoute( path: 'admin/reviews', builder: (context, state) => const AdminVoiceExperiencesScreen(), ), ], ), ], ); }