mirror of
https://github.com/smmarty/friflex_flutter_starter.git
synced 2025-12-22 09:30:45 +00:00
refactor(linter): Перейти на friflex_linter, обновить правила
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user