mirror of
https://github.com/smmarty/friflex_flutter_starter.git
synced 2026-02-05 11:42:17 +00:00
refactor(linter): Перейти на friflex_linter, обновить правила
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import '../../domain/repository/i_auth_repository.dart';
|
||||
import 'package:friflex_starter/features/auth/domain/repository/i_auth_repository.dart';
|
||||
|
||||
/// {@template AuthMockRepository}
|
||||
/// Mock реализация репозитория авторизации
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import 'package:friflex_starter/app/http/i_http_client.dart';
|
||||
|
||||
import '../../domain/repository/i_auth_repository.dart';
|
||||
import 'package:friflex_starter/features/auth/domain/repository/i_auth_repository.dart';
|
||||
|
||||
/// {@template AuthRepository}
|
||||
/// Реализация репозитория авторизации
|
||||
/// {@endtemplate}
|
||||
final class AuthRepository implements IAuthRepository {
|
||||
final IHttpClient httpClient;
|
||||
|
||||
AuthRepository({required this.httpClient});
|
||||
final IHttpClient httpClient;
|
||||
|
||||
@override
|
||||
String get name => 'AuthRepository';
|
||||
|
||||
@@ -10,12 +10,8 @@ class AuthScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('AuthScreen'),
|
||||
),
|
||||
body: const Center(
|
||||
child: Text('AuthScreen'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('AuthScreen')),
|
||||
body: const Center(child: Text('AuthScreen')),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,36 +32,36 @@ abstract final class DebugRoutes {
|
||||
/// Принимает:
|
||||
/// - [routes] - вложенные роуты
|
||||
static GoRoute buildRoutes({List<RouteBase> routes = const []}) => GoRoute(
|
||||
path: debugScreenPath,
|
||||
name: debugScreenName,
|
||||
builder: (context, state) => const DebugScreen(),
|
||||
routes: [
|
||||
...routes,
|
||||
GoRoute(
|
||||
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(),
|
||||
),
|
||||
],
|
||||
);
|
||||
path: debugScreenPath,
|
||||
name: debugScreenName,
|
||||
builder: (context, state) => const DebugScreen(),
|
||||
routes: [
|
||||
...routes,
|
||||
GoRoute(
|
||||
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(),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -62,15 +62,17 @@ class DebugService implements IDebugService {
|
||||
Map<String, dynamic>? args,
|
||||
StackTrace? stackTrace,
|
||||
}) {
|
||||
final logMessage =
|
||||
message is Function ? Function.apply(message, []) as Object : message;
|
||||
final logMessage = message is Function
|
||||
? Function.apply(message, []) as Object
|
||||
: message;
|
||||
_talker.error(logMessage, error, stackTrace);
|
||||
}
|
||||
|
||||
@override
|
||||
void log(Object message, {Object? logLevel, Map<String, dynamic>? args}) {
|
||||
final logMessage =
|
||||
message is Function ? Function.apply(message, []) as Object : message;
|
||||
final logMessage = message is Function
|
||||
? Function.apply(message, []) as Object
|
||||
: message;
|
||||
_talker.log(logMessage);
|
||||
}
|
||||
|
||||
@@ -80,14 +82,17 @@ class DebugService implements IDebugService {
|
||||
Object? logLevel,
|
||||
Map<String, dynamic>? args,
|
||||
}) {
|
||||
final logMessage =
|
||||
message is Function ? Function.apply(message, []) as Object : message;
|
||||
final logMessage = message is Function
|
||||
? Function.apply(message, []) as Object
|
||||
: message;
|
||||
_talker.warning(logMessage);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> openDebugScreen(BuildContext context,
|
||||
{bool useRootNavigator = false,}) async {
|
||||
Future<void> openDebugScreen(
|
||||
BuildContext context, {
|
||||
bool useRootNavigator = false,
|
||||
}) async {
|
||||
await Navigator.of(context).push(
|
||||
MaterialPageRoute(builder: (context) => TalkerScreen(talker: _talker)),
|
||||
);
|
||||
|
||||
@@ -14,11 +14,7 @@ abstract interface class IDebugService {
|
||||
dynamic get blocObserver;
|
||||
|
||||
/// Метод для логирования сообщений
|
||||
void log(
|
||||
Object message, {
|
||||
Object logLevel,
|
||||
Map<String, dynamic>? args,
|
||||
});
|
||||
void log(Object message, {Object logLevel, Map<String, dynamic>? args});
|
||||
|
||||
/// Метод для логирования предупреждений
|
||||
void logWarning(
|
||||
@@ -37,11 +33,7 @@ abstract interface class IDebugService {
|
||||
});
|
||||
|
||||
/// Метод для обработки ошибок
|
||||
void logDebug(
|
||||
Object message, {
|
||||
Object logLevel,
|
||||
Map<String, dynamic>? args,
|
||||
});
|
||||
void logDebug(Object message, {Object logLevel, Map<String, dynamic>? args});
|
||||
|
||||
/// Метод для открытия окна отладки
|
||||
///
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'package:friflex_starter/features/debug/debug_routes.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
class DebugScreen extends StatelessWidget {
|
||||
const DebugScreen({Key? key}) : super(key: key);
|
||||
const DebugScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -15,9 +15,7 @@ class DebugScreen extends StatelessWidget {
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
Text(
|
||||
'Окружение: ${context.di.appConfig.env.name}',
|
||||
),
|
||||
Text('Окружение: ${context.di.appConfig.env.name}'),
|
||||
const HBox(22),
|
||||
Text(
|
||||
'Реализация AppServices: ${context.di.services.secureStorage.nameImpl}',
|
||||
|
||||
@@ -12,9 +12,7 @@ class IconsScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final iconList = Assets.icons.values
|
||||
.map(
|
||||
(icon) => _ItemIcon(icon: icon.svg(), name: icon.path),
|
||||
)
|
||||
.map((icon) => _ItemIcon(icon: icon.svg(), name: icon.path))
|
||||
.toList();
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Иконки')),
|
||||
|
||||
@@ -22,18 +22,14 @@ class LangScreen extends StatelessWidget {
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
context.localization.changeLocal(
|
||||
const Locale('ru', 'RU'),
|
||||
);
|
||||
context.localization.changeLocal(const Locale('ru', 'RU'));
|
||||
},
|
||||
child: const Text('Сменить язык на Rусский'),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
context.localization.changeLocal(
|
||||
const Locale('en', 'EN'),
|
||||
);
|
||||
context.localization.changeLocal(const Locale('en', 'EN'));
|
||||
},
|
||||
child: const Text('Сменить язык на Английский'),
|
||||
),
|
||||
@@ -54,9 +50,7 @@ class LangScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'Текущий язык: ${context.l10n.localeName}',
|
||||
),
|
||||
Text('Текущий язык: ${context.l10n.localeName}'),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -29,9 +29,7 @@ class ThemeScreen extends StatelessWidget {
|
||||
child: const SizedBox(height: 100, width: 100),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'Текущая тема: ${context.theme.themeMode}',
|
||||
),
|
||||
Text('Текущая тема: ${context.theme.themeMode}'),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -15,13 +15,9 @@ class TokensScreen extends StatelessWidget {
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: const [
|
||||
Text(
|
||||
'Access Token: ',
|
||||
),
|
||||
Text('Access Token: '),
|
||||
SizedBox(height: 16),
|
||||
Text(
|
||||
'Refresh Token: ',
|
||||
),
|
||||
Text('Refresh Token: '),
|
||||
SizedBox(height: 16),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -11,16 +11,12 @@ class UiKitScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('UI Kit Screen'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('UI Kit Screen')),
|
||||
body: Center(
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: const [
|
||||
Text(
|
||||
'UI Kit Screen',
|
||||
),
|
||||
Text('UI Kit Screen'),
|
||||
SizedBox(height: 16),
|
||||
// Здесь можно добавить другие компоненты UI Kit
|
||||
],
|
||||
|
||||
@@ -6,9 +6,9 @@ import 'package:flutter/material.dart';
|
||||
class ErrorScreen extends StatelessWidget {
|
||||
/// {@macro ErrorScreen}
|
||||
const ErrorScreen({
|
||||
super.key,
|
||||
required this.error,
|
||||
required this.stackTrace,
|
||||
super.key,
|
||||
this.onRetry,
|
||||
});
|
||||
|
||||
@@ -31,14 +31,11 @@ class ErrorScreen extends StatelessWidget {
|
||||
child: const Text('Перезагрузить приложение'),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'''
|
||||
Text('''
|
||||
Что-то пошло не так, попробуйте перезагрузить приложение
|
||||
error: $error
|
||||
stackTrace: $stackTrace
|
||||
''',
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
''', textAlign: TextAlign.center),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import '../../domain/repository/i_main_repository.dart';
|
||||
import 'package:friflex_starter/features/main/domain/repository/i_main_repository.dart';
|
||||
|
||||
/// {@template MainMockRepository}
|
||||
///
|
||||
@@ -6,4 +6,4 @@ import '../../domain/repository/i_main_repository.dart';
|
||||
final class MainMockRepository implements IMainRepository {
|
||||
@override
|
||||
String get name => 'MainMockRepository';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import 'package:friflex_starter/app/http/i_http_client.dart';
|
||||
|
||||
import '../../domain/repository/i_main_repository.dart';
|
||||
import 'package:friflex_starter/features/main/domain/repository/i_main_repository.dart';
|
||||
|
||||
/// {@template MainRepository}
|
||||
///
|
||||
/// {@endtemplate}
|
||||
final class MainRepository implements IMainRepository {
|
||||
final IHttpClient httpClient;
|
||||
|
||||
MainRepository({required this.httpClient});
|
||||
final IHttpClient httpClient;
|
||||
|
||||
@override
|
||||
String get name => 'MainRepository';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:friflex_starter/di/di_base_repo.dart';
|
||||
|
||||
/// {@template IMainRepository}
|
||||
///
|
||||
///
|
||||
/// {@endtemplate}
|
||||
abstract interface class IMainRepository with DiBaseRepo{}
|
||||
abstract interface class IMainRepository with DiBaseRepo {}
|
||||
|
||||
@@ -23,25 +23,24 @@ abstract final class MainRoutes {
|
||||
static StatefulShellBranch buildShellBranch({
|
||||
List<RouteBase> routes = const [],
|
||||
List<NavigatorObserver>? observers,
|
||||
}) =>
|
||||
StatefulShellBranch(
|
||||
initialLocation: _mainScreenPath,
|
||||
observers: observers,
|
||||
}) => StatefulShellBranch(
|
||||
initialLocation: _mainScreenPath,
|
||||
observers: observers,
|
||||
routes: [
|
||||
...routes,
|
||||
GoRoute(
|
||||
path: _mainScreenPath,
|
||||
name: mainScreenName,
|
||||
builder: (context, state) => const MainScreen(),
|
||||
routes: [
|
||||
...routes,
|
||||
// Пример вложенного роута для главного экрана
|
||||
GoRoute(
|
||||
path: _mainScreenPath,
|
||||
name: mainScreenName,
|
||||
builder: (context, state) => const MainScreen(),
|
||||
routes: [
|
||||
// Пример вложенного роута для главного экрана
|
||||
GoRoute(
|
||||
path: _mainDetailScreenPath,
|
||||
name: mainDetailScreenName,
|
||||
builder: (context, state) => const MainDetailScreen(),
|
||||
),
|
||||
],
|
||||
path: _mainDetailScreenPath,
|
||||
name: mainDetailScreenName,
|
||||
builder: (context, state) => const MainDetailScreen(),
|
||||
),
|
||||
],
|
||||
);
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,12 +10,8 @@ class MainDetailScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Main Detail Screen'),
|
||||
),
|
||||
body: const Center(
|
||||
child: Text('Вложенный экран'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('Main Detail Screen')),
|
||||
body: const Center(child: Text('Вложенный экран')),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,7 @@ class MainScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Main Screen'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('Main Screen')),
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import '../../domain/repository/i_profile_repository.dart';
|
||||
import 'package:friflex_starter/features/profile/domain/repository/i_profile_repository.dart';
|
||||
|
||||
/// {@template ProfileMockRepository}
|
||||
///
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import 'package:friflex_starter/app/http/i_http_client.dart';
|
||||
|
||||
import '../../domain/repository/i_profile_repository.dart';
|
||||
import 'package:friflex_starter/features/profile/domain/repository/i_profile_repository.dart';
|
||||
|
||||
/// {@template ProfileRepository}
|
||||
///
|
||||
/// {@endtemplate}
|
||||
final class ProfileRepository implements IProfileRepository {
|
||||
final IHttpClient httpClient;
|
||||
|
||||
ProfileRepository({required this.httpClient});
|
||||
final IHttpClient httpClient;
|
||||
|
||||
@override
|
||||
String get name => 'ProfileRepository';
|
||||
|
||||
@@ -8,9 +8,9 @@ sealed class ProfileEvent extends Equatable {
|
||||
}
|
||||
|
||||
final class ProfileFetchProfileEvent extends ProfileEvent {
|
||||
final String id;
|
||||
|
||||
const ProfileFetchProfileEvent({required this.id});
|
||||
final String id;
|
||||
|
||||
@override
|
||||
List<Object> get props => [id];
|
||||
|
||||
@@ -12,24 +12,24 @@ final class ProfileInitialState extends ProfileState {}
|
||||
final class ProfileWaitingState extends ProfileState {}
|
||||
|
||||
final class ProfileErrorState extends ProfileState {
|
||||
final String message;
|
||||
final Object error;
|
||||
final StackTrace? stackTrace;
|
||||
|
||||
const ProfileErrorState({
|
||||
required this.message,
|
||||
required this.error,
|
||||
this.stackTrace,
|
||||
});
|
||||
final String message;
|
||||
final Object error;
|
||||
final StackTrace? stackTrace;
|
||||
|
||||
@override
|
||||
List<Object> get props => [message, error];
|
||||
}
|
||||
|
||||
final class ProfileSuccessState extends ProfileState {
|
||||
final Object data;
|
||||
|
||||
const ProfileSuccessState({required this.data});
|
||||
final Object data;
|
||||
|
||||
@override
|
||||
List<Object> get props => [data];
|
||||
|
||||
@@ -16,17 +16,16 @@ abstract final class ProfileRoutes {
|
||||
static StatefulShellBranch buildShellBranch({
|
||||
List<RouteBase> routes = const [],
|
||||
List<NavigatorObserver>? observers,
|
||||
}) =>
|
||||
StatefulShellBranch(
|
||||
initialLocation: _profileScreenPath,
|
||||
observers: observers,
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: _profileScreenPath,
|
||||
name: profileScreenName,
|
||||
builder: (context, state) => const ProfileScreen(),
|
||||
routes: routes,
|
||||
),
|
||||
],
|
||||
);
|
||||
}) => StatefulShellBranch(
|
||||
initialLocation: _profileScreenPath,
|
||||
observers: observers,
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: _profileScreenPath,
|
||||
name: profileScreenName,
|
||||
builder: (context, state) => const ProfileScreen(),
|
||||
routes: routes,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,8 +15,9 @@ class ProfileScreen extends StatelessWidget {
|
||||
// и вызываем событие ProfileFetchProfileEvent
|
||||
// Или любые другие события, которые вам нужны
|
||||
return BlocProvider(
|
||||
create: (context) => ProfileBloc(profileRepository)
|
||||
..add(const ProfileFetchProfileEvent(id: '1')),
|
||||
create: (context) =>
|
||||
ProfileBloc(profileRepository)
|
||||
..add(const ProfileFetchProfileEvent(id: '1')),
|
||||
child: const _ProfileScreenView(),
|
||||
);
|
||||
}
|
||||
@@ -29,9 +30,7 @@ class _ProfileScreenView extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Profile'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('Profile')),
|
||||
body: Center(
|
||||
child: BlocBuilder<ProfileBloc, ProfileState>(
|
||||
builder: (context, state) {
|
||||
|
||||
@@ -10,10 +10,7 @@ class RootScreen extends StatelessWidget {
|
||||
///
|
||||
/// Принимает:
|
||||
/// - [navigationShell] - текущая ветка навигации
|
||||
const RootScreen({
|
||||
super.key,
|
||||
required this.navigationShell,
|
||||
});
|
||||
const RootScreen({required this.navigationShell, super.key});
|
||||
|
||||
/// Текущая ветка навигации
|
||||
final StatefulNavigationShell navigationShell;
|
||||
|
||||
@@ -11,8 +11,6 @@ class SplashScreen extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Assets.lottie.splash.lottie(),
|
||||
);
|
||||
return Center(child: Assets.lottie.splash.lottie());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user