Skip to content

Commit

Permalink
Merge pull request #108 from Onestop-Agrotech/0.5.3
Browse files Browse the repository at this point in the history
0.5.3
  • Loading branch information
Rahul-Vijay authored Nov 6, 2020
2 parents 551b531 + ff35436 commit 22f68fb
Show file tree
Hide file tree
Showing 20 changed files with 526 additions and 217 deletions.
21 changes: 21 additions & 0 deletions lib/models/category.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:flutter/material.dart';
import 'package:mvp/constants/themeColours.dart';

class Category {
final String name;
final String categoryName;
Color backgroundColor;
Color textColor;
final bool hasData;
final String imgURL;

Category(
{@required this.name,
@required this.categoryName,
this.backgroundColor = Colors.white,
this.textColor,
@required this.hasData,
@required this.imgURL}) {
this.textColor = ThemeColoursSeva().pallete1;
}
}
14 changes: 14 additions & 0 deletions lib/models/featured.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import 'package:flutter/material.dart';

class Featured {
final String name;
final String imgURL;
final bool clickable;
final String screen;

Featured(
{@required this.name,
@required this.imgURL,
@required this.clickable,
this.screen});
}
5 changes: 3 additions & 2 deletions lib/screens/auth/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import 'package:mvp/constants/themeColours.dart';
import 'package:mvp/graphics/greenAuth.dart';
import 'package:http/http.dart' as http;
import 'package:mvp/screens/auth/register.dart';
import 'package:mvp/screens/common/progressIndicator.dart';
import 'package:mvp/screens/errors/errorfile.dart';
import 'package:mvp/screens/errors/notServing.dart';
import 'package:mvp/screens/location.dart';
Expand Down Expand Up @@ -124,7 +125,7 @@ class _LoginScreenState extends State<LoginScreen> {
if (_otpLoader)
return Padding(
padding: const EdgeInsets.only(top: 8.0),
child: CircularProgressIndicator(),
child: CommonGreenIndicator(),
);
else
return Container();
Expand All @@ -133,7 +134,7 @@ class _LoginScreenState extends State<LoginScreen> {
// basic loader
_showLoader() {
if (_loading) {
return CircularProgressIndicator();
return CommonGreenIndicator();
} else
return showOTPField
? Padding(
Expand Down
3 changes: 2 additions & 1 deletion lib/screens/auth/register.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import 'package:mvp/graphics/greenAuth.dart';
import 'package:mvp/models/users.dart';
import 'package:mvp/screens/auth/login.dart';
import 'package:mvp/screens/common/inputTextField.dart';
import 'package:mvp/screens/common/progressIndicator.dart';
import 'package:mvp/screens/common/topText.dart';
import 'package:mvp/screens/errors/errorfile.dart';
import 'package:mvp/screens/location.dart';
Expand Down Expand Up @@ -55,7 +56,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
if (_loading == true) {
return Container(
child: Center(
child: CircularProgressIndicator(),
child: CommonGreenIndicator(),
),
);
} else {
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/common/common_functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class HelperFunctions {
style: TextStyle(
color: ThemeColoursSeva().dkGreen,
fontWeight: FontWeight.w900,
fontSize: 2.3 * SizeConfig.textMultiplier),
fontSize: 1.9 * SizeConfig.textMultiplier),
),
GestureDetector(
onTap: () {
Expand Down
13 changes: 10 additions & 3 deletions lib/screens/common/customappBar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import 'package:mvp/classes/prefrenses.dart';
import 'package:mvp/constants/apiCalls.dart';
import 'package:mvp/constants/themeColours.dart';
import 'package:mvp/screens/common/cartIcon.dart';
import 'package:mvp/screens/common/progressIndicator.dart';
import 'package:mvp/screens/location.dart';
import 'package:mvp/sizeconfig/sizeconfig.dart';

Expand All @@ -25,7 +26,7 @@ class CustomAppBar extends PreferredSize {
final double height;
final String email;
CustomAppBar(
{@required this.scaffoldKey, this.height = kToolbarHeight, this.email});
{@required this.scaffoldKey, this.height = kToolbarHeight, @required this.email});

@override
Size get preferredSize => Size.fromHeight(height);
Expand Down Expand Up @@ -71,7 +72,13 @@ class CustomAppBar extends PreferredSize {
);
});
} else
return Container(child: Text("Loading Address ..."));
return Container(
height: 120.0,
width: 100.0,
child: Center(
child: CommonGreenIndicator(),
),
);
}),
actions: <Widget>[
FutureBuilder(
Expand Down Expand Up @@ -124,7 +131,7 @@ class CustomAppBar extends PreferredSize {
@override
Widget build(BuildContext context) {
return Container(
color: ThemeColoursSeva().pallete3,
color: ThemeColoursSeva().pallete4,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expand Down
12 changes: 12 additions & 0 deletions lib/screens/common/progressIndicator.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:flutter/material.dart';
import 'package:mvp/constants/themeColours.dart';

class CommonGreenIndicator extends StatelessWidget {
@override
Widget build(BuildContext context) {
return CircularProgressIndicator(
backgroundColor: ThemeColoursSeva().pallete1,
valueColor: AlwaysStoppedAnimation<Color>(ThemeColoursSeva().vlgColor),
);
}
}
2 changes: 1 addition & 1 deletion lib/screens/common/sidenavbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ class Sidenav extends StatelessWidget {
padding: const EdgeInsets.only(bottom: 8.0),
child: ListTile(
title: Text('App version - Beta'),
subtitle: Text("0.5.2+3"),
subtitle: Text("0.5.3"),
onTap: null,
),
),
Expand Down
24 changes: 8 additions & 16 deletions lib/screens/landing/common/featuredCards.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,26 @@
// Version-0.4.8
// Date-{02-09-2020}

import 'package:cached_network_image/cached_network_image.dart';

///
/// @fileoverview FeaturedCards Widget: Reusable and Customizable Cards.
///
import 'package:flutter/material.dart';
import 'package:mvp/constants/themeColours.dart';
import 'package:mvp/models/featured.dart';
import 'package:mvp/screens/common/sidenavbar.dart';
import 'package:mvp/sizeconfig/sizeconfig.dart';

typedef ShowDialog = void Function();

class FeaturedCards extends StatelessWidget {
final String textToDisplay;
final Featured featuredItem;
final int index;
final String referralCode;
// final ShowDialog showInstructions;
FeaturedCards({this.textToDisplay, this.index, this.referralCode});
FeaturedCards(
{@required this.featuredItem, @required this.index, this.referralCode});

// referral dialog
showInstructions(context) {
Expand All @@ -33,27 +36,16 @@ class FeaturedCards extends StatelessWidget {
double width = MediaQuery.of(context).size.width;
return GestureDetector(
onTap: () {
if (index == 1) showInstructions(context);
if (index == 2) showInstructions(context);
},
child: Container(
// fallback height
height: 20 * SizeConfig.heightMultiplier,
width: width * 0.7,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.0),
color: ThemeColoursSeva().pallete1,
),
child: Padding(
padding: const EdgeInsets.only(top: 20.0, left: 20.0, right: 10.0),
child: Text(
textToDisplay,
style: TextStyle(
color: Colors.white,
fontSize: 2.4 * SizeConfig.textMultiplier,
fontWeight: FontWeight.w500),
overflow: TextOverflow.clip,
),
),
child: CachedNetworkImage(imageUrl: this.featuredItem.imgURL),
),
);
}
Expand Down
69 changes: 23 additions & 46 deletions lib/screens/landing/common/showCards.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:mvp/constants/themeColours.dart';
import 'package:mvp/models/category.dart';
import 'package:mvp/models/storeProducts.dart';
import 'package:mvp/screens/productsNew/details.dart';
import 'package:mvp/screens/productsNew/newUI.dart';
import 'package:mvp/sizeconfig/sizeconfig.dart';

class ShowCards extends StatefulWidget {
final StoreProduct sp;
final Category cat;
final bool store;
final int index;
ShowCards({this.sp, this.store, @required this.index});
ShowCards({this.sp, @required this.store, @required this.index, this.cat});

@override
_ShowCardsState createState() => _ShowCardsState();
Expand Down Expand Up @@ -53,79 +55,54 @@ class _ShowCardsState extends State<ShowCards> {
}));
else {
// open the modal container
// this.widget.sp.details.forEach((element) {
// if (!element.outOfStock) onClickProduct();
// });
if (!this.widget.sp.details[0].outOfStock) onClickProduct();
}
},
child: Container(
// fallback height
height: height * 0.22,
width: width * 0.4,
height: height * 0.12,
width: width * 0.24,
decoration: BoxDecoration(
border: !this.widget.store
? Border.all(
color: ThemeColoursSeva().pallete3,
width: 1.5,
width: 0.7,
)
: Border.all(
color: !this.widget.sp.details[0].outOfStock
? ThemeColoursSeva().pallete3
: ThemeColoursSeva().grey,
width: !this.widget.sp.details[0].outOfStock ? 1.5 : 0.2,
width: !this.widget.sp.details[0].outOfStock ? 0.7 : 0.2,
),
borderRadius: BorderRadius.circular(20.0)),
borderRadius: BorderRadius.circular(2.0)),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
widget.store
? Text(
"${widget.sp.name}",
overflow: TextOverflow.clip,
style: TextStyle(
color: !this.widget.sp.details[0].outOfStock
? ThemeColoursSeva().pallete1
: ThemeColoursSeva().grey,
fontSize: 3.4 * SizeConfig.widthMultiplier,
fontWeight: FontWeight.w700),
)
: SizedBox.shrink(),
// Hero animation on clicking any bestseller card
Hero(
tag: widget.sp.name,
tag: this.widget.store ? widget.sp.name : this.widget.cat.name,
transitionOnUserGestures: true,
child: Container(
height: height * 0.1,
height: height * 0.06,
child: CachedNetworkImage(
imageUrl: widget.sp.pictureURL,
imageUrl: this.widget.store
? widget.sp.pictureURL
: this.widget.cat.imgURL,
placeholder: (context, url) =>
Container(height: 50.0, child: Text("Loading...")),
Container(height: 20.0, child: Text("")),
errorWidget: (context, url, error) => Icon(Icons.error),
),
),
),
widget.store
? Text(
!this.widget.sp.details[0].outOfStock
? "₹ ${widget.sp.details[0].price} - ${widget.sp.details[0].quantity.quantityValue} ${widget.sp.details[0].quantity.quantityMetric}"
: "Out of Stock",
overflow: TextOverflow.clip,
style: TextStyle(
color: !this.widget.sp.details[0].outOfStock
? ThemeColoursSeva().pallete1
: ThemeColoursSeva().grey,
fontSize: 3.4 * SizeConfig.widthMultiplier,
fontWeight: FontWeight.w700),
)
: Text(
"${widget.sp.name}",
overflow: TextOverflow.clip,
style: TextStyle(
color: ThemeColoursSeva().pallete1,
fontSize: 3.4 * SizeConfig.widthMultiplier,
fontWeight: FontWeight.w700),
)
Text(
!this.widget.store ? "${widget.cat.name}" : "${widget.sp.name}",
overflow: TextOverflow.clip,
textAlign: TextAlign.center,
style: TextStyle(
color: ThemeColoursSeva().pallete1,
fontSize: 3.1 * SizeConfig.widthMultiplier,
fontWeight: FontWeight.w700),
)
],
),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/landing/graphics/lightBG.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class LightBlueBG extends CustomPainter {
ovalPath.close();

// paint
paint.color = ThemeColoursSeva().vlgColor;
paint.color = ThemeColoursSeva().pallete4;
canvas.drawPath(ovalPath, paint);
}

Expand Down
Loading

0 comments on commit 22f68fb

Please sign in to comment.