Skip to content

Commit

Permalink
Implement SignUp and deactivate DebugView
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermedjr committed Nov 7, 2023
1 parent c738e2d commit 76b5c80
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/MobileApp/lib/View/SignView/Sign.view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class _SignViewState extends State<SignView> {
@override
Widget build(BuildContext context) {
return Scaffold(
endDrawer: SignUp(),
endDrawer: SignUpView(),
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
Expand Down
25 changes: 21 additions & 4 deletions src/MobileApp/lib/View/SignView/SignUp.view.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// @dart=2.9
import 'package:ReachUp/Component/Dialog/CustomDialog.component.dart';
import 'package:ReachUp/Controller/Account.controller.dart';
import 'package:ReachUp/Controller/Category.controller.dart';
import 'package:ReachUp/Model/Category.model.dart';
import 'package:ReachUp/Model/User.model.dart';
import 'package:ReachUp/View/SignView/SignUpPreferences.view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_signin_button/flutter_signin_button.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';

Expand All @@ -16,12 +18,12 @@ List<GlobalKey<FormState>> formKeys = [
GlobalKey<FormState>(), //Userpassword formState
];

class SignUp extends StatefulWidget {
class SignUpView extends StatefulWidget {
@override
_SignUpState createState() => _SignUpState();
_SignUpViewState createState() => _SignUpViewState();
}

class _SignUpState extends State<SignUp> {
class _SignUpViewState extends State<SignUpView> {
final _formKey = GlobalKey<FormState>();
int currentStep;

Expand Down Expand Up @@ -97,6 +99,7 @@ class StepperBody extends StatefulWidget {

class _StepperBodyState extends State<StepperBody> {
final CategoryController _categoryController = new CategoryController();
final AccountController accountController = new AccountController();

static final _focusNode = FocusNode();
static UserData user = UserData();
Expand All @@ -114,6 +117,12 @@ class _StepperBodyState extends State<StepperBody> {
});
}

@override
void deactivate() {
EasyLoading.dismiss();
super.deactivate();
}

List<Step> steps = [
Step(
title: Text('Nome', style: TextStyle(color: Color(0xFF525252))),
Expand Down Expand Up @@ -302,7 +311,15 @@ class _StepperBodyState extends State<StepperBody> {
email: user.email,
password: user.password,
role: "cli");
//send _user to [POST] api/Account/SignUp
EasyLoading.show(status: "Carregando");
accountController.signUp().then((value) {
EasyLoading.dismiss();
Globals.user = value;
Database.insert(
key: "user",
value: jsonEncode(
Globals.user.toJson()));
});

List<Category> categories = new List<Category>();

Expand Down
2 changes: 1 addition & 1 deletion src/MobileApp/lib/globals.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import 'package:flutter/services.dart' show rootBundle;
class Globals {
static User user = new User();
static bool isLoggedIn = false;
static String urlAPI;
static String urlAPI = 'https://reachup-poc.azurewebsites.net/api';

static List<Beacon> beacons = <Beacon>[];
static List<CommuniqueSubCategory> communiqueSubCategories =
Expand Down
3 changes: 2 additions & 1 deletion src/MobileApp/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:get_storage/get_storage.dart';
import 'Component/Database/Database.db.dart';
import 'Model/User.model.dart';
import 'View/DebugView/Debug.view.dart';
import 'package:ReachUp/View/SignView/Sign.view.dart';
import 'View/HomeView/Home.view.dart';
import 'View/_Layouts/HomeLayout.layout.dart';
import 'View/splashscreen.view.dart';
Expand Down Expand Up @@ -100,7 +101,7 @@ class ReachUp extends StatelessWidget {
title: 'ReachUp!',
debugShowCheckedModeBanner: false,
theme: lightTheme,
home: DebugView(),
home: SignView(),
builder: (BuildContext context, Widget child) {
/// make sure that loading can be displayed in front of all other widgets
return FlutterEasyLoading(child: child);
Expand Down

0 comments on commit 76b5c80

Please sign in to comment.