import 'package:app/router/modules/common_routes.dart';
import 'package:app/router/modules/student_routes.dart';
import 'package:app/router/modules/teacher_routes.dart';
import 'package:app/router/route_paths.dart';
import 'package:app/router/router_config.dart';
import 'package:flutter/material.dart' hide RouterConfig;
import 'package:go_router/go_router.dart';

List<RouterConfig> routeConfigs = [
  ...commonRoutes,
  ...teacherRoutes,
  ...studentRoutes
];

//for循环遍历
List<RouteBase> routes = routeConfigs.map((item) {
  return GoRoute(
    path: item.path,
    builder: (context, state) {
      return item.child(state);
    },
  );
}).toList();

GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();


//变量命名
GoRouter goRouter = GoRouter(
  navigatorKey: navigatorKey,
  initialLocation: RoutePaths.splash,
  routes: routes,
);
