- All 5 batch steps: Picking, Sorting, Clarification, Slots, Handoff - go_router navigation with step indicator - graphql_flutter client wired up (endpoint via env var) - Mock data layer swappable with real GraphQL service - Item types: normal, cold, frozen, alcohol, clarify - Storage slot assignment (cell/freezer/fridge)
91 lines
2.8 KiB
Dart
91 lines
2.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
import 'features/auth/auth_screen.dart';
|
|
import 'features/clarification/clarification_screen.dart';
|
|
import 'features/handoff/handoff_screen.dart';
|
|
import 'features/order_detail/order_detail_screen.dart';
|
|
import 'features/orders/orders_list_screen.dart';
|
|
import 'features/picking/picking_screen.dart';
|
|
import 'features/slots/slots_screen.dart';
|
|
import 'features/sorting/sorting_screen.dart';
|
|
import 'core/theme/app_theme.dart';
|
|
|
|
final _router = GoRouter(
|
|
initialLocation: '/orders',
|
|
redirect: (context, state) async {
|
|
final prefs = await SharedPreferences.getInstance();
|
|
final token = prefs.getString('auth_token');
|
|
final onAuth = state.matchedLocation == '/auth';
|
|
if (token == null && !onAuth) return '/auth';
|
|
if (token != null && onAuth) return '/orders';
|
|
return null;
|
|
},
|
|
routes: [
|
|
GoRoute(
|
|
path: '/auth',
|
|
builder: (_, __) => const AuthScreen(),
|
|
),
|
|
GoRoute(
|
|
path: '/orders',
|
|
builder: (_, __) => const OrdersListScreen(),
|
|
routes: [
|
|
GoRoute(
|
|
path: ':orderId',
|
|
builder: (_, state) => OrderDetailScreen(
|
|
orderId: int.parse(state.pathParameters['orderId']!),
|
|
),
|
|
routes: [
|
|
GoRoute(
|
|
path: 'picking/:segmentId',
|
|
builder: (_, state) => PickingScreen(
|
|
orderId: int.parse(state.pathParameters['orderId']!),
|
|
segmentId: int.parse(state.pathParameters['segmentId']!),
|
|
),
|
|
),
|
|
GoRoute(
|
|
path: 'sorting',
|
|
builder: (_, state) => SortingScreen(
|
|
orderId: int.parse(state.pathParameters['orderId']!),
|
|
),
|
|
),
|
|
GoRoute(
|
|
path: 'clarification',
|
|
builder: (_, state) => ClarificationScreen(
|
|
orderId: int.parse(state.pathParameters['orderId']!),
|
|
),
|
|
),
|
|
GoRoute(
|
|
path: 'slots',
|
|
builder: (_, state) => SlotsScreen(
|
|
orderId: int.parse(state.pathParameters['orderId']!),
|
|
),
|
|
),
|
|
GoRoute(
|
|
path: 'handoff',
|
|
builder: (_, state) => HandoffScreen(
|
|
orderId: int.parse(state.pathParameters['orderId']!),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
],
|
|
);
|
|
|
|
class VelmartPickerApp extends StatelessWidget {
|
|
const VelmartPickerApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp.router(
|
|
title: 'Велмарт Комплектовщик',
|
|
theme: AppTheme.theme,
|
|
routerConfig: _router,
|
|
debugShowCheckedModeBanner: false,
|
|
);
|
|
}
|
|
}
|