Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/mentor register #17

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions front/mentorme/lib/app/modules/home/home_module.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,23 @@ import 'package:mentorme/app/modules/home/presenter/home_controller.dart';
import 'package:mentorme/app/modules/home/presenter/home_page.dart';
import 'package:mentorme/app/modules/home/presenter/home_store.dart';
import 'package:mentorme/app/modules/home/presenter/mentor_profile/mentor_profile_page.dart';

import 'package:mentorme/app/modules/register/register_module.dart';

class HomeModule extends Module {
@override
List<Bind> get binds => [
Bind((i) => HomeController(i(), i(), i(), i())),
Bind((i) => HomeStore()),

Bind((i) => GetMentorMeUsecase(i())),
Bind((i) => GetMentorMeDatasource(i())),
Bind((i) => GetMentorMeRepository(i())),

Bind((i) => ContactHistoryUsecase(i())),
Bind((i) => ContactHistoryDatasource(i())),
Bind((i) => ContactHistoryRepository(i())),

Bind((i) => SkillUsecase(i())),
Bind((i) => SkillDatasource(i())),
Bind((i) => SkillRepository(i())),
];
Bind((i) => HomeController(i(), i(), i(), i())),
Bind((i) => HomeStore()),
Bind((i) => GetMentorMeUsecase(i())),
Bind((i) => GetMentorMeDatasource(i())),
Bind((i) => GetMentorMeRepository(i())),
Bind((i) => ContactHistoryUsecase(i())),
Bind((i) => ContactHistoryDatasource(i())),
Bind((i) => ContactHistoryRepository(i())),
Bind((i) => SkillUsecase(i())),
Bind((i) => SkillDatasource(i())),
Bind((i) => SkillRepository(i())),
];

@override
final List<ModularRoute> routes = [
Expand All @@ -42,8 +39,11 @@ class HomeModule extends Module {
),
ChildRoute(
'/mentor_profile_page',
child: (__, args) => MentorProfilePage(mentorEntity: args.data['mentor'],),
child: (__, args) => MentorProfilePage(
mentorEntity: args.data['mentor'],
),
transition: TransitionType.rightToLeft,
),
ModuleRoute('/register', module: RegisterModule()),
];
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ class HomeController {
);
}

void goToRegister() {
Modular.to.pushNamed(
'./register',
);
}

