This commit is contained in:
petrovyuri
2025-01-21 14:24:31 +03:00
parent e7b2c31e86
commit 17d096baac
96 changed files with 3575 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
import '../../domain/repository/i_main_repository.dart';
/// {@template MainMockRepository}
///
/// {@endtemplate}
final class MainMockRepository implements IMainRepository {
@override
String get name => 'MainMockRepository';
}

View File

@@ -0,0 +1,15 @@
import 'package:friflex_starter/app/http/i_http_client.dart';
import '../../domain/repository/i_main_repository.dart';
/// {@template MainRepository}
///
/// {@endtemplate}
final class MainRepository implements IMainRepository {
final IHttpClient httpClient;
MainRepository({required this.httpClient});
@override
String get name => 'MainRepository';
}

View File

@@ -0,0 +1,6 @@
import 'package:friflex_starter/di/di_base_repo.dart';
/// {@template IMainRepository}
///
/// {@endtemplate}
abstract interface class IMainRepository with DiBaseRepo{}

View File

@@ -0,0 +1,32 @@
import 'package:flutter/widgets.dart';
import 'package:friflex_starter/features/main/presentation/screens/main_screen.dart';
import 'package:go_router/go_router.dart';
abstract final class MainRoutes {
/// Название роута главной страницы
static const String mainScreenName = 'main_screen';
/// Путь роута страницы профиля пользователя
static const String _mainScreenPath = '/main';
/// Метод для построения ветки роутов по фиче профиля пользователя
///
/// Принимает:
/// - [routes] - вложенные роуты
static StatefulShellBranch buildShellBranch({
List<RouteBase> routes = const [],
List<NavigatorObserver>? observers,
}) =>
StatefulShellBranch(
initialLocation: _mainScreenPath,
observers: observers,
routes: [
GoRoute(
path: _mainScreenPath,
name: mainScreenName,
builder: (context, state) => const MainScreen(),
routes: routes,
),
],
);
}

View File

@@ -0,0 +1,73 @@
import 'package:flutter/material.dart';
import 'package:friflex_starter/app/app_context_ext.dart';
import 'package:friflex_starter/app/theme/app_colors_scheme.dart';
class MainScreen extends StatelessWidget {
const MainScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Main Screen'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(height: 16),
Text(
'Окружение: ${context.di.appConfig.env.name}',
),
const SizedBox(height: 16),
ElevatedButton(
onPressed: () {
context.theme.changeTheme();
},
child: const Text('Сменить тему'),
),
const SizedBox(height: 16),
ColoredBox(
color: context.colors.testColor,
child: const SizedBox(height: 100, width: 100),
),
const SizedBox(height: 16),
Text(
'Текущая тема: ${context.theme.themeMode}',
),
const SizedBox(height: 16),
Text(
'Текущий репозиторий: ${context.di.repositories.authRepository.name}',
),
const SizedBox(height: 16),
ElevatedButton(
onPressed: () {
context.localization.changeLocal(
const Locale('ru', 'RU'),
);
},
child: const Text('Сменить язык на Rусский'),
),
const SizedBox(height: 16),
ElevatedButton(
onPressed: () {
context.localization.changeLocal(
const Locale('en', 'EN'),
);
},
child: const Text('Сменить язык на Английский'),
),
const SizedBox(height: 16),
Text(
'Тестовое слово: ${context.l10n.helloWorld}',
),
const SizedBox(height: 16),
Text(
'Текущий язык: ${context.l10n.localeName}',
),
],
),
),
);
}
}