Skip to content

Commit

Permalink
order items changed and ui fixed from user side
Browse files Browse the repository at this point in the history
  • Loading branch information
priyanshu-tiwari1502 committed Jun 20, 2020
1 parent 7bc9559 commit 700ff13
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 28 deletions.
3 changes: 2 additions & 1 deletion lib/models/order.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Order{
String user;
String vendor;
String id;
String paymentMethod;

Order({this.id, this.status, this.cart, this.totalCost, this.user, this.vendor});
Order({this.id, this.status, this.cart, this.totalCost, this.user, this.vendor,this.paymentMethod});
}
2 changes: 1 addition & 1 deletion lib/screens/home/cartAndMenu/item_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class _ItemTileState extends State<ItemTile> {
//backgroundImage: AssetImage('assets/coffee_icon.png'),
),
title: Text(widget.item.name),
subtitle: Text(' ${widget.item.id} '),
subtitle: Text('Cost: ₹${widget.item.id} '),

trailing: Counter(
initialValue: _defaultValue,
Expand Down
41 changes: 26 additions & 15 deletions lib/screens/home/orderHistory/order_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:readyuser/models/order.dart';
import 'package:readyuser/models/vendor.dart';
import 'package:readyuser/screens/home/orderHistory/ordered_item.dart';
import 'package:readyuser/screens/home/orderHistory/write_review.dart';
import 'package:readyuser/services/database.dart';
import 'package:readyuser/shared/constants.dart';
import 'package:readyuser/shared/loading.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -64,14 +65,28 @@ class OrderDetails extends StatelessWidget {
SizedBox(height: 10.0),
Expanded(child: Padding(
padding: const EdgeInsets.all(10.0),
child: Text(
"Total Order Value:\n ${userCartVal}",
style: TextStyle(
color: Colors.pink[400],
fontWeight: FontWeight.bold,
fontSize: 20,
),
textAlign: TextAlign.center,
child: Row(
children: <Widget>[
Text(
"Total Order Value:\n ${userCartVal}",
style: TextStyle(
color: Colors.pink[400],
fontWeight: FontWeight.bold,
fontSize: 20,
),
textAlign: TextAlign.center,
),
SizedBox(width: 20,),
Text(
"Payment Method:\n ${order.paymentMethod}",
style: TextStyle(
color: Colors.pink[400],
fontWeight: FontWeight.bold,
fontSize: 20,
),
textAlign: TextAlign.center,
),
],
),
)),
SizedBox(height:10.0),
Expand All @@ -82,9 +97,9 @@ class OrderDetails extends StatelessWidget {
style: TextStyle(color: Colors.white),
),
onPressed: (){
setState(){
recieved=true;
}
order.status = 'Completed';
DatabaseService(uid: userUid).updateOrderData(order);
DatabaseService(uid: userUid).updateOrderDataVendor(order);
},
),
SizedBox(height: 10),
Expand All @@ -95,11 +110,7 @@ class OrderDetails extends StatelessWidget {
style: TextStyle(color: Colors.white),
),
onPressed: () async {
print("yess");
//Navigator.pop(context);
Navigator.push(context, CupertinoPageRoute(builder: (context) => WriteReview(order: order)));
//Navigator.pop(context);
print("noo");
},
),
SizedBox(height: 20.0),
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/home/orderHistory/order_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class _OrderTileState extends State<OrderTile> {
//backgroundImage: AssetImage('assets/coffee_icon.png'),
),
title: Text(vendorData.name),
subtitle: Text('Amount: ${widget.order.totalCost} '),
subtitle: Text('Amount: ${widget.order.totalCost} '),
onTap: () async {Navigator.push(context, CupertinoPageRoute(builder: (context) => OrderDetails(order: widget.order, vendor: vendorData)));},
trailing: Text(' ${widget.order.status} '),

