Skip to content

Commit 0005c5e

Browse files
committed
Color refactoring
1 parent f3c74f2 commit 0005c5e

File tree

12 files changed

+65
-45
lines changed

12 files changed

+65
-45
lines changed

gogrocy/lib/ui/shared/colors.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import 'package:flutter/material.dart';
22

3-
final Color PRIMARY_COLOR=Color(0xff5FD900);
4-
final Color CATEGORY_LIST_BOX=Color.fromRGBO(196, 196, 196, 0.3);
3+
final Color primaryColor=Color(0xff5FD900);
4+
final Color categoryListBox=Color.fromRGBO(196, 196, 196, 0.3);
55

6-
final Color VIEW_ALL_BUTTON_TEXT=Color.fromRGBO(95, 210, 0, 1);
7-
final Color VIEW_ALL_BUTTON_BACKGROUND=Color.fromRGBO(95, 210, 0, 0.15);
6+
final Color viewAllButtonText=Color.fromRGBO(95, 210, 0, 1);
7+
final Color viewAllButtonBackground=Color.fromRGBO(95, 210, 0, 0.15);
88

9-
final Color CART_HEADER_COLOR=Color(0xff3F4250);
10-
final Color CART_BUTTON_BACKGROUND=Color.fromRGBO(255, 193, 72, 0.2);
11-
final Color CART_BUTTON_TEXT=Color(0xffEA9A00);
9+
final Color cartHeaderColor=Color(0xff3F4250);
10+
final Color cartButtonBackground=Color.fromRGBO(255, 193, 72, 0.2);
11+
final Color cartButtonText=Color(0xffEA9A00);
1212

13-
final Color CART_COUNTER_BACKGROUND=Color(0xffebebeb);
13+
final Color cartCounterBackground=Color(0xffebebeb);

