76ab19ea47
- 蓝色顶栏(#1565C0)+ 深蓝侧边栏(#0D47A1),含折叠/展开 - 底部状态栏:门店编号、登录用户、登录时间、实时时钟、版本号 - 登录页:居中卡片,支持密码显示/隐藏 - 入库单列表:筛选/搜索/日期选择/分页,三个 Tab(入库单/查询/审核) - 新建入库单:基本信息 + 商品明细动态增删,实时计算合计金额 - 出库单列表:同入库单风格 - 库存查询:4 张统计卡片 + 颜色高亮缺货/预警行,库存预警 Tab - 往来单位、财务、商品、系统设置(用户/仓库/编号规则/系统参数) - 使用 Riverpod 状态管理 + go_router 路由 + Dio HTTP Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
64 lines
2.4 KiB
Dart
64 lines
2.4 KiB
Dart
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import '../../screens/auth/login_screen.dart';
|
|
import '../../screens/shell/app_shell.dart';
|
|
import '../../screens/stock_in/stock_in_list_screen.dart';
|
|
import '../../screens/stock_in/stock_in_form_screen.dart';
|
|
import '../../screens/stock_out/stock_out_list_screen.dart';
|
|
import '../../screens/inventory/inventory_list_screen.dart';
|
|
import '../../screens/inventory/inventory_check_screen.dart';
|
|
import '../../screens/partners/partners_screen.dart';
|
|
import '../../screens/finance/finance_screen.dart';
|
|
import '../../screens/products/products_screen.dart';
|
|
import '../../screens/settings/settings_screen.dart';
|
|
import '../auth/auth_state.dart';
|
|
|
|
final appRouterProvider = Provider<GoRouter>((ref) {
|
|
final authState = ref.watch(authStateProvider);
|
|
|
|
return GoRouter(
|
|
initialLocation: '/login',
|
|
redirect: (context, state) {
|
|
final isLoggedIn = authState.isLoggedIn;
|
|
final isLoginRoute = state.matchedLocation == '/login';
|
|
if (!isLoggedIn && !isLoginRoute) return '/login';
|
|
if (isLoggedIn && isLoginRoute) return '/stock-in';
|
|
return null;
|
|
},
|
|
routes: [
|
|
GoRoute(
|
|
path: '/login',
|
|
builder: (context, state) => const LoginScreen(),
|
|
),
|
|
ShellRoute(
|
|
builder: (context, state, child) => AppShell(child: child),
|
|
routes: [
|
|
GoRoute(
|
|
path: '/stock-in',
|
|
builder: (_, __) => const StockInListScreen()),
|
|
GoRoute(
|
|
path: '/stock-in/new',
|
|
builder: (_, __) => const StockInFormScreen()),
|
|
GoRoute(
|
|
path: '/stock-out',
|
|
builder: (_, __) => const StockOutListScreen()),
|
|
GoRoute(
|
|
path: '/inventory',
|
|
builder: (_, __) => const InventoryListScreen()),
|
|
GoRoute(
|
|
path: '/inventory/check',
|
|
builder: (_, __) => const InventoryCheckScreen()),
|
|
GoRoute(
|
|
path: '/partners', builder: (_, __) => const PartnersScreen()),
|
|
GoRoute(
|
|
path: '/finance', builder: (_, __) => const FinanceScreen()),
|
|
GoRoute(
|
|
path: '/products', builder: (_, __) => const ProductsScreen()),
|
|
GoRoute(
|
|
path: '/settings', builder: (_, __) => const SettingsScreen()),
|
|
],
|
|
),
|
|
],
|
|
);
|
|
});
|