Skip to content

Commit

Permalink
Route changes and Modified screens
Browse files Browse the repository at this point in the history
  • Loading branch information
ankan-ekansh committed Mar 22, 2020
1 parent 397e033 commit 88aaeac
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 76 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Along with labours, it would be a convenient method for contractors as well and
- Flask
- Flutter
- SQLite3
- Google Map API
- Sklearn

## Usage of App
Expand Down
2 changes: 0 additions & 2 deletions rozgaar/lib/Contractor/resultDisplay.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'dart:convert';

class ResultDisplay extends StatefulWidget {
var response;
Expand Down
1 change: 0 additions & 1 deletion rozgaar/lib/Labour/labour.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:rozgaar/Labour/labour_register.dart';
import 'package:rozgaar/Labour/labour_login.dart';

class Labour extends StatelessWidget {
@override
Expand Down
74 changes: 5 additions & 69 deletions rozgaar/lib/Labour/labour_login.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart';

class LabourLogin extends StatefulWidget {
@override
Expand All @@ -12,8 +10,6 @@ class _LabourLoginState extends State<LabourLogin> {

final formKey = GlobalKey<FormState>();

String _email, _password;

@override
Widget build(BuildContext context) {
return Scaffold(
Expand All @@ -24,72 +20,12 @@ class _LabourLoginState extends State<LabourLogin> {
body: Container(

padding: EdgeInsets.fromLTRB(10.0, 200.0, 10.0, 50.0),
child: Form(
key: formKey,
child: Column(
children: <Widget>[
TextFormField(
decoration: InputDecoration(
hintText: 'Enter your email containing @',
labelText: 'Email',
),
validator: (val){
return val.contains('@') ? null : 'Email must contain @';
},
onSaved: (val){
_email = val;
},
),
TextFormField(
decoration: InputDecoration(
labelText: 'Password',
hintText: 'Enter your password more than 6 characters',
),
validator: (val){
return val.length >= 6 ? null : 'Password must contain more than 6 characters';
},
obscureText: true,
onSaved: (val){
_password = val;
},
),
SizedBox(
height: 10.0,
),
RaisedButton(
textColor: Colors.white,
color: Colors.lightBlue,
padding: EdgeInsets.fromLTRB(9, 9, 9, 9),
splashColor: Colors.grey,
child: Text(
'Login',
),
onPressed: () async{
if(formKey.currentState.validate()){
formKey.currentState.save();
print('Logged in, Email is $_email ; Password is $_password');
Map data = {
'email' : _email,
'password' : _password
};
var jsonData = jsonEncode(data);
print(jsonData);
Response response = await post(
'http://httpbin.org/post',
body: jsonEncode(data),
);
print(response.body);
print(response.statusCode);
// Navigator.push(
// context,
// MaterialPageRoute(builder: (context) => LabourHome(response)),
// );
}
},
)
],
child: Text(
'You have successfully registered',
style: TextStyle(
fontSize: 30.0,
),
)
),

),
);
Expand Down
6 changes: 3 additions & 3 deletions rozgaar/lib/Labour/labour_register.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class _LabourRegisterState extends State<LabourRegister> {
'longitude': 0.0,
};
int _age;
String _contact_no;
String _contactNo;
String skill = "";

final _formKey = GlobalKey<FormState>();
Expand Down Expand Up @@ -96,7 +96,7 @@ class _LabourRegisterState extends State<LabourRegister> {
return null;
},
onSaved: (val) {
_contact_no = val;
_contactNo = val;
},
),
TextFormField(
Expand Down Expand Up @@ -187,7 +187,7 @@ class _LabourRegisterState extends State<LabourRegister> {
'gender': _gender,
'location': _location,
'skills': _skill,
'contact': _contact_no,
'contact': _contactNo,
};
var jsonData = jsonEncode(data);
Response response = await post(
Expand Down

0 comments on commit 88aaeac

Please sign in to comment.