-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6381bab
commit 696b354
Showing
19 changed files
with
512 additions
and
60 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
class cart_list { | ||
List<Cart> cart; | ||
int sum; | ||
|
||
cart_list({this.cart, this.sum}); | ||
|
||
factory cart_list.fromJson(Map<String, dynamic> json) { | ||
return cart_list( | ||
cart: json['cart'] != null ? (json['cart'] as List).map((i) => Cart.fromJson(i)).toList() : null, | ||
sum: json['sum'], | ||
); | ||
} | ||
|
||
Map<String, dynamic> toJson() { | ||
final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
data['sum'] = this.sum; | ||
if (this.cart != null) { | ||
data['cart'] = this.cart.map((v) => v.toJson()).toList(); | ||
} | ||
return data; | ||
} | ||
} | ||
class Cart { | ||
String cart_id; | ||
String category; | ||
String date; | ||
String description; | ||
String id; | ||
String image; | ||
String name; | ||
String price; | ||
String product_id; | ||
String quantity; | ||
String quantity_ordered; | ||
String unit; | ||
String user_id; | ||
|
||
Cart({this.cart_id, this.category, this.date, this.description, this.id, this.image, this.name, this.price, this.product_id, this.quantity, this.quantity_ordered, this.unit, this.user_id}); | ||
|
||
factory Cart.fromJson(Map<String, dynamic> json) { | ||
return Cart( | ||
cart_id: json['cart_id'], | ||
category: json['category'], | ||
date: json['date'], | ||
description: json['description'], | ||
id: json['id'], | ||
image: json['image'], | ||
name: json['name'], | ||
price: json['price'], | ||
product_id: json['product_id'], | ||
quantity: json['quantity'], | ||
quantity_ordered: json['quantity_ordered'], | ||
unit: json['unit'], | ||
user_id: json['user_id'], | ||
); | ||
} | ||
|
||
Map<String, dynamic> toJson() { | ||
final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
data['cart_id'] = this.cart_id; | ||
data['category'] = this.category; | ||
data['date'] = this.date; | ||
data['description'] = this.description; | ||
data['id'] = this.id; | ||
data['image'] = this.image; | ||
data['name'] = this.name; | ||
data['price'] = this.price; | ||
data['product_id'] = this.product_id; | ||
data['quantity'] = this.quantity; | ||
data['quantity_ordered'] = this.quantity_ordered; | ||
data['unit'] = this.unit; | ||
data['user_id'] = this.user_id; | ||
return data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import 'package:gogrocy/core/enums/viewstate.dart'; | ||
import 'package:gogrocy/core/models/cart_list.dart'; | ||
import 'package:gogrocy/core/services/api.dart'; | ||
import 'package:gogrocy/core/viewModels/base_model.dart'; | ||
import 'package:gogrocy/service_locator.dart'; | ||
|
||
class CartViewModel extends BaseModel{ | ||
Apis _apis=locator<Apis>(); | ||
|
||
cart_list cartList; | ||
|
||
Future getCartList() async{ | ||
setState(ViewState.Busy); | ||
cartList=await _apis.getCartList(); | ||
setState(ViewState.Idle); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
final Color PRIMARY_COLOR=Color(0xff5FD900); | ||
final Color CATEGORY_LIST_BOX=Color.fromRGBO(196, 196, 196, 0.3); | ||
|
||
final Color VIEW_ALL_BUTTON_TEXT=Color.fromRGBO(95, 210, 0, 1); | ||
final Color VIEW_ALL_BUTTON_BACKGROUND=Color.fromRGBO(95, 210, 0, 0.15); | ||
|
||
final Color CART_HEADER_COLOR=Color(0xff3F4250); | ||
final Color CART_BUTTON_BACKGROUND=Color.fromRGBO(255, 193, 72, 0.2); | ||
final Color CART_BUTTON_TEXT=Color(0xffEA9A00); | ||
|
||
final Color CART_COUNTER_BACKGROUND=Color(0xffebebeb); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:gogrocy/ui/views/cart/cart_header.dart'; | ||
import 'package:gogrocy/ui/views/cart/cart_list.dart'; | ||
|
||
class Cart extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: ListView( | ||
children: <Widget>[ | ||
CartHeader(), | ||
CartList() | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:gogrocy/ui/shared/colors.dart' as colors; | ||
import 'package:gogrocy/ui/shared/constants.dart' as constants; | ||
|
||
class CartHeader extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Stack( | ||
children: <Widget>[ | ||
Image(image: AssetImage('assets/images/cart_background.png')), | ||
Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: <Widget>[ | ||
IntrinsicHeight( | ||
child: Padding( | ||
padding: const EdgeInsets.only(top: 8.0), | ||
child: Row( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: <Widget>[ | ||
Container( | ||
width: 20.0, | ||
color: colors.CART_HEADER_COLOR, | ||
), | ||
Padding( | ||
padding: const EdgeInsets.only(left: 8.0), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
mainAxisSize: MainAxisSize.min, | ||
children: <Widget>[ | ||
Text("Your Cart", | ||
style: TextStyle(fontFamily: 'Gilroy',fontSize: 32.0,fontWeight: FontWeight.bold, color: colors.CART_HEADER_COLOR),), | ||
Text("Grand Total", | ||
style: TextStyle(fontFamily: 'Gilroy',fontSize: 14.0,fontWeight: FontWeight.w600, color: colors.CART_HEADER_COLOR),), | ||
|
||
], | ||
), | ||
) | ||
], | ||
), | ||
), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.only(left: 28.0,top: 12), | ||
child: RawMaterialButton( | ||
elevation: 0.0, | ||
onPressed: () {}, | ||
fillColor: colors.CART_BUTTON_BACKGROUND, | ||
shape: RoundedRectangleBorder( | ||
borderRadius: BorderRadius.circular(3), | ||
), | ||
child: SizedBox( | ||
width: constants.CartConfig.checkoutButtonWidth, | ||
height: constants.CartConfig.checkoutButtonHeight, | ||
child: Center( | ||
child: Text( | ||
'Checkout Now', | ||
style: TextStyle( | ||
color: colors.CART_BUTTON_TEXT, | ||
fontSize: 13.0, | ||
fontWeight: FontWeight.bold), | ||
), | ||
), | ||
), | ||
), | ||
) | ||
], | ||
) | ||
], | ||
); | ||
} | ||
} |
Oops, something went wrong.