Skip to content

Commit 2ce0d23

Browse files
authored
refactor: renamed presenter to cubit and moved api_config to /data (#49)
1 parent 0739fd6 commit 2ce0d23

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed
File renamed without changes.

lib/injection/data_module.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import 'package:dio/adapter.dart';
22
import 'package:dio/dio.dart';
3+
import 'package:flutter_template/data/api/api_config.dart';
34
import 'package:flutter_template/data/interceptor/auth_interceptor.dart';
45
import 'package:flutter_template/data/preferences/auth_preferences.dart';
56
import 'package:flutter_template/data/preferences/user_shared_preferences.dart';
67
import 'package:flutter_template/data/services/http_client/dio_http_client.dart';
78
import 'package:flutter_template/data/services/http_client/http_client.dart';
89
import 'package:flutter_template/data/services/http_profile_service.dart';
9-
import 'package:flutter_template/domain/api/api_config.dart';
1010
import 'package:flutter_template/domain/preferences/user_preferences.dart';
1111
import 'package:flutter_template/domain/services/profile_service.dart';
1212
import 'package:flutter_template/injection/injector.dart';

lib/presentation/feature/profile/profile_presenter.dart renamed to lib/presentation/feature/profile/profile_cubit.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import 'package:flutter_template/extensions/extensions.dart';
44
import 'package:flutter_template/presentation/feature/profile/profile_state.dart';
55
import 'package:freezed_annotation/freezed_annotation.dart';
66

7-
class ProfilePresenter extends Cubit<ProfileState> {
7+
class ProfileCubit extends Cubit<ProfileState> {
88
final ProfileService profileService;
99

10-
ProfilePresenter({
10+
ProfileCubit({
1111
required this.profileService,
1212
@visibleForTesting ProfileState? state,
1313
}) : super(state ?? ProfileState.initial());
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import 'package:flutter_template/injection/injector.dart';
2-
import 'package:flutter_template/presentation/feature/profile/profile_presenter.dart';
2+
import 'package:flutter_template/presentation/feature/profile/profile_cubit.dart';
33

44
class ProfileModule {
55
static Future<void> inject() async {
6-
injector.registerFactory<ProfilePresenter>(
7-
() => ProfilePresenter(profileService: injector()),
6+
injector.registerFactory<ProfileCubit>(
7+
() => ProfileCubit(profileService: injector()),
88
);
99
}
1010
}

lib/presentation/feature/profile/profile_page.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_bloc/flutter_bloc.dart';
33
import 'package:flutter_template/injection/injector.dart';
4-
import 'package:flutter_template/presentation/feature/profile/profile_presenter.dart';
4+
import 'package:flutter_template/presentation/feature/profile/profile_cubit.dart';
55
import 'package:flutter_template/presentation/feature/profile/profile_state.dart';
66
import 'package:flutter_template/presentation/resources/resources.dart';
77

@@ -13,7 +13,7 @@ class ProfilePage extends StatefulWidget {
1313
}
1414

1515
class _ProfilePageState extends State<ProfilePage> {
16-
final _profilePresenter = injector.get<ProfilePresenter>();
16+
final _profilePresenter = injector.get<ProfileCubit>();
1717

1818
@override
1919
void initState() {
@@ -27,7 +27,7 @@ class _ProfilePageState extends State<ProfilePage> {
2727
backgroundColor: context.colors.background,
2828
appBar: AppBar(
2929
backgroundColor: context.colors.accent,
30-
title: BlocBuilder<ProfilePresenter, ProfileState>(
30+
title: BlocBuilder<ProfileCubit, ProfileState>(
3131
bloc: _profilePresenter,
3232
builder: (context, state) {
3333
return Text(state.isLoading ? 'Profile' : 'Profile: ' + state.name);
@@ -40,7 +40,7 @@ class _ProfilePageState extends State<ProfilePage> {
4040
child: Center(
4141
child: Column(
4242
children: [
43-
BlocBuilder<ProfilePresenter, ProfileState>(
43+
BlocBuilder<ProfileCubit, ProfileState>(
4444
bloc: _profilePresenter,
4545
builder: (context, state) {
4646
if (state.isLoading) {

0 commit comments

Comments
 (0)