Skip to content

Commit 76b5c80

Browse files
committed
Implement SignUp and deactivate DebugView
1 parent c738e2d commit 76b5c80

File tree

4 files changed

+25
-7
lines changed

4 files changed

+25
-7
lines changed

src/MobileApp/lib/View/SignView/Sign.view.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class _SignViewState extends State<SignView> {
3131
@override
3232
Widget build(BuildContext context) {
3333
return Scaffold(
34-
endDrawer: SignUp(),
34+
endDrawer: SignUpView(),
3535
body: Container(
3636
decoration: BoxDecoration(
3737
image: DecorationImage(

src/MobileApp/lib/View/SignView/SignUp.view.dart

+21-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
// @dart=2.9
22
import 'package:ReachUp/Component/Dialog/CustomDialog.component.dart';
3+
import 'package:ReachUp/Controller/Account.controller.dart';
34
import 'package:ReachUp/Controller/Category.controller.dart';
45
import 'package:ReachUp/Model/Category.model.dart';
56
import 'package:ReachUp/Model/User.model.dart';
67
import 'package:ReachUp/View/SignView/SignUpPreferences.view.dart';
78
import 'package:flutter/material.dart';
9+
import 'package:flutter_easyloading/flutter_easyloading.dart';
810
import 'package:flutter_signin_button/flutter_signin_button.dart';
911
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
1012

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

19-
class SignUp extends StatefulWidget {
21+
class SignUpView extends StatefulWidget {
2022
@override
21-
_SignUpState createState() => _SignUpState();
23+
_SignUpViewState createState() => _SignUpViewState();
2224
}
2325

24-
class _SignUpState extends State<SignUp> {
26+
class _SignUpViewState extends State<SignUpView> {
2527
final _formKey = GlobalKey<FormState>();
2628
int currentStep;
2729

@@ -97,6 +99,7 @@ class StepperBody extends StatefulWidget {
9799

98100
class _StepperBodyState extends State<StepperBody> {
99101
final CategoryController _categoryController = new CategoryController();
102+
final AccountController accountController = new AccountController();
100103

101104
static final _focusNode = FocusNode();
102105
static UserData user = UserData();
@@ -114,6 +117,12 @@ class _StepperBodyState extends State<StepperBody> {
114117
});
115118
}
116119

120+
@override
121+
void deactivate() {
122+
EasyLoading.dismiss();
123+
super.deactivate();
124+
}
125+
117126
List<Step> steps = [
118127
Step(
119128
title: Text('Nome', style: TextStyle(color: Color(0xFF525252))),
@@ -302,7 +311,15 @@ class _StepperBodyState extends State<StepperBody> {
302311
email: user.email,
303312
password: user.password,
304313
role: "cli");
305-
//send _user to [POST] api/Account/SignUp
314+
EasyLoading.show(status: "Carregando");
315+
accountController.signUp().then((value) {
316+
EasyLoading.dismiss();
317+
Globals.user = value;
318+
Database.insert(
319+
key: "user",
320+
value: jsonEncode(
321+
Globals.user.toJson()));
322+
});
306323

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

src/MobileApp/lib/globals.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import 'package:flutter/services.dart' show rootBundle;
1515
class Globals {
1616
static User user = new User();
1717
static bool isLoggedIn = false;
18-
static String urlAPI;
18+
static String urlAPI = 'https://reachup-poc.azurewebsites.net/api';
1919

2020
static List<Beacon> beacons = <Beacon>[];
2121
static List<CommuniqueSubCategory> communiqueSubCategories =

src/MobileApp/lib/main.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import 'package:get_storage/get_storage.dart';
99
import 'Component/Database/Database.db.dart';
1010
import 'Model/User.model.dart';
1111
import 'View/DebugView/Debug.view.dart';
12+
import 'package:ReachUp/View/SignView/Sign.view.dart';
1213
import 'View/HomeView/Home.view.dart';
1314
import 'View/_Layouts/HomeLayout.layout.dart';
1415
import 'View/splashscreen.view.dart';
@@ -100,7 +101,7 @@ class ReachUp extends StatelessWidget {
100101
title: 'ReachUp!',
101102
debugShowCheckedModeBanner: false,
102103
theme: lightTheme,
103-
home: DebugView(),
104+
home: SignView(),
104105
builder: (BuildContext context, Widget child) {
105106
/// make sure that loading can be displayed in front of all other widgets
106107
return FlutterEasyLoading(child: child);

0 commit comments

Comments
 (0)