Files
flutter/lib/app/router/app_router.dart
T
Ruslan Bakiev 5e78a134b0
Build and deploy Flutter Web / build (push) Successful in 3m7s
Refactor Flutter app architecture
2026-06-12 14:25:24 +07:00

57 lines
1.6 KiB
Dart

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(
routes: [
GoRoute(
path: '/',
builder: (context, state) => const MapflowShell(),
routes: [
GoRoute(
path: 'experience/new',
pageBuilder: (context, state) {
final args = state.extra as AddExperienceArgs;
return CustomTransitionPage<void>(
fullscreenDialog: true,
key: state.pageKey,
child: AddExperienceFlow(
coordinate: args.coordinate,
hasTelegramAuth: args.hasTelegramAuth,
),
transitionsBuilder: (context, animation, _, child) {
return SlideTransition(
position: Tween<Offset>(
begin: const Offset(0, 1),
end: Offset.zero,
).animate(animation),
child: child,
);
},
);
},
),
GoRoute(
path: 'admin/reviews',
builder: (context, state) => const AdminVoiceExperiencesScreen(),
),
],
),
],
);
}