Skip to content

Commit 6d42853

Browse files
committed
Format code
1 parent 60e2af3 commit 6d42853

File tree

10 files changed

+39
-17
lines changed

10 files changed

+39
-17
lines changed

example/lib/core/injectable/injectable.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ import 'package:injectable/injectable.dart';
66
final getIt = GetIt.instance;
77

88
@InjectableInit()
9-
Future<void> configureDependencies() async => getIt.init(environment: kDebugMode ? dev.name : prod.name);
9+
Future<void> configureDependencies() async =>
10+
getIt.init(environment: kDebugMode ? dev.name : prod.name);

example/lib/main.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,21 @@ class MyHomePage extends StatelessWidget {
3636
ElevatedButton(
3737
onPressed: () => Navigator.of(context).push(
3838
MaterialPageRoute(
39-
builder: (context) => UserPage(onCreateCubit: (context) => getIt<UserCubit>()..getRandomUser()),
39+
builder: (context) => UserPage(
40+
onCreateCubit: (context) =>
41+
getIt<UserCubit>()..getRandomUser(),
42+
),
4043
),
4144
),
4245
child: const Text('Get user succesfully'),
4346
),
4447
ElevatedButton(
4548
onPressed: () => Navigator.of(context).push(
4649
MaterialPageRoute(
47-
builder: (context) => UserPage(onCreateCubit: (context) => getIt<UserCubit>()..getRandomUserFails()),
50+
builder: (context) => UserPage(
51+
onCreateCubit: (context) =>
52+
getIt<UserCubit>()..getRandomUserFails(),
53+
),
4854
),
4955
),
5056
child: const Text('Get user fails'),

example/lib/profile/data/model/api_user_response.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ class ApiUserResponse with _$ApiUserResponse {
1111
required List<User> results,
1212
}) = _ApiUserResponse;
1313

14-
factory ApiUserResponse.fromJson(Map<String, dynamic> json) => _$ApiUserResponseFromJson(json);
15-
}
14+
factory ApiUserResponse.fromJson(Map<String, dynamic> json) =>
15+
_$ApiUserResponseFromJson(json);
16+
}

example/lib/profile/data/model/location.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ class Location with _$Location {
1414
required String country,
1515
}) = _Location;
1616

17-
factory Location.fromJson(Map<String, dynamic> json) => _$LocationFromJson(json);
18-
}
17+
factory Location.fromJson(Map<String, dynamic> json) =>
18+
_$LocationFromJson(json);
19+
}

example/lib/profile/data/model/name.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ class Name with _$Name {
1212
}) = _Name;
1313

1414
factory Name.fromJson(Map<String, dynamic> json) => _$NameFromJson(json);
15-
}
15+
}

example/lib/profile/data/model/picture.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ class Picture with _$Picture {
1111
required String thumbnail,
1212
}) = _Picture;
1313

14-
factory Picture.fromJson(Map<String, dynamic> json) => _$PictureFromJson(json);
15-
}
14+
factory Picture.fromJson(Map<String, dynamic> json) =>
15+
_$PictureFromJson(json);
16+
}

example/lib/profile/data/model/street.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ class Street with _$Street {
1111
}) = _Street;
1212

1313
factory Street.fromJson(Map<String, dynamic> json) => _$StreetFromJson(json);
14-
}
14+
}

example/lib/profile/presentation/cubit/user_cubit.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ part 'user_cubit.freezed.dart';
1010
part 'user_state.dart';
1111

1212
@injectable
13-
class UserCubit extends Cubit<UserState> with BlocPresentationMixin<UserState, UserEvent> {
13+
class UserCubit extends Cubit<UserState>
14+
with BlocPresentationMixin<UserState, UserEvent> {
1415
UserCubit(this._userRepo) : super(const UserState(user: null));
1516

1617
final UserRepository _userRepo;

example/lib/profile/presentation/cubit/user_event.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ sealed class UserEvent {
44

55
class UserLoaded implements UserEvent {
66
const UserLoaded();
7-
7+
88
@override
99
String get reason => 'User loaded';
1010
}
1111

1212
class UserFetchFailed implements UserEvent {
1313
const UserFetchFailed();
14-
14+
1515
@override
1616
String get reason => 'User fetch failed';
1717
}

example/lib/profile/presentation/user_page.dart

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,30 @@ import 'package:example/profile/presentation/cubit/user_event.dart';
44
import 'package:flutter/material.dart';
55

66
class UserPage extends BlocfulWidget<UserCubit, UserState, UserEvent> {
7-
const UserPage({required this.onCreateCubit, super.key}) : super(onCreateBloc: onCreateCubit);
7+
const UserPage({required this.onCreateCubit, super.key})
8+
: super(onCreateBloc: onCreateCubit);
89

910
final UserCubit Function(BuildContext)? onCreateCubit;
1011

1112
@override
1213
void onPresentationEvent(BuildContext context, UserEvent event) {
13-
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(event.reason)));
14+
ScaffoldMessenger.of(context)
15+
.showSnackBar(SnackBar(content: Text(event.reason)));
1416
}
1517

1618
@override
1719
Widget builder(BuildContext context, UserCubit bloc, UserState state) {
1820
return Scaffold(
19-
body: Center(child: Text(state.user?.email ?? '')),
21+
body: SafeArea(
22+
child: Center(
23+
child: Column(
24+
mainAxisAlignment: MainAxisAlignment.center,
25+
children: [
26+
Text(state.user?.email ?? ''),
27+
Text(state.user?.phone ?? ''),
28+
],
29+
)),
30+
),
2031
);
2132
}
2233
}

0 commit comments

Comments
 (0)