mirror of
https://github.com/smmarty/friflex_flutter_starter.git
synced 2026-02-05 03:32:18 +00:00
refactor(full refactor): Рефакторинг стартера (#8)
This commit is contained in:
@@ -1,31 +1,66 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:friflex_starter/features/debug/debug_screen.dart';
|
||||
import 'package:friflex_starter/features/debug/screens/debug_screen.dart';
|
||||
import 'package:friflex_starter/features/debug/screens/icons_screen.dart';
|
||||
import 'package:friflex_starter/features/debug/screens/lang_screen.dart';
|
||||
import 'package:friflex_starter/features/debug/screens/theme_screen.dart';
|
||||
import 'package:friflex_starter/features/debug/screens/tokens_screen.dart';
|
||||
import 'package:friflex_starter/features/debug/screens/ui_kit_screen.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
/// {@template debug_routes}
|
||||
/// Роуты для отладки приложения
|
||||
/// [buildRoutes] - метод для создания роутов
|
||||
/// {@endtemplate}
|
||||
abstract final class DebugRoutes {
|
||||
/// Название роута страницы профиля пользователя
|
||||
/// Название экранов
|
||||
static const String debugScreenName = 'debug_screen';
|
||||
static const String tokensScreenName = 'tokens_screen';
|
||||
static const String uiKitScreenName = 'ui_kit_screen';
|
||||
static const String iconsScreenName = 'icons_screen';
|
||||
static const String themeScreenName = 'theme_screen';
|
||||
static const String langScreenName = 'lang_screen';
|
||||
|
||||
/// Путь роута страницы профиля пользователя
|
||||
static const String _debugScreenPath = '/debug';
|
||||
/// Пути к экранам
|
||||
static const String debugScreenPath = '/debug';
|
||||
static const String tokensScreenPath = 'debug/tokens';
|
||||
static const String uiKitScreenPath = 'debug/ui_kit';
|
||||
static const String iconsScreenPath = 'debug/icons';
|
||||
static const String themeScreenPath = 'debug/theme';
|
||||
static const String langScreenPath = 'debug/lang';
|
||||
|
||||
/// Метод для построения ветки роутов по фиче профиля пользователя
|
||||
/// Метод для создания роутов для отладки
|
||||
///
|
||||
/// Принимает:
|
||||
/// - [routes] - вложенные роуты
|
||||
static StatefulShellBranch buildShellBranch({
|
||||
List<RouteBase> routes = const [],
|
||||
List<NavigatorObserver>? observers,
|
||||
}) =>
|
||||
StatefulShellBranch(
|
||||
initialLocation: _debugScreenPath,
|
||||
observers: observers,
|
||||
static GoRoute buildRoutes({List<RouteBase> routes = const []}) => GoRoute(
|
||||
path: debugScreenPath,
|
||||
name: debugScreenName,
|
||||
builder: (context, state) => const DebugScreen(),
|
||||
routes: [
|
||||
...routes,
|
||||
GoRoute(
|
||||
path: _debugScreenPath,
|
||||
name: debugScreenName,
|
||||
builder: (context, state) => const DebugScreen(),
|
||||
routes: routes,
|
||||
path: tokensScreenPath,
|
||||
name: tokensScreenName,
|
||||
builder: (context, state) => const TokensScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: uiKitScreenPath,
|
||||
name: uiKitScreenName,
|
||||
builder: (context, state) => const UiKitScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: iconsScreenPath,
|
||||
name: iconsScreenName,
|
||||
builder: (context, state) => const IconsScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: themeScreenPath,
|
||||
name: themeScreenName,
|
||||
builder: (context, state) => const ThemeScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: langScreenPath,
|
||||
name: langScreenName,
|
||||
builder: (context, state) => const LangScreen(),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user