Expand Down
2 changes: 1 addition & 1 deletion lib/screens/home/orderHistory/ordered_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class OrderedItemTile extends StatelessWidget {
//backgroundImage: AssetImage('assets/coffee_icon.png'),
),
title: Text(item.name),
//subtitle: Text(' ${item.id} '),
subtitle: Text(' ${item.id} '),
trailing: Text(' ${item.quantity}'),
),
),
Expand Down
24 changes: 23 additions & 1 deletion lib/screens/landing.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import 'package:readyuser/services/auth.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:readyuser/shared/constants.dart';

class Landing extends StatelessWidget {
final AuthService _auth = AuthService();
Expand Down Expand Up @@ -32,7 +34,27 @@ class Landing extends StatelessWidget {
),
body: Container(
color: Colors.brown[100],
child: Text("Verify your mail ID and login again"),
width: MediaQuery
.of(context)
.size
.width,
child: Column(
children: <Widget>[
Text("Verify your mail ID and login again"),
SizedBox(height: 20.0,),
RaisedButton(
color: Colors.pink[400],
child: Text(
"Resend Mail",
style: TextStyle(color: Colors.white),
),
onPressed: () async {
firebaseUser = await FirebaseAuth.instance.currentUser();
firebaseUser.sendEmailVerification();
},
),
],
),
),
),
);
Expand Down
11 changes: 4 additions & 7 deletions lib/screens/payment/checkout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,12 @@ class _checkoutpageState extends State<checkoutpage> {
RaisedButton(
color: Colors.pink[400],
child: Text(
"Pay",
"Pay Using UPI",
style: TextStyle(color: Colors.white),
),
onPressed: () async {
print("yess");
Navigator.pop(context);
Navigator.push(context, CupertinoPageRoute(builder: (context) => PaymentPage()));
//Navigator.pop(context);
print("noo");
},
),
RaisedButton(
Expand All @@ -121,14 +118,14 @@ class _checkoutpageState extends State<checkoutpage> {
print("order");
DatabaseService(uid: userUid).addOrderData(order);
DatabaseService(uid: userUid).addOrderDataVendor(order);
showDialog(
context:context,
showDialog(
context:context,
child: new AlertDialog(
title: new Text('Success!'),
content: new Text('Order placed successfully'),
actions: <Widget>[
new FlatButton(
child: Text("Payed"),
child: Text("Have a nice day after you press me"),
onPressed: () async{
Navigator.of(context).pop();
Navigator.of(context).pop();
Expand Down
5 changes: 5 additions & 0 deletions lib/services/auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,16 @@ class AuthService {
try {
AuthResult result = await _auth.signInWithEmailAndPassword(email: email, password: password);
FirebaseUser user = result.user;
isVerified = false;
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setBool('isVerified', false);
if(user.isEmailVerified){
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setBool('isVerified', true);
isVerified = true;
}else{
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setBool('isVerified', false);
isVerified = false;
}
userUid = user.uid;
Expand Down
6 changes: 5 additions & 1 deletion lib/services/database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class DatabaseService {
'totalCost': order.totalCost,
'user': order.user,
'vendor': order.vendor,
'paymentMethod':order.paymentMethod,
});
}
Future<void> addOrderDataVendor(Order order) async {
Expand All @@ -133,6 +134,7 @@ class DatabaseService {
'totalCost': order.totalCost,
'user': order.user,
'vendor': order.vendor,
'paymentMethod':order.paymentMethod,
});
}

Expand All @@ -143,6 +145,7 @@ class DatabaseService {
'totalCost': order.totalCost,
'user': order.user,
'vendor': order.vendor,
'paymentMethod':order.paymentMethod,
});
}

Expand All @@ -153,6 +156,7 @@ class DatabaseService {
'totalCost': order.totalCost,
'user': order.user,
'vendor': order.vendor,
'paymentMethod':order.paymentMethod,
});
}

Expand Down Expand Up @@ -226,5 +230,5 @@ class DatabaseService {
.map(_orderListFromSnapshot);
}


}
1 change: 1 addition & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"

equatable:
dependency: transitive
description:
Expand Down

0 comments on commit 700ff13

Please sign in to comment.