Skip to content

Commit

Permalink
added final display page
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyashladdha committed Mar 22, 2020
1 parent eaf55bb commit 055fada
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 192 deletions.
5 changes: 5 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ def get_details_from_database():

jsondata = json.dumps(jsondata)
print(jsondata)
json_data={
'prediction':{

}
}
return jsondata


Expand Down
9 changes: 2 additions & 7 deletions rozgaar/lib/Contractor/Contractor_register.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import 'package:http/http.dart';

class ContractorRegistration extends StatefulWidget {
@override
_ContractorRegistrationState createState() =>
_ContractorRegistrationState();
_ContractorRegistrationState createState() => _ContractorRegistrationState();
}

class _ContractorRegistrationState extends State<ContractorRegistration> {
Expand Down Expand Up @@ -56,21 +55,17 @@ class _ContractorRegistrationState extends State<ContractorRegistration> {
_phone = val;
},
),

SizedBox(
height: 10.0,
),

RaisedButton(
textColor: Colors.white,
color: Colors.lightBlue,
padding: EdgeInsets.fromLTRB(9, 9, 9, 9),
splashColor: Colors.grey,
child: Text(
'Submit',
style: TextStyle(
fontSize: 18.0
),
style: TextStyle(fontSize: 18.0),
),
onPressed: () async {
if (_formKey.currentState.validate()) {
Expand Down
8 changes: 2 additions & 6 deletions rozgaar/lib/Contractor/contractor_login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ class _ContractorLoginState extends State<ContractorLogin> {
splashColor: Colors.grey,
child: Text(
'Login',
style: TextStyle(
fontSize: 18.0
),
style: TextStyle(fontSize: 18.0),
),
onPressed: () async {
formKey.currentState.save();
Expand Down Expand Up @@ -99,9 +97,7 @@ class _ContractorLoginState extends State<ContractorLogin> {
splashColor: Colors.grey,
child: Text(
'Register',
style: TextStyle(
fontSize: 18.0
),
style: TextStyle(fontSize: 18.0),
),
onPressed: () {
Navigator.push(
Expand Down
52 changes: 26 additions & 26 deletions rozgaar/lib/Contractor/contractor_reqirenments.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class _ContractorRequirenmentState extends State<ContractorRequirenment> {
appBar: new AppBar(
title: Text("Requirements"),
),
resizeToAvoidBottomPadding: false,
body: Container(
padding: EdgeInsets.all(10.0),
child: Form(
Expand All @@ -68,28 +69,6 @@ class _ContractorRequirenmentState extends State<ContractorRequirenment> {
_numberOfLabours = val;
},
),
TextFormField(
decoration: InputDecoration(
border: UnderlineInputBorder(),
filled: true,
hintText: "INR",
labelText: "Wage per day",
),
onSaved: (val) {
_wage = val;
},
),
TextFormField(
decoration: InputDecoration(
border: UnderlineInputBorder(),
filled: true,
hintText: "Hours",
labelText: "Work hours required",
),
onSaved: (val) {
_workHours = val;
},
),
ListTile(
title: Text('Skill required:'),
trailing: DropdownButton(
Expand All @@ -103,7 +82,6 @@ class _ContractorRequirenmentState extends State<ContractorRequirenment> {
items: _dropDownMenuItems,
),
),
SizedBox(height: 15,),
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Expand All @@ -121,7 +99,7 @@ class _ContractorRequirenmentState extends State<ContractorRequirenment> {
child: Text(
'Get location',
),
onPressed: (){
onPressed: () {
FetchLocation().returnLocation().then((result) {
print(result);
setState(() {
Expand All @@ -138,7 +116,28 @@ class _ContractorRequirenmentState extends State<ContractorRequirenment> {
SizedBox(
height: 10.0,
),

TextFormField(
decoration: InputDecoration(
border: UnderlineInputBorder(),
filled: true,
hintText: "INR",
labelText: "Wage per day",
),
onSaved: (val) {
_wage = val;
},
),
TextFormField(
decoration: InputDecoration(
border: UnderlineInputBorder(),
filled: true,
hintText: "Hours",
labelText: "Work hours required",
),
onSaved: (val) {
_workHours = val;
},
),
RaisedButton(
textColor: Colors.white,
color: Colors.lightBlue,
Expand Down Expand Up @@ -171,7 +170,8 @@ class _ContractorRequirenmentState extends State<ContractorRequirenment> {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ResultDisplay(response)));
builder: (context) =>
ResultDisplay(json.decode(response.body))));
})
],
))),
Expand Down
78 changes: 45 additions & 33 deletions rozgaar/lib/Contractor/resultDisplay.dart
Original file line number Diff line number Diff line change
@@ -1,52 +1,64 @@
import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'dart:convert';

class ResultDisplay extends StatefulWidget {
var response;
ResultDisplay(this.response);
@override
_ResultDisplayState createState() => _ResultDisplayState();
_ResultDisplayState createState() => _ResultDisplayState(this.response);
}

class _ResultDisplayState extends State<ResultDisplay> {
var response;
resultDisplay(var x) {
this.response = x;
}
_ResultDisplayState(this.response);

// var notesJson = json.decode(response);

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Best results for your search!"),
),
body: ListView.builder(
itemBuilder: (context, index) {
return Card(
child: Padding(
padding: const EdgeInsets.only(top: 32.0, bottom: 32.0, left: 16.0, right: 16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
response[index].title,
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold
appBar: AppBar(
title: Text("responses"),
),
body: ListView.builder(
itemBuilder: (context, index) {
return Card(
child: Padding(
padding: const EdgeInsets.only(
top: 32.0, bottom: 32.0, left: 16.0, right: 16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
response[index]["name"].toString(),
style:
TextStyle(fontSize: 22, fontWeight: FontWeight.bold),
),
Text(
"age: " + response[index]["age"].toString(),
style: TextStyle(color: Colors.grey.shade600),
),
Text(
"gender: " + response[index]["gender"].toString(),
style: TextStyle(color: Colors.grey.shade600),
),
Text(
"distance: " +
response[index]["distance"].toString() +
" km",
style: TextStyle(color: Colors.grey.shade600),
),
),
Text(
response[index].text,
style: TextStyle(
color: Colors.grey.shade600
Text(
"contact no. " + response[index]["contact"].toString(),
style: TextStyle(color: Colors.grey.shade600),
),
),
],
],
),
),
),
);
},
itemCount: response.length,
)
);
);
},
itemCount: response.length,
));
}
}
58 changes: 32 additions & 26 deletions rozgaar/lib/Labour/labour.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Labour extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
child: Scaffold(
child: Scaffold(
appBar: new AppBar(
title: Text("Home"),
actions: <Widget>[
Expand All @@ -15,33 +15,39 @@ class Labour extends StatelessWidget {
),
body: new Container(
child: new Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
ButtonBar(
alignment: MainAxisAlignment.spaceAround,

children: <Widget>[
RaisedButton(
textColor: Colors.white,
color: Colors.lightBlue,
padding: EdgeInsets.fromLTRB(9, 9, 9, 9),
splashColor: Colors.grey,
child: Text(
'Register',
style: TextStyle(
fontSize: 18.0,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Card(
color: Color.fromARGB(250, 35, 63, 126),
margin: EdgeInsets.all(20.0),
elevation: 0.0,
child: Container(
height: 100.0,
child: InkWell(
splashColor: Colors.black45,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => LabourRegister()),
);
},
child: Row(
children: <Widget>[
Expanded(
child: Text(
'Register',
style: TextStyle(fontSize: 40, color: Colors.white),
textAlign: TextAlign.center,
),
),
),
onPressed: () {
Navigator.push(
context, MaterialPageRoute(builder: (context) => LabourRegister()));
},
],
),
],
),
),
]),
),
],
),
),
)
);
));
}
}
}
Loading

0 comments on commit 055fada

Please sign in to comment.