feat: implement core architecture, design system, localization, and trip features for both driver and rider apps.
This commit is contained in:
@@ -1,11 +1,24 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import '../features/auth/cubit/auth_cubit.dart';
|
||||
import '../features/auth/cubit/auth_state.dart';
|
||||
import '../features/auth/view/phone_screen.dart';
|
||||
import '../features/auth/view/otp_screen.dart';
|
||||
import '../features/home/view/home_screen.dart';
|
||||
import '../features/home/view/destination_screen.dart';
|
||||
import '../features/home/view/route_preview_screen.dart';
|
||||
import '../features/trip/view/trip_tracking_screen.dart';
|
||||
import '../features/trip/view/trip_invoice_screen.dart';
|
||||
import '../features/trip/view/rating_screen.dart';
|
||||
import '../features/home/cubit/home_cubit.dart';
|
||||
import '../features/home/cubit/destination_cubit.dart';
|
||||
import '../features/home/cubit/quote_cubit.dart';
|
||||
import '../features/home/data/models/place_model.dart';
|
||||
import '../features/home/data/maps_repository.dart';
|
||||
import '../features/home/data/tariff_repository.dart';
|
||||
import 'di.dart';
|
||||
|
||||
GoRouter buildRouter(AuthCubit auth) {
|
||||
return GoRouter(
|
||||
@@ -26,7 +39,40 @@ GoRouter buildRouter(AuthCubit auth) {
|
||||
routes: [
|
||||
GoRoute(path: '/phone', builder: (_, __) => const PhoneScreen()),
|
||||
GoRoute(path: '/otp', builder: (_, __) => const OtpScreen()),
|
||||
GoRoute(path: '/home', builder: (_, __) => const HomeScreen()),
|
||||
GoRoute(
|
||||
path: '/home',
|
||||
builder: (_, __) => MultiBlocProvider(
|
||||
providers: [
|
||||
BlocProvider(create: (_) => HomeCubit(getIt<MapsRepository>())),
|
||||
],
|
||||
child: const HomeScreen(),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/destination',
|
||||
builder: (_, __) => BlocProvider(
|
||||
create: (_) => DestinationCubit(getIt<MapsRepository>()),
|
||||
child: const DestinationScreen(),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/route-preview',
|
||||
builder: (_, state) {
|
||||
final extra = state.extra as Map<String, dynamic>?;
|
||||
final pickup = extra?['pickup'] as PlaceModel?;
|
||||
final destination = extra?['destination'] as PlaceModel?;
|
||||
if (pickup == null || destination == null) {
|
||||
return const Scaffold(body: Center(child: Text('Missing data')));
|
||||
}
|
||||
return BlocProvider(
|
||||
create: (_) => QuoteCubit(getIt<TariffRepository>()),
|
||||
child: RoutePreviewScreen(pickup: pickup, destination: destination),
|
||||
);
|
||||
},
|
||||
),
|
||||
GoRoute(path: '/trip-tracking', builder: (_, __) => const TripTrackingScreen()),
|
||||
GoRoute(path: '/trip-invoice', builder: (_, __) => const TripInvoiceScreen()),
|
||||
GoRoute(path: '/trip-rating', builder: (_, __) => const RatingScreen()),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user