void goToMentorProfile() {
Modular.to.pushNamed(
'./mentor_profile_page',
Expand Down
142 changes: 95 additions & 47 deletions front/mentorme/lib/app/modules/home/presenter/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_modular/flutter_modular.dart';
import 'package:mentorme/app/shared/components/mentor_me_button.dart';
import 'package:mentorme/app/shared/components/mentorme_air_spin_ring.dart';
import 'package:mentorme/app/shared/components/mentorme_content_page.dart';
import 'package:mentorme/app/shared/theme/theme_colors.dart';
Expand Down Expand Up @@ -37,7 +38,8 @@ class _HomePageState extends State<HomePage> {
width: MediaQuery.of(context).size.width,
color: ThemeColors.backgroundColour,
child: Visibility(
visible: controller.store.homeState == MentorMeStates.loading,
visible:
controller.store.homeState == MentorMeStates.loading,
replacement: RefreshIndicator(
onRefresh: () async {
controller.doFetchmentor();
Expand All @@ -47,16 +49,25 @@ class _HomePageState extends State<HomePage> {
child: Column(
children: [
Container(
margin: const EdgeInsets.only(right: 15, left: 15),
margin:
const EdgeInsets.only(right: 15, left: 15),
child: Column(
children: [
const SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
ElevatedButton(
onPressed: () {
controller.goToRegister();
},
child: const Text("Quero mentorar"),
),
InkWell(
onTap: () {
controller.openBottomsheetFilterskills();
controller
.openBottomsheetFilterskills();
},
child: Row(
children: const [
Expand All @@ -69,72 +80,105 @@ class _HomePageState extends State<HomePage> {
),
),
Icon(
Icons.keyboard_arrow_down_outlined,
Icons
.keyboard_arrow_down_outlined,
color: Color(0XFF0497E3),
)
],
),
),
],
),
controller.store.listSkillsSelected.isEmpty ? Container() : const SizedBox(height: 15),
controller.store.listSkillsSelected.isEmpty
? Container()
: const SizedBox(height: 15),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
SingleChildScrollView(
physics: const BouncingScrollPhysics(),
physics:
const BouncingScrollPhysics(),
scrollDirection: Axis.horizontal,
child: Row(
children: controller.store.listSkillsSelected
children: controller
.store.listSkillsSelected
.map(
(e) => Container(
padding: const EdgeInsets.only(left: 13, right: 13),
margin: EdgeInsets.only(
right: controller.store.listSkillsSelected.last == e ? 0 : 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
border: Border.all(
color: const Color(0xFF535353),
),
),
child: Row(
children: [
Text(
e.name,
style: const TextStyle(
fontSize: 14,
color: Color(0xFF535353),
fontWeight: FontWeight.w400,
padding:
const EdgeInsets.only(
left: 13,
right: 13),
margin: EdgeInsets.only(
right: controller
.store
.listSkillsSelected
.last ==
e
? 0
: 10),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(
50),
border: Border.all(
color: const Color(
0xFF535353),
),
),
const SizedBox(width: 10),
InkWell(
onTap: () {
controller.store.listSkillsSelected.remove(e);
controller.doFetchmentor();
},
child: const Icon(
Icons.close,
color: Color(0xFF535353),
),
)
],
),
),
).toList(),
child: Row(
children: [
Text(
e.name,
style:
const TextStyle(
fontSize: 14,
color: Color(
0xFF535353),
fontWeight:
FontWeight.w400,
),
),
const SizedBox(
width: 10),
InkWell(
onTap: () {
controller.store
.listSkillsSelected
.remove(e);
controller
.doFetchmentor();
},
child: const Icon(
Icons.close,
color: Color(
0xFF535353),
),
)
],
),
),
)
.toList(),
),
),
controller.store.listSkillsSelected.isEmpty ? Container() : const SizedBox(height: 10),
controller.store.listSkillsSelected
.isEmpty
? Container()
: const SizedBox(height: 10),
],
)
],
),
),
controller.store.listMentors.isEmpty
? Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.center,
children: const [
Text(
'Nenhum mentor encontrado!',
Expand All @@ -150,12 +194,16 @@ class _HomePageState extends State<HomePage> {
children: controller.store.listMentors
.map(
(e) => Container(
margin: const EdgeInsets.symmetric(horizontal: 15, vertical: 5),
margin:
const EdgeInsets.symmetric(
horizontal: 15,
vertical: 5),
child: MentorCardWidget(
mentor: e,
),
),
).toList(),
)
.toList(),
),
],
),
Expand Down
8 changes: 5 additions & 3 deletions front/mentorme/lib/app/modules/login/login_module.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import 'package:mentorme/app/modules/home/home_module.dart';
import 'package:mentorme/app/modules/login/pages/login_controller.dart';
import 'package:mentorme/app/modules/login/pages/login_page.dart';
import 'package:mentorme/app/modules/login/pages/onboarding_page.dart';
import 'package:mentorme/app/modules/register/presenter/register_page.dart';
import 'package:mentorme/app/modules/register/register_module.dart';

class LoginModule extends Module {
@override
List<Bind> get binds => [
Bind((i) => LoginController(i(), i())),
];
Bind((i) => LoginController(i(), i())),
];

@override
final List<ModularRoute> routes = [
Expand All @@ -19,7 +21,7 @@ class LoginModule extends Module {
),
ChildRoute(
'/onboarding',
child: (__, args) => const OnboardingPage(),
child: (__, args) => OnboardingPage(),
transition: TransitionType.rightToLeft,
),
ModuleRoute('/home', module: HomeModule()),
Expand Down
21 changes: 19 additions & 2 deletions front/mentorme/lib/app/modules/login/pages/login_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,29 @@ class LoginController {
}

_goToLogin() {
goToHome();
//goToHome();
goToRegister();
}

goToRegister() async {
await Future.delayed(
const Duration(milliseconds: 500),
() {
Modular.to.pushReplacementNamed(
'/register/',
forRoot: true,
arguments: {
'wasLoginNow': false,
},
);
},
);
}

goToHome() async {
await Future.delayed(
const Duration(milliseconds: 500), () {
const Duration(milliseconds: 500),
() {
Modular.to.pushReplacementNamed(
'/home/',
forRoot: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class _OnboardingPageState extends State<OnboardingPage> {
flex: 18,
child: Container(
padding:
const EdgeInsets.symmetric(vertical: 20, horizontal: 20),
const EdgeInsets.symmetric(vertical: 20, horizontal: 20),
alignment: Alignment.bottomCenter,
child: SizedBox(
width: double.infinity,
Expand All @@ -80,4 +80,4 @@ class _OnboardingPageState extends State<OnboardingPage> {
),
);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import 'package:mentorme/app/core/domain/entities/contacts.dart';

class RegisterEntity {
int id;
String name;
String description;
List<Map<String, String>> contacts;
String image;
bool canTeach;
bool wantToLearn;

RegisterEntity(
{required this.id,
required this.name,
required this.description,
required this.contacts,
required this.image,
required this.canTeach,
required this.wantToLearn});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import 'package:mentorme/app/core/domain/entities/mentor_entity.dart';

class RegisterResponse {
final int statusCode;

RegisterResponse(this.statusCode);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import 'package:dartz/dartz.dart';
import 'package:mentorme/app/modules/register/domain/entities/register_response.dart';
import 'package:mentorme/app/modules/register/domain/params/register_params.dart';
import 'package:mentorme/app/shared/contracts/i_error.dart';

abstract class IRegisterRepository {
Future<Either<IError, RegisterResponse>> call(RegisterParams params);
}
Loading