gogrocy/lib/ui/views/cart/cart.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class CartHeader extends StatelessWidget {
8484
children: <Widget>[
8585
Container(
8686
width: 20.0,
87-
color: colors.CART_HEADER_COLOR,
87+
color: colors.cartHeaderColor,
8888
),
8989
Padding(
9090
padding: const EdgeInsets.only(left: 8.0),
@@ -93,9 +93,9 @@ class CartHeader extends StatelessWidget {
9393
mainAxisSize: MainAxisSize.min,
9494
children: <Widget>[
9595
Text("Your Cart",
96-
style: TextStyle(fontFamily: 'Gilroy',fontSize: 32.0,fontWeight: FontWeight.bold, color: colors.CART_HEADER_COLOR),),
96+
style: TextStyle(fontFamily: 'Gilroy',fontSize: 32.0,fontWeight: FontWeight.bold, color: colors.cartHeaderColor),),
9797
Text("Grand Total Rs"+model.sum.toString(),
98-
style: TextStyle(fontFamily: 'Gilroy',fontSize: 14.0,fontWeight: FontWeight.w600, color: colors.CART_HEADER_COLOR),),
98+
style: TextStyle(fontFamily: 'Gilroy',fontSize: 14.0,fontWeight: FontWeight.w600, color: colors.cartHeaderColor),),
9999

100100
],
101101
),
@@ -109,11 +109,11 @@ class CartHeader extends StatelessWidget {
109109
child: RawMaterialButton(
110110
elevation: 0.0,
111111
focusElevation: 1,
112-
focusColor: colors.CART_BUTTON_BACKGROUND,
112+
focusColor: colors.cartButtonBackground,
113113
onPressed: () {
114114
checkoutButtonPressed();
115115
},
116-
fillColor: colors.CART_BUTTON_BACKGROUND,
116+
fillColor: colors.cartButtonBackground,
117117
shape: RoundedRectangleBorder(
118118
borderRadius: BorderRadius.circular(3),
119119
),
@@ -124,7 +124,7 @@ class CartHeader extends StatelessWidget {
124124
child: Text(
125125
'Checkout Now',
126126
style: TextStyle(
127-
color: colors.CART_BUTTON_TEXT,
127+
color: colors.cartButtonText,
128128
fontSize: 13.0,
129129
fontWeight: FontWeight.bold),
130130
),

gogrocy/lib/ui/views/cart/cart_bill.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class CartBill extends StatelessWidget {
1515
child: ClipRRect(
1616
borderRadius: BorderRadius.all(Radius.circular(8)),
1717
child: Container(
18-
color: colors.CART_COUNTER_BACKGROUND,
18+
color: colors.cartCounterBackground,
1919
child: Padding(
2020
padding: const EdgeInsets.symmetric(horizontal: 22,vertical: 22,),
2121
child: Column(

gogrocy/lib/ui/views/cart/cart_footer.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class _CartFooterState extends State<CartFooter> {
110110
});
111111
},
112112
focusElevation: 0,
113-
focusColor: colors.VIEW_ALL_BUTTON_BACKGROUND,
113+
focusColor: colors.viewAllButtonBackground,
114114
fillColor: Colors.transparent,
115115
shape: RoundedRectangleBorder(
116116
borderRadius: BorderRadius.circular(3),
@@ -122,7 +122,7 @@ class _CartFooterState extends State<CartFooter> {
122122
child: Text(
123123
'Change',
124124
style: TextStyle(
125-
color: colors.PRIMARY_COLOR,
125+
color: colors.primaryColor,
126126
fontSize: 13.0,
127127
fontWeight: FontWeight.w500),
128128
),

gogrocy/lib/ui/views/cart/cart_header.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class CartHeader extends StatelessWidget {
3131
children: <Widget>[
3232
Container(
3333
width: 20.0,
34-
color: colors.CART_HEADER_COLOR,
34+
color: colors.cartHeaderColor,
3535
),
3636
Padding(
3737
padding: const EdgeInsets.only(left: 8.0),
@@ -40,9 +40,9 @@ class CartHeader extends StatelessWidget {
4040
mainAxisSize: MainAxisSize.min,
4141
children: <Widget>[
4242
Text("Your Cart",
43-
style: TextStyle(fontFamily: 'Gilroy',fontSize: 32.0,fontWeight: FontWeight.bold, color: colors.CART_HEADER_COLOR),),
43+
style: TextStyle(fontFamily: 'Gilroy',fontSize: 32.0,fontWeight: FontWeight.bold, color: colors.cartHeaderColor),),
4444
Text("Grand Total Rs"+model.sum.toString(),
45-
style: TextStyle(fontFamily: 'Gilroy',fontSize: 14.0,fontWeight: FontWeight.w600, color: colors.CART_HEADER_COLOR),),
45+
style: TextStyle(fontFamily: 'Gilroy',fontSize: 14.0,fontWeight: FontWeight.w600, color: colors.cartHeaderColor),),
4646

4747
],
4848
),
@@ -56,11 +56,11 @@ class CartHeader extends StatelessWidget {
5656
child: RawMaterialButton(
5757
elevation: 0.0,
5858
focusElevation: 1,
59-
focusColor: colors.CART_BUTTON_BACKGROUND,
59+
focusColor: colors.cartButtonBackground,
6060
onPressed: () {
6161
checkoutButtonPressed;
6262
},
63-
fillColor: colors.CART_BUTTON_BACKGROUND,
63+
fillColor: colors.cartButtonBackground,
6464
shape: RoundedRectangleBorder(
6565
borderRadius: BorderRadius.circular(3),
6666
),
@@ -71,7 +71,7 @@ class CartHeader extends StatelessWidget {
7171
child: Text(
7272
'Checkout Now',
7373
style: TextStyle(
74-
color: colors.CART_BUTTON_TEXT,
74+
color: colors.cartButtonText,
7575
fontSize: 13.0,
7676
fontWeight: FontWeight.bold),
7777
),

gogrocy/lib/ui/views/cart/cart_list.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class CartList extends StatelessWidget {
7373
style: TextStyle(
7474
fontWeight: FontWeight.w500,
7575
fontSize: 14.0,
76-
color: colors.PRIMARY_COLOR)),
76+
color: colors.primaryColor)),
7777
Padding(
7878
padding: const EdgeInsets.only(top: 20.0),
7979
child: CartCounter(
@@ -98,7 +98,7 @@ class CartList extends StatelessWidget {
9898
style: TextStyle(
9999
fontSize: 17.0,
100100
fontWeight: FontWeight.w500,
101-
color: colors.PRIMARY_COLOR),
101+
color: colors.primaryColor),
102102
textAlign: TextAlign.right,
103103
)),
104104
),

gogrocy/lib/ui/views/home/category_list.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class CategoryList extends StatelessWidget {
4040
child: Container(
4141
width: constants.HomePageConfig.categoryBoxWidth,
4242
height: constants.HomePageConfig.categoryBoxHeight,
43-
color: colors.CATEGORY_LIST_BOX,
43+
color: colors.categoryListBox,
4444
),
4545
),
4646
),

gogrocy/lib/ui/views/home/grid_list.dart

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class GridList extends StatelessWidget {
1616
Widget build(BuildContext context) {
1717
return BaseView<AllProductsModel>(
1818
onModelReady: (model) {
19-
model.getAllProducts();
19+
if (model.hasConnection) model.getAllProducts();
2020
},
2121
builder: (context, model, child) => GridView.builder(
2222
itemCount: 100,
@@ -27,11 +27,15 @@ class GridList extends StatelessWidget {
2727
itemBuilder: (context, index) {
2828
// ignore: missing_return
2929
if (model.state == ViewState.Busy)
30-
return SizedBox(width:20.0,height: 20.0,child: Center(child: CircularProgressIndicator()));
30+
return SizedBox(
31+
width: 20.0,
32+
height: 20.0,
33+
child: Center(child: CircularProgressIndicator()));
3134
else {
3235
return InkWell(
33-
onTap: (){
34-
_navigationService.navigateTo('product', arguments: model.allProducts[index]);
36+
onTap: () {
37+
_navigationService.navigateTo('product',
38+
arguments: model.allProducts[index]);
3539
},
3640
child: Padding(
3741
padding: const EdgeInsets.all(8.0),
@@ -44,7 +48,10 @@ class GridList extends StatelessWidget {
4448
Flexible(
4549
flex: 4,
4650
child: SizedBox(
47-
height: constants.HomePageConfig.productGridHeight*4/6,
51+
height:
52+
constants.HomePageConfig.productGridHeight *
53+
4 /
54+
6,
4855
child: Image(
4956
image: NetworkImage(
5057
'https://res.cloudinary.com/gogrocy/image/upload/v1/' +
@@ -62,7 +69,8 @@ class GridList extends StatelessWidget {
6269
Flexible(
6370
flex: 8,
6471
child: Padding(
65-
padding: const EdgeInsets.only(left: 4,top: 4,bottom: 4),
72+
padding: const EdgeInsets.only(
73+
left: 4, top: 4, bottom: 4),
6674
child: Text(
6775
model.allProducts[index].name,
6876
style: TextStyle(
@@ -73,7 +81,8 @@ class GridList extends StatelessWidget {
7381
)),
7482
Flexible(
7583
child: Padding(
76-
padding: const EdgeInsets.only(right: 4,top: 4,bottom: 4),
84+
padding: const EdgeInsets.only(
85+
right: 4, top: 4, bottom: 4),
7786
child: Text(
7887
'₹' + model.allProducts[index].price,
7988
style: TextStyle(

gogrocy/lib/ui/views/home/home.dart

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,22 @@ import 'package:gogrocy/ui/shared/constants.dart' as constants;
77
import 'package:gogrocy/ui/shared/colors.dart' as colors;
88

99

10-
class Home extends StatelessWidget {
10+
class Home extends StatefulWidget {
11+
@override
12+
_HomeState createState() => _HomeState();
13+
}
14+
15+
class _HomeState extends State<Home> with AutomaticKeepAliveClientMixin{
1116
final PageController controller = new PageController();
1217

18+
@override
19+
bool get wantKeepAlive => true;
20+
1321
@override
1422
Widget build(BuildContext context) {
23+
super.build(context);
1524
return Scaffold(
25+
backgroundColor: Colors.white,
1626
body: ListView(
1727
children: <Widget>[
1828
Carousel(controller),
@@ -55,7 +65,7 @@ class Home extends StatelessWidget {
5565
RawMaterialButton(
5666
elevation: 0.0,
5767
onPressed: () {},
58-
fillColor: colors.VIEW_ALL_BUTTON_BACKGROUND,
68+
fillColor: colors.viewAllButtonBackground,
5969
shape: RoundedRectangleBorder(
6070
borderRadius: BorderRadius.circular(3),
6171
),
@@ -66,7 +76,7 @@ class Home extends StatelessWidget {
6676
child: Text(
6777
'View All',
6878
style: TextStyle(
69-
color: colors.VIEW_ALL_BUTTON_TEXT,
79+
color: colors.viewAllButtonText,
7080
fontSize: 13.0,
7181
fontWeight: FontWeight.w500),
7282
),

gogrocy/lib/ui/views/profile.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class CartHeader extends StatelessWidget {
7272
children: <Widget>[
7373
Container(
7474
width: 20.0,
75-
color: colors.CART_HEADER_COLOR,
75+
color: colors.cartHeaderColor,
7676
),
7777
Padding(
7878
padding: const EdgeInsets.only(left: 8.0),
@@ -81,9 +81,9 @@ class CartHeader extends StatelessWidget {
8181
mainAxisSize: MainAxisSize.min,
8282
children: <Widget>[
8383
Text("Your Cart",
84-
style: TextStyle(fontFamily: 'Gilroy',fontSize: 32.0,fontWeight: FontWeight.bold, color: colors.CART_HEADER_COLOR),),
84+
style: TextStyle(fontFamily: 'Gilroy',fontSize: 32.0,fontWeight: FontWeight.bold, color: colors.cartHeaderColor),),
8585
Text("Grand Total Rs"+model.sum.toString(),
86-
style: TextStyle(fontFamily: 'Gilroy',fontSize: 14.0,fontWeight: FontWeight.w600, color: colors.CART_HEADER_COLOR),),
86+
style: TextStyle(fontFamily: 'Gilroy',fontSize: 14.0,fontWeight: FontWeight.w600, color: colors.cartHeaderColor),),
8787

8888
],
8989
),

gogrocy/lib/ui/widgets/cart_counter.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ class _CartCounterState extends State<CartCounter> {
4242
child: FlatButton(
4343
shape: new RoundedRectangleBorder(
4444
borderRadius: new BorderRadius.circular(3.0),
45-
side: BorderSide(color:colors.CART_COUNTER_BACKGROUND)),
46-
color: colors.CART_COUNTER_BACKGROUND,
45+
side: BorderSide(color:colors.cartCounterBackground)),
46+
color: colors.cartCounterBackground,
4747
textColor: Colors.black,
4848
padding: EdgeInsets.all(0.0),
4949
onPressed: () {
@@ -74,8 +74,8 @@ class _CartCounterState extends State<CartCounter> {
7474
child: FlatButton(
7575
shape: new RoundedRectangleBorder(
7676
borderRadius: new BorderRadius.circular(3.0),
77-
side: BorderSide(color:colors.CART_COUNTER_BACKGROUND)),
78-
color: colors.CART_COUNTER_BACKGROUND,
77+
side: BorderSide(color:colors.cartCounterBackground)),
78+
color: colors.cartCounterBackground,
7979
textColor: Colors.black,
8080
padding: EdgeInsets.all(2.0),
8181
onPressed: () {

gogrocy/lib/ui/widgets/login_text_field_widget.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
33
import 'package:flutter/services.dart';
44
import 'package:gogrocy/core/viewModels/login_model.dart';
55
import 'package:gogrocy/service_locator.dart';
6+
import 'package:gogrocy/ui/shared/colors.dart';
67
import 'package:gogrocy/ui/widgets/otp_field.dart';
78
import 'package:gogrocy/ui/widgets/snackbars.dart';
89
import 'package:gogrocy/ui/widgets/vertical_spaces.dart';
@@ -115,9 +116,9 @@ class _LoginTextFieldWidgetState extends State<LoginTextFieldWidget> {
115116
visible: phoneFocusNode.hasFocus,
116117
child: IconButton(
117118
icon: Icon(
118-
Icons.check_circle,
119+
Icons.check_circle_outline,
119120
color:
120-
model.hasConnection ? Colors.green : Colors.grey,
121+
model.hasConnection ? primaryColor : Colors.grey,
121122
size: 31.404 * constants.scaleRatio,
122123
),
123124
onPressed: () async {

0 commit comments

Comments
 (0)