Files
flutter/lib/app/router/app_router.dart
T
Ruslan Bakiev 0f5061ce96
Build and deploy Flutter Web / build (push) Successful in 2m21s
Fix add review route and photo previews
2026-06-12 23:06:17 +07:00

62 lines
1.7 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(
errorBuilder: (context, state) => const MapflowShell(),
routes: [
GoRoute(
path: '/',
builder: (context, state) => const MapflowShell(),
),
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<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(),
),
],
);
}