Skip to content

Commit

Permalink
Color refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Thesmader committed Apr 28, 2020
1 parent f3c74f2 commit 0005c5e
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 45 deletions.
16 changes: 8 additions & 8 deletions gogrocy/lib/ui/shared/colors.dart
Original file line number Diff line number Diff line change
@@ -1,13 +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 primaryColor=Color(0xff5FD900);
final Color categoryListBox=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 viewAllButtonText=Color.fromRGBO(95, 210, 0, 1);
final Color viewAllButtonBackground=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 cartHeaderColor=Color(0xff3F4250);
final Color cartButtonBackground=Color.fromRGBO(255, 193, 72, 0.2);
final Color cartButtonText=Color(0xffEA9A00);

final Color CART_COUNTER_BACKGROUND=Color(0xffebebeb);
final Color cartCounterBackground=Color(0xffebebeb);
12 changes: 6 additions & 6 deletions gogrocy/lib/ui/views/cart/cart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class CartHeader extends StatelessWidget {
children: <Widget>[
Container(
width: 20.0,
color: colors.CART_HEADER_COLOR,
color: colors.cartHeaderColor,
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
Expand All @@ -93,9 +93,9 @@ class CartHeader extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text("Your Cart",
style: TextStyle(fontFamily: 'Gilroy',fontSize: 32.0,fontWeight: FontWeight.bold, color: colors.CART_HEADER_COLOR),),
style: TextStyle(fontFamily: 'Gilroy',fontSize: 32.0,fontWeight: FontWeight.bold, color: colors.cartHeaderColor),),
Text("Grand Total Rs"+model.sum.toString(),
style: TextStyle(fontFamily: 'Gilroy',fontSize: 14.0,fontWeight: FontWeight.w600, color: colors.CART_HEADER_COLOR),),
style: TextStyle(fontFamily: 'Gilroy',fontSize: 14.0,fontWeight: FontWeight.w600, color: colors.cartHeaderColor),),

],
),
Expand All @@ -109,11 +109,11 @@ class CartHeader extends StatelessWidget {
child: RawMaterialButton(
elevation: 0.0,
focusElevation: 1,
focusColor: colors.CART_BUTTON_BACKGROUND,
focusColor: colors.cartButtonBackground,
onPressed: () {
checkoutButtonPressed();
},
fillColor: colors.CART_BUTTON_BACKGROUND,
fillColor: colors.cartButtonBackground,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(3),
),
Expand All @@ -124,7 +124,7 @@ class CartHeader extends StatelessWidget {
child: Text(
'Checkout Now',
style: TextStyle(
color: colors.CART_BUTTON_TEXT,
color: colors.cartButtonText,
fontSize: 13.0,
fontWeight: FontWeight.bold),
),
Expand Down
2 changes: 1 addition & 1 deletion gogrocy/lib/ui/views/cart/cart_bill.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class CartBill extends StatelessWidget {
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(8)),
child: Container(
color: colors.CART_COUNTER_BACKGROUND,
color: colors.cartCounterBackground,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 22,vertical: 22,),
child: Column(
Expand Down
4 changes: 2 additions & 2 deletions gogrocy/lib/ui/views/cart/cart_footer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class _CartFooterState extends State<CartFooter> {
});
},
focusElevation: 0,
focusColor: colors.VIEW_ALL_BUTTON_BACKGROUND,
focusColor: colors.viewAllButtonBackground,
fillColor: Colors.transparent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(3),
Expand All @@ -122,7 +122,7 @@ class _CartFooterState extends State<CartFooter> {
child: Text(
'Change',
style: TextStyle(
color: colors.PRIMARY_COLOR,
color: colors.primaryColor,
fontSize: 13.0,
fontWeight: FontWeight.w500),
),
Expand Down
12 changes: 6 additions & 6 deletions gogrocy/lib/ui/views/cart/cart_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CartHeader extends StatelessWidget {
children: <Widget>[
Container(
width: 20.0,
color: colors.CART_HEADER_COLOR,
color: colors.cartHeaderColor,
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
Expand All @@ -40,9 +40,9 @@ class CartHeader extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text("Your Cart",
style: TextStyle(fontFamily: 'Gilroy',fontSize: 32.0,fontWeight: FontWeight.bold, color: colors.CART_HEADER_COLOR),),
style: TextStyle(fontFamily: 'Gilroy',fontSize: 32.0,fontWeight: FontWeight.bold, color: colors.cartHeaderColor),),
Text("Grand Total Rs"+model.sum.toString(),
style: TextStyle(fontFamily: 'Gilroy',fontSize: 14.0,fontWeight: FontWeight.w600, color: colors.CART_HEADER_COLOR),),
style: TextStyle(fontFamily: 'Gilroy',fontSize: 14.0,fontWeight: FontWeight.w600, color: colors.cartHeaderColor),),

],
),
Expand All @@ -56,11 +56,11 @@ class CartHeader extends StatelessWidget {
child: RawMaterialButton(
elevation: 0.0,
focusElevation: 1,
focusColor: colors.CART_BUTTON_BACKGROUND,
focusColor: colors.cartButtonBackground,
onPressed: () {
checkoutButtonPressed;
},
fillColor: colors.CART_BUTTON_BACKGROUND,
fillColor: colors.cartButtonBackground,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(3),
),
Expand All @@ -71,7 +71,7 @@ class CartHeader extends StatelessWidget {
child: Text(
'Checkout Now',
style: TextStyle(
color: colors.CART_BUTTON_TEXT,
color: colors.cartButtonText,
fontSize: 13.0,
fontWeight: FontWeight.bold),
),
Expand Down
4 changes: 2 additions & 2 deletions gogrocy/lib/ui/views/cart/cart_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class CartList extends StatelessWidget {
style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: 14.0,
color: colors.PRIMARY_COLOR)),
color: colors.primaryColor)),
Padding(
padding: const EdgeInsets.only(top: 20.0),
child: CartCounter(
Expand All @@ -98,7 +98,7 @@ class CartList extends StatelessWidget {
style: TextStyle(
fontSize: 17.0,
fontWeight: FontWeight.w500,
color: colors.PRIMARY_COLOR),
color: colors.primaryColor),
textAlign: TextAlign.right,
)),
),
Expand Down
2 changes: 1 addition & 1 deletion gogrocy/lib/ui/views/home/category_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CategoryList extends StatelessWidget {
child: Container(
width: constants.HomePageConfig.categoryBoxWidth,
height: constants.HomePageConfig.categoryBoxHeight,
color: colors.CATEGORY_LIST_BOX,
color: colors.categoryListBox,
),
),
),
Expand Down
23 changes: 16 additions & 7 deletions gogrocy/lib/ui/views/home/grid_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class GridList extends StatelessWidget {
Widget build(BuildContext context) {
return BaseView<AllProductsModel>(
onModelReady: (model) {
model.getAllProducts();
if (model.hasConnection) model.getAllProducts();
},
builder: (context, model, child) => GridView.builder(
itemCount: 100,
Expand All @@ -27,11 +27,15 @@ class GridList extends StatelessWidget {
itemBuilder: (context, index) {
// ignore: missing_return
if (model.state == ViewState.Busy)
return SizedBox(width:20.0,height: 20.0,child: Center(child: CircularProgressIndicator()));
return SizedBox(
width: 20.0,
height: 20.0,
child: Center(child: CircularProgressIndicator()));
else {
return InkWell(
onTap: (){
_navigationService.navigateTo('product', arguments: model.allProducts[index]);
onTap: () {
_navigationService.navigateTo('product',
arguments: model.allProducts[index]);
},
child: Padding(
padding: const EdgeInsets.all(8.0),
Expand All @@ -44,7 +48,10 @@ class GridList extends StatelessWidget {
Flexible(
flex: 4,
child: SizedBox(
height: constants.HomePageConfig.productGridHeight*4/6,
height:
constants.HomePageConfig.productGridHeight *
4 /
6,
child: Image(
image: NetworkImage(
'https://res.cloudinary.com/gogrocy/image/upload/v1/' +
Expand All @@ -62,7 +69,8 @@ class GridList extends StatelessWidget {
Flexible(
flex: 8,
child: Padding(
padding: const EdgeInsets.only(left: 4,top: 4,bottom: 4),
padding: const EdgeInsets.only(
left: 4, top: 4, bottom: 4),
child: Text(
model.allProducts[index].name,
style: TextStyle(
Expand All @@ -73,7 +81,8 @@ class GridList extends StatelessWidget {
)),
Flexible(
child: Padding(
padding: const EdgeInsets.only(right: 4,top: 4,bottom: 4),
padding: const EdgeInsets.only(
right: 4, top: 4, bottom: 4),
child: Text(
'₹' + model.allProducts[index].price,
style: TextStyle(
Expand Down
16 changes: 13 additions & 3 deletions gogrocy/lib/ui/views/home/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,22 @@ import 'package:gogrocy/ui/shared/constants.dart' as constants;
import 'package:gogrocy/ui/shared/colors.dart' as colors;


class Home extends StatelessWidget {
class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> with AutomaticKeepAliveClientMixin{
final PageController controller = new PageController();

@override
bool get wantKeepAlive => true;

@override
Widget build(BuildContext context) {
super.build(context);
return Scaffold(
backgroundColor: Colors.white,
body: ListView(
children: <Widget>[
Carousel(controller),
Expand Down Expand Up @@ -55,7 +65,7 @@ class Home extends StatelessWidget {
RawMaterialButton(
elevation: 0.0,
onPressed: () {},
fillColor: colors.VIEW_ALL_BUTTON_BACKGROUND,
fillColor: colors.viewAllButtonBackground,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(3),
),
Expand All @@ -66,7 +76,7 @@ class Home extends StatelessWidget {
child: Text(
'View All',
style: TextStyle(
color: colors.VIEW_ALL_BUTTON_TEXT,
color: colors.viewAllButtonText,
fontSize: 13.0,
fontWeight: FontWeight.w500),
),
Expand Down
6 changes: 3 additions & 3 deletions gogrocy/lib/ui/views/profile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class CartHeader extends StatelessWidget {
children: <Widget>[
Container(
width: 20.0,
color: colors.CART_HEADER_COLOR,
color: colors.cartHeaderColor,
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
Expand All @@ -81,9 +81,9 @@ class CartHeader extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text("Your Cart",
style: TextStyle(fontFamily: 'Gilroy',fontSize: 32.0,fontWeight: FontWeight.bold, color: colors.CART_HEADER_COLOR),),
style: TextStyle(fontFamily: 'Gilroy',fontSize: 32.0,fontWeight: FontWeight.bold, color: colors.cartHeaderColor),),
Text("Grand Total Rs"+model.sum.toString(),
style: TextStyle(fontFamily: 'Gilroy',fontSize: 14.0,fontWeight: FontWeight.w600, color: colors.CART_HEADER_COLOR),),
style: TextStyle(fontFamily: 'Gilroy',fontSize: 14.0,fontWeight: FontWeight.w600, color: colors.cartHeaderColor),),

],
),
Expand Down
8 changes: 4 additions & 4 deletions gogrocy/lib/ui/widgets/cart_counter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class _CartCounterState extends State<CartCounter> {
child: FlatButton(
shape: new RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(3.0),
side: BorderSide(color:colors.CART_COUNTER_BACKGROUND)),
color: colors.CART_COUNTER_BACKGROUND,
side: BorderSide(color:colors.cartCounterBackground)),
color: colors.cartCounterBackground,
textColor: Colors.black,
padding: EdgeInsets.all(0.0),
onPressed: () {
Expand Down Expand Up @@ -74,8 +74,8 @@ class _CartCounterState extends State<CartCounter> {
child: FlatButton(
shape: new RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(3.0),
side: BorderSide(color:colors.CART_COUNTER_BACKGROUND)),
color: colors.CART_COUNTER_BACKGROUND,
side: BorderSide(color:colors.cartCounterBackground)),
color: colors.cartCounterBackground,
textColor: Colors.black,
padding: EdgeInsets.all(2.0),
onPressed: () {
Expand Down
5 changes: 3 additions & 2 deletions gogrocy/lib/ui/widgets/login_text_field_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:gogrocy/core/viewModels/login_model.dart';
import 'package:gogrocy/service_locator.dart';
import 'package:gogrocy/ui/shared/colors.dart';
import 'package:gogrocy/ui/widgets/otp_field.dart';
import 'package:gogrocy/ui/widgets/snackbars.dart';
import 'package:gogrocy/ui/widgets/vertical_spaces.dart';
Expand Down Expand Up @@ -115,9 +116,9 @@ class _LoginTextFieldWidgetState extends State<LoginTextFieldWidget> {
visible: phoneFocusNode.hasFocus,
child: IconButton(
icon: Icon(
Icons.check_circle,
Icons.check_circle_outline,
color:
model.hasConnection ? Colors.green : Colors.grey,
model.hasConnection ? primaryColor : Colors.grey,
size: 31.404 * constants.scaleRatio,
),
onPressed: () async {
Expand Down

0 comments on commit 0005c5e

Please sign in to comment.