From 1463e416f736ddac1415e5faafbd7bb36cfbec9a Mon Sep 17 00:00:00 2001 From: Vikas Prashar Date: Mon, 19 Oct 2020 10:54:57 +0530 Subject: [PATCH 01/23] widget test passed --- .github/workflows/main.yaml | 2 +- lib/screens/auth/register.dart | 3 +++ test/widgets/register_test.dart | 8 ++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index aac2a3f..b47fc07 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -34,7 +34,7 @@ jobs: - run: flutter format --set-exit-if-changed . # Run widget tests for our flutter project. - # - run: flutter test + - run: flutter test # # Build apk. # - run: flutter build apk diff --git a/lib/screens/auth/register.dart b/lib/screens/auth/register.dart index 53ff110..dfec7aa 100644 --- a/lib/screens/auth/register.dart +++ b/lib/screens/auth/register.dart @@ -199,6 +199,7 @@ class _RegisterScreenState extends State { Column( children: [ InputTextField( + key: Key("username"), labelText: "Username", controller: _username, textInputType: TextInputType.text), @@ -206,6 +207,7 @@ class _RegisterScreenState extends State { height: 1.5 * SizeConfig.textMultiplier, ), InputTextField( + key: Key("emailkey"), labelText: "Email", controller: _emailAddress, textInputType: TextInputType.emailAddress), @@ -218,6 +220,7 @@ class _RegisterScreenState extends State { Column( children: [ InputTextField( + key: Key("mobilekey"), labelText: "Mobile", controller: _mobile, textInputType: TextInputType.number, diff --git a/test/widgets/register_test.dart b/test/widgets/register_test.dart index accf591..3663233 100644 --- a/test/widgets/register_test.dart +++ b/test/widgets/register_test.dart @@ -9,17 +9,17 @@ void main() { final username = find.text('Username'); expect(username, findsOneWidget); - final usernametextfield = find.byKey(Key('mobilekey')); + final usernametextfield = find.byKey(Key('username')); expect(usernametextfield, findsOneWidget); - await tester.enterText(usernametextfield, 'Mobile'); - expect(find.text('Mobile'), findsOneWidget); + await tester.enterText(usernametextfield, 'name'); + expect(find.text('name'), findsOneWidget); }); testWidgets('it should contain email field', (WidgetTester tester) async { await tester.pumpWidget(buildTestableWidget(RegisterScreen())); - final email = find.text('Email Address:'); + final email = find.text('Email'); expect(email, findsOneWidget); final emailtextfield = find.byKey(Key('emailkey')); From d11f740937bdd453778212d01de498fb446ed60c Mon Sep 17 00:00:00 2001 From: Vikas Prashar Date: Mon, 19 Oct 2020 12:11:45 +0530 Subject: [PATCH 02/23] dialog bug fix from caraousel --- lib/screens/landing/common/featuredCards.dart | 13 ++++-- lib/screens/landing/mainLanding.dart | 46 ------------------- 2 files changed, 10 insertions(+), 49 deletions(-) diff --git a/lib/screens/landing/common/featuredCards.dart b/lib/screens/landing/common/featuredCards.dart index 60d23f9..7698cf2 100644 --- a/lib/screens/landing/common/featuredCards.dart +++ b/lib/screens/landing/common/featuredCards.dart @@ -10,6 +10,7 @@ import 'package:flutter/material.dart'; import 'package:mvp/constants/themeColours.dart'; +import 'package:mvp/screens/common/sidenavbar.dart'; import 'package:mvp/sizeconfig/sizeconfig.dart'; typedef ShowDialog = void Function(); @@ -17,15 +18,21 @@ typedef ShowDialog = void Function(); class FeaturedCards extends StatelessWidget { final String textToDisplay; final int index; - final ShowDialog showInstructions; - FeaturedCards({this.textToDisplay, this.index, this.showInstructions}); + // final ShowDialog showInstructions; + FeaturedCards({this.textToDisplay, this.index}); + +// referral dialog + showInstructions(context) { + Sidenav().showReferralInstructions(context); + } + @override Widget build(BuildContext context) { // double height = MediaQuery.of(context).size.height; double width = MediaQuery.of(context).size.width; return GestureDetector( onTap: () { - if (index == 1) showInstructions(); + if (index == 1) showInstructions(context); }, child: Container( // fallback height diff --git a/lib/screens/landing/mainLanding.dart b/lib/screens/landing/mainLanding.dart index 466183b..3dc9d3e 100644 --- a/lib/screens/landing/mainLanding.dart +++ b/lib/screens/landing/mainLanding.dart @@ -299,50 +299,6 @@ class _MainLandingScreenState extends State { ); } - /// show referral instructions with an - /// Alert dialog - showReferralInstructions() { - Navigator.pop(context); - - showDialog( - context: context, - builder: (context) { - return AlertDialog( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(20.0))), - title: Text("Referral Code $_referralCode"), - content: Text( - "1️⃣ Share your code with friends.\n\n2️⃣ Ask them to order on the app\n\n3️⃣ Tell them to share your code and their order number on our WhatsApp number +918595179521 (with their registered number) \n\n4️⃣ You and your buddy receive Rs 25 each cashback on your orders! Yay 🥳 🎉 \n\nThis Whatsapp sharing is temporary. We're building a cool referral system!\n\nOrder amount must be above Rs 50\n\nOnly valid once per friend"), - actions: [ - RaisedButton( - onPressed: () { - Navigator.pop(context); - }, - child: Text( - "OK", - style: TextStyle(color: Colors.white), - ), - color: ThemeColoursSeva().pallete1, - ), - SizedBox(width: 20.0), - RaisedButton( - onPressed: () { - String msg = ''' - Hi, here's my referral code - $_referralCode\n1️⃣ Order on the Seva App.\n2️⃣ Share your order number and my referral code on +918595179521(Seva Business Whatsapp)\n3️⃣ We both receive Rs 25 cashback each on orders above Rs 50!\nIf you don't have the app, get it now on https://bit.ly/Seva_Android_App - '''; - Share.share(msg); - }, - child: Text( - "Share", - style: TextStyle(color: Colors.white), - ), - color: ThemeColoursSeva().dkGreen, - ), - ], - ); - }); - } - /// This function gives out index and value /// instead of just value (like map), so this is /// an extension of map iterable func @@ -457,8 +413,6 @@ class _MainLandingScreenState extends State { return FeaturedCards( textToDisplay: item, index: index, - showInstructions: - showReferralInstructions, ); }, )).toList(), From bb518f1d1d03597e292f7dde77b39f2e7bb27e72 Mon Sep 17 00:00:00 2001 From: Vikas Prashar Date: Mon, 19 Oct 2020 20:47:31 +0530 Subject: [PATCH 03/23] refrall not visible fix --- lib/screens/common/sidenavbar.dart | 4 ++-- lib/screens/landing/common/featuredCards.dart | 7 ++++--- lib/screens/landing/mainLanding.dart | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/screens/common/sidenavbar.dart b/lib/screens/common/sidenavbar.dart index 2f38e86..ba6dff6 100644 --- a/lib/screens/common/sidenavbar.dart +++ b/lib/screens/common/sidenavbar.dart @@ -27,7 +27,7 @@ class Sidenav extends StatelessWidget { /// show referral instructions with an /// Alert dialog - showReferralInstructions(context) { + showReferralInstructions(context,referralCode) { showDialog( context: context, builder: (context) { @@ -228,7 +228,7 @@ class Sidenav extends StatelessWidget { style: TextStyle(fontSize: SizeConfig.widthMultiplier * 3.65), ), onTap: () { - showReferralInstructions(context); + showReferralInstructions(context,referralCode); }, ), ListTile( diff --git a/lib/screens/landing/common/featuredCards.dart b/lib/screens/landing/common/featuredCards.dart index 7698cf2..3a7f96c 100644 --- a/lib/screens/landing/common/featuredCards.dart +++ b/lib/screens/landing/common/featuredCards.dart @@ -15,15 +15,16 @@ import 'package:mvp/sizeconfig/sizeconfig.dart'; typedef ShowDialog = void Function(); -class FeaturedCards extends StatelessWidget { +class FeaturedCards extends StatelessWidget { final String textToDisplay; final int index; + final String referralCode; // final ShowDialog showInstructions; - FeaturedCards({this.textToDisplay, this.index}); + FeaturedCards({this.textToDisplay, this.index,this.referralCode}); // referral dialog showInstructions(context) { - Sidenav().showReferralInstructions(context); + Sidenav().showReferralInstructions(context,referralCode); } @override diff --git a/lib/screens/landing/mainLanding.dart b/lib/screens/landing/mainLanding.dart index 3dc9d3e..13e2b79 100644 --- a/lib/screens/landing/mainLanding.dart +++ b/lib/screens/landing/mainLanding.dart @@ -413,6 +413,7 @@ class _MainLandingScreenState extends State { return FeaturedCards( textToDisplay: item, index: index, + referralCode:_referralCode ); }, )).toList(), From 6711757949e342de3408ee05162e348d59a535e5 Mon Sep 17 00:00:00 2001 From: Vikas Prashar Date: Tue, 20 Oct 2020 20:30:30 +0530 Subject: [PATCH 04/23] added pull to reload --- lib/screens/landing/mainLanding.dart | 49 ++++++++++++++++++++++++++-- pubspec.lock | 7 ++++ pubspec.yaml | 1 + 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/lib/screens/landing/mainLanding.dart b/lib/screens/landing/mainLanding.dart index 466183b..6634654 100644 --- a/lib/screens/landing/mainLanding.dart +++ b/lib/screens/landing/mainLanding.dart @@ -18,6 +18,7 @@ import 'package:mvp/domain/bestsellers_repository.dart'; import 'package:mvp/screens/common/cartIcon.dart'; import 'package:mvp/screens/common/common_functions.dart'; import 'package:mvp/screens/common/sidenavbar.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:share/share.dart'; import 'package:carousel_slider/carousel_slider.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; @@ -117,6 +118,27 @@ class _MainLandingScreenState extends State { x.cancel(); } +// for pull refresh + RefreshController _refreshController = + RefreshController(initialRefresh: false); + + void _onRefresh() async { + // monitor network fetch + await Future.delayed(Duration(milliseconds: 1000)); + apiBloc.add(GetBestSellers()); + + // if failed,use refreshFailed() + _refreshController.refreshCompleted(); + } + + void _onLoading() async { + // monitor network fetch + await Future.delayed(Duration(milliseconds: 1000)); + // if failed,use loadFailed(),if no data return,use LoadNodata() + if (mounted) setState(() {}); + _refreshController.loadComplete(); + } + /// Get the token, save it to the database for current user _saveDeviceToken() async { final p = await Preferences.getInstance(); @@ -392,8 +414,31 @@ class _MainLandingScreenState extends State { child: Align( alignment: Alignment.topCenter, child: SafeArea( - child: SingleChildScrollView( - child: Column( + child: SmartRefresher( + enablePullDown: true, + enablePullUp: true, + // header: WaterDropHeader(), + footer: CustomFooter( + builder: (BuildContext context, LoadStatus mode) { + Widget body; + + if (mode == LoadStatus.loading) { + body = CupertinoActivityIndicator(); + } else if (mode == LoadStatus.failed) { + body = Text("Load Failed!Click retry!"); + } else if (mode == LoadStatus.canLoading) { + body = Text("release to load more"); + } + + return Container( + // height: 55.0, + ); + }, + ), + controller: _refreshController, + onRefresh: _onRefresh, + onLoading: _onLoading, + child: ListView( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, diff --git a/pubspec.lock b/pubspec.lock index 95ba0fd..84a7cfe 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -695,6 +695,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.5" + pull_to_refresh: + dependency: "direct main" + description: + name: pull_to_refresh + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.2" quiver: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 1c7ffe2..8d23cce 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -67,6 +67,7 @@ dependencies: hive_flutter: ^0.3.0+2 # slide bar slider_button: ^0.6.0 + pull_to_refresh: ^1.6.1 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. From 7966073ecbcdc96be50938bfdeb11dc197a12b36 Mon Sep 17 00:00:00 2001 From: Vikas Prashar Date: Tue, 20 Oct 2020 20:47:04 +0530 Subject: [PATCH 05/23] seprate header file --- lib/screens/common/customappBar.dart | 150 +++++++++ lib/screens/landing/mainLanding.dart | 480 +++++++++++---------------- 2 files changed, 348 insertions(+), 282 deletions(-) create mode 100644 lib/screens/common/customappBar.dart diff --git a/lib/screens/common/customappBar.dart b/lib/screens/common/customappBar.dart new file mode 100644 index 0000000..e33c92e --- /dev/null +++ b/lib/screens/common/customappBar.dart @@ -0,0 +1,150 @@ +import 'dart:convert'; +import 'package:http/http.dart' as http; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +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/location.dart'; +import 'package:mvp/sizeconfig/sizeconfig.dart'; + +class CustomAppBar extends PreferredSize { + final GlobalKey scaffoldKey; + final double height; + final String email; + CustomAppBar( + {@required this.scaffoldKey, this.height = kToolbarHeight, this.email}); + + @override + Size get preferredSize => Size.fromHeight(height); + + //This function shows the user's address in a dialog box + // and the user can edit the address from their also + _showLocation(context) { + showDialog( + context: context, + builder: (context) { + return AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(20.0))), + title: Text( + "Delivery Address:", + style: TextStyle( + fontSize: 17.0, + color: Colors.black, + fontWeight: FontWeight.w500), + ), + content: FutureBuilder( + future: _fetchUserAddress(), + builder: (context, data) { + if (data.hasData) { + return StatefulBuilder(builder: (context, setState) { + return Container( + height: 120.0, + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 10.0), + Container( + width: MediaQuery.of(context).size.width * 0.6, + child: Text( + data.data, + overflow: TextOverflow.clip, + ), + ), + SizedBox(height: 30.0), + ], + ), + ); + }); + } else + return Container(child: Text("Loading Address ...")); + }), + actions: [ + FutureBuilder( + future: _fetchUserAddress(), + builder: (context, data) { + if (data.hasData) { + return RaisedButton( + onPressed: () { + Navigator.of(context).push(CupertinoPageRoute( + builder: (BuildContext context) { + return GoogleLocationScreen( + userEmail: email, + ); + })); + }, + child: Text("Change"), + color: ThemeColoursSeva().pallete1, + textColor: Colors.white, + ); + } else + return Container(); + }, + ), + ], + ); + }, + ); + } + + //To get the address of the user address on clicking the + // location icon + Future _fetchUserAddress() async { + var mail = email; + final p = await Preferences.getInstance(); + String token = await p.getData("token"); + String id = await p.getData("id"); + Map requestHeaders = {'x-auth-token': token}; + String url = APIService.getAddressAPI + "$id"; + var response = await http.get(url, headers: requestHeaders); + if (response.statusCode == 200) { + // got address + mail = json.decode(response.body)["email"]; + return (json.decode(response.body)["address"]); + } else { + throw Exception('something is wrong'); + } + } + + @override + Widget build(BuildContext context) { + return Container( + color: ThemeColoursSeva().pallete3, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + IconButton( + icon: Icon(Icons.menu), + onPressed: () { + scaffoldKey.currentState.openDrawer(); + }, + iconSize: 28.0, + ), + Text( + "Welcome", + style: TextStyle( + color: ThemeColoursSeva().dkGreen, + fontSize: 3.30 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold), + ), + Row( + children: [ + IconButton( + icon: Icon(Icons.location_on), + onPressed: () { + _showLocation(context); + }, + iconSize: 28.0, + ), + CartIcon(), + ], + ), + ], + ), + ); + } +} diff --git a/lib/screens/landing/mainLanding.dart b/lib/screens/landing/mainLanding.dart index 6634654..c9c80b6 100644 --- a/lib/screens/landing/mainLanding.dart +++ b/lib/screens/landing/mainLanding.dart @@ -9,14 +9,13 @@ ///is logged in. /// import 'dart:async'; -import 'dart:convert'; import 'package:flutter/cupertino.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:mvp/bloc/bestsellers_bloc/bestsellers_bloc.dart'; import 'package:mvp/classes/prefrenses.dart'; import 'package:mvp/domain/bestsellers_repository.dart'; -import 'package:mvp/screens/common/cartIcon.dart'; import 'package:mvp/screens/common/common_functions.dart'; +import 'package:mvp/screens/common/customappBar.dart'; import 'package:mvp/screens/common/sidenavbar.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:share/share.dart'; @@ -30,7 +29,6 @@ import 'package:mvp/models/storeProducts.dart'; import 'package:mvp/screens/landing/common/featuredCards.dart'; import 'package:mvp/screens/landing/common/showCards.dart'; import 'package:mvp/screens/landing/graphics/darkBG.dart'; -import 'package:mvp/screens/location.dart'; import 'package:mvp/sizeconfig/sizeconfig.dart'; import 'package:shimmer/shimmer.dart'; import 'graphics/lightBG.dart'; @@ -179,95 +177,6 @@ class _MainLandingScreenState extends State { }); } - //To get the address of the user address on clicking the - // location icon - Future _fetchUserAddress() async { - final p = await Preferences.getInstance(); - String token = await p.getData("token"); - String id = await p.getData("id"); - Map requestHeaders = {'x-auth-token': token}; - String url = APIService.getAddressAPI + "$id"; - var response = await http.get(url, headers: requestHeaders); - if (response.statusCode == 200) { - // got address - _email = json.decode(response.body)["email"]; - return (json.decode(response.body)["address"]); - } else { - throw Exception('something is wrong'); - } - } - - //This function shows the user's address in a dialog box - // and the user can edit the address from their also - _showLocation() { - showDialog( - context: context, - builder: (context) { - return AlertDialog( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(20.0))), - title: Text( - "Delivery Address:", - style: TextStyle( - fontSize: 17.0, - color: Colors.black, - fontWeight: FontWeight.w500), - ), - content: FutureBuilder( - future: _fetchUserAddress(), - builder: (context, data) { - if (data.hasData) { - return StatefulBuilder(builder: (context, setState) { - return Container( - height: 120.0, - width: double.infinity, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 10.0), - Container( - width: MediaQuery.of(context).size.width * 0.6, - child: Text( - data.data, - overflow: TextOverflow.clip, - ), - ), - SizedBox(height: 30.0), - ], - ), - ); - }); - } else - return Container(child: Text("Loading Address ...")); - }), - actions: [ - FutureBuilder( - future: _fetchUserAddress(), - builder: (context, data) { - if (data.hasData) { - return RaisedButton( - onPressed: () { - Navigator.of(context).push(CupertinoPageRoute( - builder: (BuildContext context) { - return GoogleLocationScreen( - userEmail: _email, - ); - })); - }, - child: Text("Change"), - color: ThemeColoursSeva().pallete1, - textColor: Colors.white, - ); - } else - return Container(); - }, - ), - ], - ); - }, - ); - } - //Common Card widget for both the best sellers and Categories Widget commonWidget(height, itemsList, store) { return Container( @@ -387,209 +296,216 @@ class _MainLandingScreenState extends State { // height and width if the device double height = MediaQuery.of(context).size.height; double width = MediaQuery.of(context).size.width; - return Scaffold( - key: _scaffoldKey, - backgroundColor: Colors.white, - drawer: SizedBox( - width: width * 0.5, + return SafeArea( + child: Scaffold( + key: _scaffoldKey, + backgroundColor: Colors.white, + appBar: CustomAppBar( + height: 120, + scaffoldKey: _scaffoldKey, + email: _email, + ), + drawer: SizedBox( + width: width * 0.5, - /// Side Drawer visible after login - child: Sidenav( - height: height, - width: width, - username: _username, - referralCode: _referralCode, - )), - body: Stack( - children: [ - CustomPaint( - painter: LightBlueBG(), - child: Container(), - ), - CustomPaint( - painter: DarkColourBG(), - child: Container(), - ), - Positioned.fill( - child: Align( - alignment: Alignment.topCenter, - child: SafeArea( - child: SmartRefresher( - enablePullDown: true, - enablePullUp: true, - // header: WaterDropHeader(), - footer: CustomFooter( - builder: (BuildContext context, LoadStatus mode) { - Widget body; - - if (mode == LoadStatus.loading) { - body = CupertinoActivityIndicator(); - } else if (mode == LoadStatus.failed) { - body = Text("Load Failed!Click retry!"); - } else if (mode == LoadStatus.canLoading) { - body = Text("release to load more"); - } + /// Side Drawer visible after login + child: Sidenav( + height: height, + width: width, + username: _username, + referralCode: _referralCode, + )), + body: Stack( + children: [ + CustomPaint( + painter: LightBlueBG(), + child: Container(), + ), + CustomPaint( + painter: DarkColourBG(), + child: Container(), + ), + Positioned.fill( + child: Align( + alignment: Alignment.topCenter, + child: SafeArea( + child: SmartRefresher( + enablePullDown: true, + enablePullUp: true, + // header: WaterDropHeader(), + footer: CustomFooter( + builder: (BuildContext context, LoadStatus mode) { + Widget body; + if (mode == LoadStatus.loading) { + body = CupertinoActivityIndicator(); + } else if (mode == LoadStatus.failed) { + body = Text("Load Failed!Click retry!"); + } else if (mode == LoadStatus.canLoading) { + body = Text("release to load more"); + } - return Container( - // height: 55.0, - ); - }, - ), - controller: _refreshController, - onRefresh: _onRefresh, - onLoading: _onLoading, - child: ListView( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - IconButton( - icon: Icon(Icons.menu), - onPressed: () { - _scaffoldKey.currentState.openDrawer(); - }, - iconSize: 28.0, - ), - Text( - "Welcome", - style: TextStyle( - color: ThemeColoursSeva().dkGreen, - fontSize: 3.30 * SizeConfig.textMultiplier, - fontWeight: FontWeight.bold), - ), - Row( - children: [ - IconButton( - icon: Icon(Icons.location_on), - onPressed: () { - _showLocation(); - }, - iconSize: 28.0, + return Container( + // height: 55.0, + ); + }, + ), + controller: _refreshController, + onRefresh: _onRefresh, + onLoading: _onLoading, + child: ListView( + children: [ + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // children: [ + // IconButton( + // icon: Icon(Icons.menu), + // onPressed: () { + // _scaffoldKey.currentState.openDrawer(); + // }, + // iconSize: 28.0, + // ), + // Text( + // "Welcome", + // style: TextStyle( + // color: ThemeColoursSeva().dkGreen, + // fontSize: 3.30 * SizeConfig.textMultiplier, + // fontWeight: FontWeight.bold), + // ), + // Row( + // children: [ + // IconButton( + // icon: Icon(Icons.location_on), + // onPressed: () { + // _showLocation(); + // }, + // iconSize: 28.0, + // ), + // CartIcon(), + // ], + // ), + // ], + // ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(11.0), + child: Text( + "Featured", + style: TextStyle( + color: ThemeColoursSeva().dkGreen, + fontWeight: FontWeight.w900, + fontSize: 2.7 * SizeConfig.textMultiplier), ), - CartIcon(), - ], - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(11.0), - child: Text( - "Featured", - style: TextStyle( - color: ThemeColoursSeva().dkGreen, - fontWeight: FontWeight.w900, - fontSize: 2.7 * SizeConfig.textMultiplier), ), - ), - ], - ), + ], + ), - // carousel with indicator - Container( - height: 23.0 * SizeConfig.heightMultiplier, - width: double.infinity, - child: Column( - children: [ - Expanded( - child: CarouselSlider( - items: mapIndexed( - texts, - (index, item) => Builder( - builder: (BuildContext context) { - return FeaturedCards( - textToDisplay: item, - index: index, - showInstructions: - showReferralInstructions, - ); - }, - )).toList(), - options: CarouselOptions( - onPageChanged: (index, reason) { - setState(() { - _current = index; - }); - }, - height: SizeConfig.heightMultiplier * 24, - aspectRatio: 16 / 9, - viewportFraction: 0.8, - initialPage: 0, - enableInfiniteScroll: true, - reverse: false, - autoPlay: true, - autoPlayInterval: Duration(seconds: 4), - autoPlayAnimationDuration: - Duration(milliseconds: 600), - autoPlayCurve: Curves.fastOutSlowIn, - enlargeCenterPage: false, - scrollDirection: Axis.horizontal, + // carousel with indicator + Container( + height: 23.0 * SizeConfig.heightMultiplier, + width: double.infinity, + child: Column( + children: [ + Expanded( + child: CarouselSlider( + items: mapIndexed( + texts, + (index, item) => Builder( + builder: (BuildContext context) { + return FeaturedCards( + textToDisplay: item, + index: index, + showInstructions: + showReferralInstructions, + ); + }, + )).toList(), + options: CarouselOptions( + onPageChanged: (index, reason) { + setState(() { + _current = index; + }); + }, + height: SizeConfig.heightMultiplier * 24, + aspectRatio: 16 / 9, + viewportFraction: 0.8, + initialPage: 0, + enableInfiniteScroll: true, + reverse: false, + autoPlay: true, + autoPlayInterval: Duration(seconds: 4), + autoPlayAnimationDuration: + Duration(milliseconds: 600), + autoPlayCurve: Curves.fastOutSlowIn, + enlargeCenterPage: false, + scrollDirection: Axis.horizontal, + ), ), ), - ), - /// text visible in the carousel card - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: texts.map((url) { - int index = texts.indexOf(url); - return Container( - width: 8.0, - height: 8.0, - margin: EdgeInsets.symmetric( - vertical: 10.0, horizontal: 2.0), - decoration: BoxDecoration( - shape: BoxShape.circle, - color: _current == index - ? Color.fromRGBO(0, 0, 0, 0.9) - : Color.fromRGBO(0, 0, 0, 0.4), - ), - ); - }).toList(), - ), - ], - ), - ), - HelperFunctions.commonText( - height, "Best Sellers", "", context), - SizedBox(height: 9.0), - BlocBuilder( - builder: (context, state) { - if (state is BestSellersInitial || - state is BestSellersLoading) { - return Shimmer.fromColors( - highlightColor: Colors.white, - baseColor: Colors.grey[300], - child: Container( - child: _shimmerLayout(height, width), + /// text visible in the carousel card + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: texts.map((url) { + int index = texts.indexOf(url); + return Container( + width: 8.0, + height: 8.0, + margin: EdgeInsets.symmetric( + vertical: 10.0, horizontal: 2.0), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: _current == index + ? Color.fromRGBO(0, 0, 0, 0.9) + : Color.fromRGBO(0, 0, 0, 0.4), + ), + ); + }).toList(), ), - ); - } else if (state is BestSellersLoaded) { - List arr = state.bestsellers; - arr.sort((a, b) => a.name.compareTo(b.name)); - return commonWidget(height, arr, true); - } else if (state is BestSellersError) { - return Text(state.msg); - } else - return Container( - child: Center(child: Text("No products found!")), - ); - }, - ), - HelperFunctions.commonText( - height, "Categories", "", "SEE ALL"), - SizedBox(height: 9.0), - commonWidget(height, categories, false), - SizedBox(height: 9.0) - ], + ], + ), + ), + HelperFunctions.commonText( + height, "Best Sellers", "", context), + SizedBox(height: 9.0), + BlocBuilder( + builder: (context, state) { + if (state is BestSellersInitial || + state is BestSellersLoading) { + return Shimmer.fromColors( + highlightColor: Colors.white, + baseColor: Colors.grey[300], + child: Container( + child: _shimmerLayout(height, width), + ), + ); + } else if (state is BestSellersLoaded) { + List arr = state.bestsellers; + arr.sort((a, b) => a.name.compareTo(b.name)); + return commonWidget(height, arr, true); + } else if (state is BestSellersError) { + return Text(state.msg); + } else + return Container( + child: + Center(child: Text("No products found!")), + ); + }, + ), + HelperFunctions.commonText( + height, "Categories", "", "SEE ALL"), + SizedBox(height: 9.0), + commonWidget(height, categories, false), + SizedBox(height: 9.0) + ], + ), ), ), ), ), - ), - ], + ], + ), ), ); } From b81956071d34f697baa29e5177cf23338ac78bb6 Mon Sep 17 00:00:00 2001 From: Rajat012k Date: Wed, 21 Oct 2020 14:52:54 +0530 Subject: [PATCH 06/23] check connection widget --- lib/screens/landing/mainLanding.dart | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/screens/landing/mainLanding.dart b/lib/screens/landing/mainLanding.dart index c9c80b6..665b8c0 100644 --- a/lib/screens/landing/mainLanding.dart +++ b/lib/screens/landing/mainLanding.dart @@ -485,7 +485,13 @@ class _MainLandingScreenState extends State { arr.sort((a, b) => a.name.compareTo(b.name)); return commonWidget(height, arr, true); } else if (state is BestSellersError) { - return Text(state.msg); + return Center( + child: Text( + state.msg, + style: TextStyle( + color: Colors.red, + fontSize: 3 * SizeConfig.textMultiplier), + )); } else return Container( child: From 7af680786b144443bc0cbd0e648919a93762cc9d Mon Sep 17 00:00:00 2001 From: Vikas Prashar Date: Wed, 21 Oct 2020 15:14:33 +0530 Subject: [PATCH 07/23] pull to refresh in products --- lib/screens/common/customappBar.dart | 1 + lib/screens/landing/mainLanding.dart | 45 ++----------------- lib/screens/productsNew/newUI.dart | 67 ++++++++++++++++++++++++---- 3 files changed, 64 insertions(+), 49 deletions(-) diff --git a/lib/screens/common/customappBar.dart b/lib/screens/common/customappBar.dart index e33c92e..dd5576f 100644 --- a/lib/screens/common/customappBar.dart +++ b/lib/screens/common/customappBar.dart @@ -94,6 +94,7 @@ class CustomAppBar extends PreferredSize { //To get the address of the user address on clicking the // location icon Future _fetchUserAddress() async { + // ignore: unused_local_variable var mail = email; final p = await Preferences.getInstance(); String token = await p.getData("token"); diff --git a/lib/screens/landing/mainLanding.dart b/lib/screens/landing/mainLanding.dart index c9c80b6..2caa044 100644 --- a/lib/screens/landing/mainLanding.dart +++ b/lib/screens/landing/mainLanding.dart @@ -116,7 +116,7 @@ class _MainLandingScreenState extends State { x.cancel(); } -// for pull refresh +// pull to refresh RefreshController _refreshController = RefreshController(initialRefresh: false); @@ -335,18 +335,12 @@ class _MainLandingScreenState extends State { // header: WaterDropHeader(), footer: CustomFooter( builder: (BuildContext context, LoadStatus mode) { - Widget body; if (mode == LoadStatus.loading) { - body = CupertinoActivityIndicator(); + CupertinoActivityIndicator(); } else if (mode == LoadStatus.failed) { - body = Text("Load Failed!Click retry!"); - } else if (mode == LoadStatus.canLoading) { - body = Text("release to load more"); + Text("Load Failed!Please retry!"); } - - return Container( - // height: 55.0, - ); + return Container(); }, ), controller: _refreshController, @@ -354,37 +348,6 @@ class _MainLandingScreenState extends State { onLoading: _onLoading, child: ListView( children: [ - // Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // IconButton( - // icon: Icon(Icons.menu), - // onPressed: () { - // _scaffoldKey.currentState.openDrawer(); - // }, - // iconSize: 28.0, - // ), - // Text( - // "Welcome", - // style: TextStyle( - // color: ThemeColoursSeva().dkGreen, - // fontSize: 3.30 * SizeConfig.textMultiplier, - // fontWeight: FontWeight.bold), - // ), - // Row( - // children: [ - // IconButton( - // icon: Icon(Icons.location_on), - // onPressed: () { - // _showLocation(); - // }, - // iconSize: 28.0, - // ), - // CartIcon(), - // ], - // ), - // ], - // ), Row( mainAxisAlignment: MainAxisAlignment.start, children: [ diff --git a/lib/screens/productsNew/newUI.dart b/lib/screens/productsNew/newUI.dart index a36956c..6e55f03 100644 --- a/lib/screens/productsNew/newUI.dart +++ b/lib/screens/productsNew/newUI.dart @@ -8,6 +8,7 @@ /// @fileoverview New Products Widget : Shows all the products available. /// import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:mvp/bloc/productsapi_bloc.dart'; @@ -19,6 +20,7 @@ import 'package:mvp/models/storeProducts.dart'; import 'package:mvp/screens/common/cartIcon.dart'; import 'package:mvp/screens/productsNew/details.dart'; import 'package:mvp/sizeconfig/sizeconfig.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; // import 'package:provider/provider.dart'; import 'package:shimmer/shimmer.dart'; @@ -104,6 +106,38 @@ class _ProductsUINewState extends State { await box.clear(); } +// for pull refresh + RefreshController _refreshController = + RefreshController(initialRefresh: false); + + void _onRefresh() async { + // monitor network fetch + await Future.delayed(Duration(milliseconds: 1000)); + // calling the function as per category + switch (tag) { + case 0: + apiBloc.add(GetVegetables()); + break; + case 1: + apiBloc.add(GetFruits()); + break; + case 2: + apiBloc.add(GetDailyEssentials()); + break; + default: + } + // if failed,use refreshFailed() + _refreshController.refreshCompleted(); + } + + void _onLoading() async { + // monitor network fetch + await Future.delayed(Duration(milliseconds: 1000)); + // if failed,use loadFailed(),if no data return,use LoadNodata() + if (mounted) setState(() {}); + _refreshController.loadComplete(); + } + /// UTIL func /// Makes the array /// @@ -367,14 +401,31 @@ class _ProductsUINewState extends State { } else if (state is ProductsapiLoaded) { List arr = state.products; arr.sort((a, b) => a.name.compareTo(b.name)); - return GridView.count( - // Create a grid with 2 columns. If you change the scrollDirection to - // horizontal, this produces 2 rows. - crossAxisCount: 2, - children: arr.map((e) { - return getCard(e); - }).toList(), - ); + // enclosed gridview in refresher + return SmartRefresher( + enablePullDown: true, + enablePullUp: true, + footer: CustomFooter( + builder: (BuildContext context, LoadStatus mode) { + if (mode == LoadStatus.loading) { + CupertinoActivityIndicator(); + } else if (mode == LoadStatus.failed) { + Text("Load Failed!Please retry!"); + } + return Container(); + }, + ), + controller: _refreshController, + onRefresh: _onRefresh, + onLoading: _onLoading, + child: GridView.count( + // Create a grid with 2 columns. If you change the scrollDirection to + // horizontal, this produces 2 rows. + crossAxisCount: 2, + children: arr.map((e) { + return getCard(e); + }).toList(), + )); } else if (state is ProductsapiError) { return Text(state.msg); } else From d875f65aeaac85cb29c28dce183f72a7d78c5901 Mon Sep 17 00:00:00 2001 From: Vikas Prashar Date: Thu, 22 Oct 2020 14:06:18 +0530 Subject: [PATCH 08/23] optimised product bloc --- lib/bloc/productsapi_bloc.dart | 38 ++++++++++-------------------- lib/bloc/productsapi_event.dart | 8 +++---- lib/domain/product_repository.dart | 23 ++++-------------- lib/screens/productsNew/newUI.dart | 22 ++++++++++------- 4 files changed, 35 insertions(+), 56 deletions(-) diff --git a/lib/bloc/productsapi_bloc.dart b/lib/bloc/productsapi_bloc.dart index 74c72bc..2101bdf 100644 --- a/lib/bloc/productsapi_bloc.dart +++ b/lib/bloc/productsapi_bloc.dart @@ -17,31 +17,19 @@ class ProductsapiBloc extends Bloc { Stream mapEventToState( ProductsapiEvent event, ) async* { - if (event is GetVegetables) { - yield* _loadProducts(_productRepository.fetchVegetables); - } else if (event is GetFruits) { - yield* _loadProducts(_productRepository.fetchFruits); - } else if (event is GetDailyEssentials) { - yield* _loadProducts(_productRepository.fetchDailyEssentials); + if (event is GetProducts) { + try { + yield ProductsapiLoading(); + final products = await _productRepository.fetchProducts(event.type); + yield ProductsapiLoaded(products); + } on UnauthorisedException { + yield ProductsapiLoading(); + await _productRepository.refreshToken(); + final products = await _productRepository.fetchProducts(event.type); + yield ProductsapiLoaded(products); + } catch (err) { + yield ProductsapiError(err.toString()); + } } } - - Stream _loadProducts(func) async* { - try { - yield ProductsapiLoading(); - final products = await func(); - yield ProductsapiLoaded(products); - } on UnauthorisedException { - yield* _exceptionHandler(func); - } catch (err) { - yield ProductsapiError(err.toString()); - } - } - - Stream _exceptionHandler(func) async* { - yield ProductsapiLoading(); - await _productRepository.refreshToken(); - final products = await func(); - yield ProductsapiLoaded(products); - } } diff --git a/lib/bloc/productsapi_event.dart b/lib/bloc/productsapi_event.dart index 195b2bc..a73fac1 100644 --- a/lib/bloc/productsapi_event.dart +++ b/lib/bloc/productsapi_event.dart @@ -3,8 +3,8 @@ part of 'productsapi_bloc.dart'; @immutable abstract class ProductsapiEvent {} -class GetVegetables extends ProductsapiEvent {} +class GetProducts extends ProductsapiEvent { + final String type; + GetProducts({@required this.type}) : assert(type != null); +} -class GetFruits extends ProductsapiEvent {} - -class GetDailyEssentials extends ProductsapiEvent {} diff --git a/lib/domain/product_repository.dart b/lib/domain/product_repository.dart index a8864e9..4656a86 100644 --- a/lib/domain/product_repository.dart +++ b/lib/domain/product_repository.dart @@ -9,13 +9,12 @@ import 'package:mvp/models/storeProducts.dart'; import 'package:http/http.dart' as http; abstract class ProductRepository { - Future> fetchVegetables(); - Future> fetchFruits(); - Future> fetchDailyEssentials(); + Future> fetchProducts(String type); } class ProductRepositoryImpl implements ProductRepository { - Future _fetch(String type) async { + @override + Future> fetchProducts(type) async { final SPBox spBox = await SPBox.getSPBoxInstance(); final List sp = spBox.getFromSPBox(type); if (sp.length == 0) { @@ -35,21 +34,7 @@ class ProductRepositoryImpl implements ProductRepository { } else if (sp.length > 0) { return sp; } - } - - @override - Future> fetchVegetables() async { - return await _fetch("vegetable"); - } - - @override - Future> fetchFruits() async { - return await _fetch("fruit"); - } - - @override - Future> fetchDailyEssentials() async { - return await _fetch("dailyEssential"); + return null; } refreshToken() async { diff --git a/lib/screens/productsNew/newUI.dart b/lib/screens/productsNew/newUI.dart index a36956c..f0b6f41 100644 --- a/lib/screens/productsNew/newUI.dart +++ b/lib/screens/productsNew/newUI.dart @@ -14,22 +14,22 @@ import 'package:mvp/bloc/productsapi_bloc.dart'; import 'package:mvp/classes/storeProducts_box.dart'; import 'package:mvp/constants/themeColours.dart'; import 'package:mvp/domain/product_repository.dart'; -// import 'package:mvp/models/newCart.dart'; import 'package:mvp/models/storeProducts.dart'; import 'package:mvp/screens/common/cartIcon.dart'; import 'package:mvp/screens/productsNew/details.dart'; import 'package:mvp/sizeconfig/sizeconfig.dart'; -// import 'package:provider/provider.dart'; import 'package:shimmer/shimmer.dart'; class Category { final String name; + final String resname; Color backgroundColor; Color textColor; final bool hasData; Category( {@required this.name, + this.resname, @required this.backgroundColor, @required this.textColor, @required this.hasData}); @@ -71,13 +71,13 @@ class _ProductsUINewState extends State { catArray[tag].textColor = Colors.white; switch (tag) { case 0: - apiBloc.add(GetVegetables()); + apiBloc.add(GetProducts(type: catArray[tag].resname)); break; case 1: - apiBloc.add(GetFruits()); + apiBloc.add(GetProducts(type: catArray[tag].resname)); break; case 2: - apiBloc.add(GetDailyEssentials()); + apiBloc.add(GetProducts(type: catArray[tag].resname)); break; default: } @@ -111,16 +111,19 @@ class _ProductsUINewState extends State { void makeArray() { final a = Category( name: "Vegetables", + resname: "vegetable", backgroundColor: Colors.white, textColor: ThemeColoursSeva().pallete1, hasData: true); final b = Category( name: "Fruits", + resname: "fruit", backgroundColor: Colors.white, textColor: ThemeColoursSeva().pallete1, hasData: true); final c = Category( name: "Milk, Eggs & Bread", + resname: "dailyEssential", backgroundColor: Colors.white, textColor: ThemeColoursSeva().pallete1, hasData: true); @@ -329,13 +332,16 @@ class _ProductsUINewState extends State { }); switch (index) { case 0: - apiBloc.add(GetVegetables()); + apiBloc.add(GetProducts( + type: catArray[index].resname)); break; case 1: - apiBloc.add(GetFruits()); + apiBloc.add(GetProducts( + type: catArray[index].resname)); break; case 2: - apiBloc.add(GetDailyEssentials()); + apiBloc.add(GetProducts( + type: catArray[index].resname)); break; default: } From 00ab886a3504311aa3372f0063906873f965c5f3 Mon Sep 17 00:00:00 2001 From: Rajat012k Date: Thu, 22 Oct 2020 21:43:30 +0530 Subject: [PATCH 09/23] Bug Sorted --- lib/screens/common/animatedCard.dart | 15 +++++++++++++++ lib/screens/common/common_functions.dart | 14 +++++++++++--- lib/screens/productsNew/details.dart | 4 ++++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/lib/screens/common/animatedCard.dart b/lib/screens/common/animatedCard.dart index 7b32c36..ad4ec1e 100644 --- a/lib/screens/common/animatedCard.dart +++ b/lib/screens/common/animatedCard.dart @@ -283,6 +283,13 @@ class _AnimatedCardState extends State .details[0] .quantity .quantityMetric, + widget + .product + .details[0] + .quantity + .allowedQuantities[ + i] + .value, widget .product .details[0] @@ -312,6 +319,14 @@ class _AnimatedCardState extends State 0] .quantity .quantityMetric, + widget + .product + .details[ + 0] + .quantity + .allowedQuantities[ + i] + .value, widget .product .details[ diff --git a/lib/screens/common/common_functions.dart b/lib/screens/common/common_functions.dart index 9cea9ff..e476839 100644 --- a/lib/screens/common/common_functions.dart +++ b/lib/screens/common/common_functions.dart @@ -18,7 +18,7 @@ import 'package:mvp/constants/themeColours.dart'; class HelperFunctions { static void helper(int index, NewCartModel newCart, bool addToCart, - StoreProduct product, String mainUnit, String clickedUnit) { + StoreProduct product, String mainUnit, int value, String clickedUnit) { double p, q; // Kg, Kgs, Gms, Pc - Types of Quantities @@ -26,10 +26,18 @@ class HelperFunctions { // For Kg & Pc for (var i in product.details[0].quantity.allowedQuantities) { - if (i.metric == clickedUnit && !clickedUnit.contains(mainUnit)) { + print(i); + print(i.metric); + print(clickedUnit); + print(mainUnit); + if (i.metric == clickedUnit && + !clickedUnit.contains(mainUnit) && + i.value == value) { q = 1 * (i.value) / 1000.0; p = q * double.parse("${product.details[0].price}"); - } else if (i.metric.contains(clickedUnit)) { + break; + } else if (i.metric.contains(clickedUnit) && + clickedUnit.contains(mainUnit)) { q = double.parse("${i.value}" * 1); p = q * double.parse("${product.details[0].price}"); break; diff --git a/lib/screens/productsNew/details.dart b/lib/screens/productsNew/details.dart index 2a6a85f..69f359b 100644 --- a/lib/screens/productsNew/details.dart +++ b/lib/screens/productsNew/details.dart @@ -143,6 +143,8 @@ class _ProductDetailsState extends State { false, widget.p, widget.p.details[0].quantity.quantityMetric, + widget + .p.details[0].quantity.allowedQuantities[index].value, widget.p.details[0].quantity.allowedQuantities[index] .metric); }, @@ -164,6 +166,8 @@ class _ProductDetailsState extends State { true, widget.p, widget.p.details[0].quantity.quantityMetric, + widget + .p.details[0].quantity.allowedQuantities[index].value, widget.p.details[0].quantity.allowedQuantities[index] .metric); }, From ddf34313bc0064ebf6ef1a7787e3a4850babb799 Mon Sep 17 00:00:00 2001 From: Rajat012k Date: Thu, 22 Oct 2020 22:06:57 +0530 Subject: [PATCH 10/23] more files added --- lib/screens/landing/mainLanding.dart | 4 ++-- lib/screens/productsNew/newUI.dart | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/screens/landing/mainLanding.dart b/lib/screens/landing/mainLanding.dart index 665b8c0..892b9cc 100644 --- a/lib/screens/landing/mainLanding.dart +++ b/lib/screens/landing/mainLanding.dart @@ -489,8 +489,8 @@ class _MainLandingScreenState extends State { child: Text( state.msg, style: TextStyle( - color: Colors.red, - fontSize: 3 * SizeConfig.textMultiplier), + color: ThemeColoursSeva().dkGreen, + fontSize: 2.2 * SizeConfig.textMultiplier), )); } else return Container( diff --git a/lib/screens/productsNew/newUI.dart b/lib/screens/productsNew/newUI.dart index a36956c..3eb0cd5 100644 --- a/lib/screens/productsNew/newUI.dart +++ b/lib/screens/productsNew/newUI.dart @@ -376,7 +376,13 @@ class _ProductsUINewState extends State { }).toList(), ); } else if (state is ProductsapiError) { - return Text(state.msg); + return Center( + child: Text( + state.msg, + style: TextStyle( + color: ThemeColoursSeva().dkGreen, + fontSize: 2.2 * SizeConfig.textMultiplier), + )); } else return CircularProgressIndicator(); }, From e0ccd42bd7803fabfd76485fddb8e028944aeec2 Mon Sep 17 00:00:00 2001 From: Vikas Prashar Date: Fri, 23 Oct 2020 09:50:17 +0530 Subject: [PATCH 11/23] removed switch case --- lib/screens/productsNew/newUI.dart | 41 +++++++----------------------- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/lib/screens/productsNew/newUI.dart b/lib/screens/productsNew/newUI.dart index f0b6f41..c690eb1 100644 --- a/lib/screens/productsNew/newUI.dart +++ b/lib/screens/productsNew/newUI.dart @@ -22,14 +22,14 @@ import 'package:shimmer/shimmer.dart'; class Category { final String name; - final String resname; + final String categoryname; Color backgroundColor; Color textColor; final bool hasData; Category( {@required this.name, - this.resname, + @required this.categoryname, @required this.backgroundColor, @required this.textColor, @required this.hasData}); @@ -69,18 +69,7 @@ class _ProductsUINewState extends State { apiBloc = BlocProvider.of(context); catArray[tag].backgroundColor = ThemeColoursSeva().vlgGreen; catArray[tag].textColor = Colors.white; - switch (tag) { - case 0: - apiBloc.add(GetProducts(type: catArray[tag].resname)); - break; - case 1: - apiBloc.add(GetProducts(type: catArray[tag].resname)); - break; - case 2: - apiBloc.add(GetProducts(type: catArray[tag].resname)); - break; - default: - } + apiBloc.add(GetProducts(type: catArray[tag].categoryname)); } @override @@ -111,24 +100,25 @@ class _ProductsUINewState extends State { void makeArray() { final a = Category( name: "Vegetables", - resname: "vegetable", + categoryname: "vegetable", backgroundColor: Colors.white, textColor: ThemeColoursSeva().pallete1, hasData: true); final b = Category( name: "Fruits", - resname: "fruit", + categoryname: "fruit", backgroundColor: Colors.white, textColor: ThemeColoursSeva().pallete1, hasData: true); final c = Category( name: "Milk, Eggs & Bread", - resname: "dailyEssential", + categoryname: "dailyEssential", backgroundColor: Colors.white, textColor: ThemeColoursSeva().pallete1, hasData: true); final d = Category( name: "More Coming soon!", + categoryname: "", backgroundColor: Colors.white, textColor: ThemeColoursSeva().pallete1, hasData: false); @@ -330,21 +320,8 @@ class _ProductsUINewState extends State { } } }); - switch (index) { - case 0: - apiBloc.add(GetProducts( - type: catArray[index].resname)); - break; - case 1: - apiBloc.add(GetProducts( - type: catArray[index].resname)); - break; - case 2: - apiBloc.add(GetProducts( - type: catArray[index].resname)); - break; - default: - } + apiBloc.add(GetProducts( + type: catArray[index].categoryname)); } }, ), From d66364e33f42e8df63251acb0e12b51b2995fc36 Mon Sep 17 00:00:00 2001 From: Vikas Prashar Date: Sun, 25 Oct 2020 07:42:06 +0530 Subject: [PATCH 12/23] camel case var --- lib/screens/productsNew/newUI.dart | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/screens/productsNew/newUI.dart b/lib/screens/productsNew/newUI.dart index c690eb1..fc25499 100644 --- a/lib/screens/productsNew/newUI.dart +++ b/lib/screens/productsNew/newUI.dart @@ -22,14 +22,14 @@ import 'package:shimmer/shimmer.dart'; class Category { final String name; - final String categoryname; + final String categoryName; Color backgroundColor; Color textColor; final bool hasData; Category( {@required this.name, - @required this.categoryname, + @required this.categoryName, @required this.backgroundColor, @required this.textColor, @required this.hasData}); @@ -69,7 +69,7 @@ class _ProductsUINewState extends State { apiBloc = BlocProvider.of(context); catArray[tag].backgroundColor = ThemeColoursSeva().vlgGreen; catArray[tag].textColor = Colors.white; - apiBloc.add(GetProducts(type: catArray[tag].categoryname)); + apiBloc.add(GetProducts(type: catArray[tag].categoryName)); } @override @@ -100,25 +100,25 @@ class _ProductsUINewState extends State { void makeArray() { final a = Category( name: "Vegetables", - categoryname: "vegetable", + categoryName: "vegetable", backgroundColor: Colors.white, textColor: ThemeColoursSeva().pallete1, hasData: true); final b = Category( name: "Fruits", - categoryname: "fruit", + categoryName: "fruit", backgroundColor: Colors.white, textColor: ThemeColoursSeva().pallete1, hasData: true); final c = Category( name: "Milk, Eggs & Bread", - categoryname: "dailyEssential", + categoryName: "dailyEssential", backgroundColor: Colors.white, textColor: ThemeColoursSeva().pallete1, hasData: true); final d = Category( name: "More Coming soon!", - categoryname: "", + categoryName: "", backgroundColor: Colors.white, textColor: ThemeColoursSeva().pallete1, hasData: false); @@ -321,7 +321,7 @@ class _ProductsUINewState extends State { } }); apiBloc.add(GetProducts( - type: catArray[index].categoryname)); + type: catArray[index].categoryName)); } }, ), From 9f38c0211af3efdcf2db842b609efb57f96a1ac7 Mon Sep 17 00:00:00 2001 From: Vikas Prashar Date: Sun, 25 Oct 2020 07:56:21 +0530 Subject: [PATCH 13/23] removed scroll main landing --- lib/screens/landing/mainLanding.dart | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/screens/landing/mainLanding.dart b/lib/screens/landing/mainLanding.dart index 748d9a9..1bd409f 100644 --- a/lib/screens/landing/mainLanding.dart +++ b/lib/screens/landing/mainLanding.dart @@ -287,8 +287,7 @@ class _MainLandingScreenState extends State { child: SafeArea( child: SmartRefresher( enablePullDown: true, - enablePullUp: true, - // header: WaterDropHeader(), + // enablePullUp: true, footer: CustomFooter( builder: (BuildContext context, LoadStatus mode) { if (mode == LoadStatus.loading) { @@ -332,11 +331,10 @@ class _MainLandingScreenState extends State { texts, (index, item) => Builder( builder: (BuildContext context) { - return FeaturedCards( - textToDisplay: item, - index: index, - referralCode:_referralCode - ); + return FeaturedCards( + textToDisplay: item, + index: index, + referralCode: _referralCode); }, )).toList(), options: CarouselOptions( From bba938a2d7dec1a148f3347f8693934bc1064afe Mon Sep 17 00:00:00 2001 From: Vikas Prashar Date: Sun, 25 Oct 2020 08:03:58 +0530 Subject: [PATCH 14/23] orders font responsive --- lib/screens/orders/ordersScreen.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/screens/orders/ordersScreen.dart b/lib/screens/orders/ordersScreen.dart index d573d71..3f59985 100644 --- a/lib/screens/orders/ordersScreen.dart +++ b/lib/screens/orders/ordersScreen.dart @@ -17,6 +17,7 @@ import 'package:mvp/constants/themeColours.dart'; import 'package:mvp/models/ordersModel.dart'; import 'package:mvp/screens/orders/orderCards.dart'; import 'package:http/http.dart' as http; +import 'package:mvp/sizeconfig/sizeconfig.dart'; import 'package:shimmer/shimmer.dart'; class NewOrdersScreen extends StatefulWidget { @@ -99,7 +100,7 @@ class _NewOrdersScreenState extends State { "My Orders", style: TextStyle( color: ThemeColoursSeva().dkGreen, - fontSize: 25.0, + fontSize: 3.30 * SizeConfig.textMultiplier, fontWeight: FontWeight.w500), ), Container( From 170b44db8a042512222e3809dd6edbaf634259e4 Mon Sep 17 00:00:00 2001 From: Vikas Prashar Date: Sun, 25 Oct 2020 08:05:33 +0530 Subject: [PATCH 15/23] removed enabled pull down --- lib/screens/productsNew/newUI.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/screens/productsNew/newUI.dart b/lib/screens/productsNew/newUI.dart index 6e55f03..bf75af8 100644 --- a/lib/screens/productsNew/newUI.dart +++ b/lib/screens/productsNew/newUI.dart @@ -404,7 +404,6 @@ class _ProductsUINewState extends State { // enclosed gridview in refresher return SmartRefresher( enablePullDown: true, - enablePullUp: true, footer: CustomFooter( builder: (BuildContext context, LoadStatus mode) { if (mode == LoadStatus.loading) { From 7edea5d5ac96d7b020319046c27886108d41c846 Mon Sep 17 00:00:00 2001 From: Vikas Prashar Date: Sun, 25 Oct 2020 08:07:38 +0530 Subject: [PATCH 16/23] updated font size and text --- lib/screens/orders/ordersScreen.dart | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/screens/orders/ordersScreen.dart b/lib/screens/orders/ordersScreen.dart index 3f59985..c62a556 100644 --- a/lib/screens/orders/ordersScreen.dart +++ b/lib/screens/orders/ordersScreen.dart @@ -86,21 +86,19 @@ class _NewOrdersScreenState extends State { backgroundColor: Colors.transparent, elevation: 0.0, leading: IconButton( - icon: Icon(Icons.arrow_back_ios), - onPressed: () { - Navigator.pop(context); - }, - iconSize: 27.0, - color: Colors.black, + icon: Icon( + Icons.arrow_back, + color: Colors.black54, + ), + onPressed: () => Navigator.of(context).pop(), ), title: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text( + Text( "My Orders", style: TextStyle( - color: ThemeColoursSeva().dkGreen, - fontSize: 3.30 * SizeConfig.textMultiplier, + color: ThemeColoursSeva().pallete1, fontWeight: FontWeight.w500), ), Container( From 60c71ec5b4fc15e53fc83200fc2699ea3576238a Mon Sep 17 00:00:00 2001 From: Vikas Date: Sun, 25 Oct 2020 09:57:37 +0530 Subject: [PATCH 17/23] Update common_functions.dart --- lib/screens/common/common_functions.dart | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/screens/common/common_functions.dart b/lib/screens/common/common_functions.dart index e476839..0d21316 100644 --- a/lib/screens/common/common_functions.dart +++ b/lib/screens/common/common_functions.dart @@ -26,10 +26,6 @@ class HelperFunctions { // For Kg & Pc for (var i in product.details[0].quantity.allowedQuantities) { - print(i); - print(i.metric); - print(clickedUnit); - print(mainUnit); if (i.metric == clickedUnit && !clickedUnit.contains(mainUnit) && i.value == value) { From bbf0d7f2fd66ca7f9d5969843ff78109181a2bea Mon Sep 17 00:00:00 2001 From: Vikas Prashar Date: Sun, 25 Oct 2020 10:11:51 +0530 Subject: [PATCH 18/23] updated shopping cart appbar --- lib/screens/shoppingCart/shoppingCartNew.dart | 123 +++++++++--------- 1 file changed, 60 insertions(+), 63 deletions(-) diff --git a/lib/screens/shoppingCart/shoppingCartNew.dart b/lib/screens/shoppingCart/shoppingCartNew.dart index 8e6c7d2..1aea22d 100644 --- a/lib/screens/shoppingCart/shoppingCartNew.dart +++ b/lib/screens/shoppingCart/shoppingCartNew.dart @@ -371,73 +371,70 @@ class _ShoppingCartNewState extends State { return Scaffold( backgroundColor: Colors.white, body: SafeArea( - child: Column( - children: [ - SizedBox(height: 20), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - IconButton( - icon: Icon( - Icons.arrow_back_ios, - size: 25.0, - color: ThemeColoursSeva().dkGreen, - ), - onPressed: () { - Navigator.pop(context); - }, - ), - Text( - "My Shopping Cart", - style: TextStyle( - color: ThemeColoursSeva().dkGreen, - fontSize: 20, - fontWeight: FontWeight.w600), - ), - returnIconOrContainer(cart), - ], + child: Scaffold( + appBar: AppBar( + title: Text( + "My Shopping Cart", + style: TextStyle( + color: ThemeColoursSeva().pallete1, + fontWeight: FontWeight.w500), ), - SizedBox( - height: 20, + backgroundColor: Colors.transparent, + centerTitle: true, + elevation: 0.0, + leading: IconButton( + icon: Icon( + Icons.arrow_back, + color: Colors.black54, + ), + onPressed: () => Navigator.of(context).pop(), ), - Consumer( - builder: (context, newCart, child) { - if (newCart.totalItems == 0) { - return Center( - child: Text( - "No items in your cart!", - style: TextStyle( - color: ThemeColoursSeva().pallete1, - fontSize: 20.0, - fontWeight: FontWeight.w600), + actions: [returnIconOrContainer(cart)], + ), + body: Column( + children: [ + SizedBox( + height: 20, + ), + Consumer( + builder: (context, newCart, child) { + if (newCart.totalItems == 0) { + return Center( + child: Text( + "No items in your cart!", + style: TextStyle( + color: ThemeColoursSeva().pallete1, + fontSize: 20.0, + fontWeight: FontWeight.w600), + ), + ); + } + return Expanded( + child: StaggeredGridView.countBuilder( + crossAxisCount: 4, + itemCount: newCart.totalItems, + staggeredTileBuilder: (int index) => StaggeredTile.fit(2), + mainAxisSpacing: 10.0, + crossAxisSpacing: 0.0, + itemBuilder: (BuildContext categories, int index) { + return Row( + children: [ + SizedBox(width: 12.0), + Expanded( + child: AnimatedCard( + shopping: true, + product: newCart.items[index], + )), + SizedBox(width: 9.0) + ], + ); + }, ), ); - } - return Expanded( - child: StaggeredGridView.countBuilder( - crossAxisCount: 4, - itemCount: newCart.totalItems, - staggeredTileBuilder: (int index) => StaggeredTile.fit(2), - mainAxisSpacing: 10.0, - crossAxisSpacing: 0.0, - itemBuilder: (BuildContext categories, int index) { - return Row( - children: [ - SizedBox(width: 12.0), - Expanded( - child: AnimatedCard( - shopping: true, - product: newCart.items[index], - )), - SizedBox(width: 9.0) - ], - ); - }, - ), - ); - }, - ), - ], + }, + ), + ], + ), ), ), floatingActionButton: cart.totalItems > 0 && _allowedDeliveries From fe3c1e9142e878517b0980f7f5ed3987274fe066 Mon Sep 17 00:00:00 2001 From: Vikas Prashar Date: Sun, 25 Oct 2020 10:16:03 +0530 Subject: [PATCH 19/23] added comments --- lib/screens/common/customappBar.dart | 10 ++++++++++ lib/screens/landing/mainLanding.dart | 1 - lib/screens/orders/ordersScreen.dart | 5 ++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/screens/common/customappBar.dart b/lib/screens/common/customappBar.dart index dd5576f..040eb9e 100644 --- a/lib/screens/common/customappBar.dart +++ b/lib/screens/common/customappBar.dart @@ -1,3 +1,13 @@ +// Copyright 2020 SEVA AUTHORS. All Rights Reserved. +// +// (change the version and the date whenver anyone worked upon this file) +// Version-0.5.2 +// Date-{02-10-2020} +/// +/// @fileoverview Custom Appbar : Customized Appbar used in Main Landing +/// files. +/// + import 'dart:convert'; import 'package:http/http.dart' as http; diff --git a/lib/screens/landing/mainLanding.dart b/lib/screens/landing/mainLanding.dart index 1bd409f..c09c04f 100644 --- a/lib/screens/landing/mainLanding.dart +++ b/lib/screens/landing/mainLanding.dart @@ -18,7 +18,6 @@ import 'package:mvp/screens/common/common_functions.dart'; import 'package:mvp/screens/common/customappBar.dart'; import 'package:mvp/screens/common/sidenavbar.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; -import 'package:share/share.dart'; import 'package:carousel_slider/carousel_slider.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:http/http.dart' as http; diff --git a/lib/screens/orders/ordersScreen.dart b/lib/screens/orders/ordersScreen.dart index c62a556..2e9e47d 100644 --- a/lib/screens/orders/ordersScreen.dart +++ b/lib/screens/orders/ordersScreen.dart @@ -5,7 +5,7 @@ // Date-{02-09-2020} /// -/// @fileoverview OrderScreen Widget : . +/// @fileoverview OrderScreen Widget : /// import 'dart:async'; @@ -17,7 +17,6 @@ import 'package:mvp/constants/themeColours.dart'; import 'package:mvp/models/ordersModel.dart'; import 'package:mvp/screens/orders/orderCards.dart'; import 'package:http/http.dart' as http; -import 'package:mvp/sizeconfig/sizeconfig.dart'; import 'package:shimmer/shimmer.dart'; class NewOrdersScreen extends StatefulWidget { @@ -95,7 +94,7 @@ class _NewOrdersScreenState extends State { title: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text( + Text( "My Orders", style: TextStyle( color: ThemeColoursSeva().pallete1, From c6dbdbfd711051a42f2f08602582b4eb83b43ddd Mon Sep 17 00:00:00 2001 From: Vikas Prashar Date: Sun, 25 Oct 2020 10:17:30 +0530 Subject: [PATCH 20/23] comments --- lib/screens/common/cartIcon.dart | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/screens/common/cartIcon.dart b/lib/screens/common/cartIcon.dart index 9dbeb67..0cc88f8 100644 --- a/lib/screens/common/cartIcon.dart +++ b/lib/screens/common/cartIcon.dart @@ -1,3 +1,13 @@ +// Copyright 2020 SEVA AUTHORS. All Rights Reserved. +// +// (change the version and the date whenver anyone worked upon this file) +// Version-0.5.2 +// Date-{02-10-2020} +/// +/// @fileoverview common cart icon : used in multiple pags +/// files. +/// + import 'package:flutter/material.dart'; import 'package:mvp/constants/themeColours.dart'; import 'package:mvp/models/newCart.dart'; From 4e7d92cb25df5c6c5f6dc77881c2610357abc0be Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Sun, 25 Oct 2020 10:49:53 +0530 Subject: [PATCH 21/23] groceries section --- lib/screens/productsNew/newUI.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/screens/productsNew/newUI.dart b/lib/screens/productsNew/newUI.dart index c690eb1..5d4acc9 100644 --- a/lib/screens/productsNew/newUI.dart +++ b/lib/screens/productsNew/newUI.dart @@ -117,6 +117,12 @@ class _ProductsUINewState extends State { textColor: ThemeColoursSeva().pallete1, hasData: true); final d = Category( + name: "Groceries", + categoryname: "groceries", + backgroundColor: Colors.white, + textColor: ThemeColoursSeva().pallete1, + hasData: true); + final e = Category( name: "More Coming soon!", categoryname: "", backgroundColor: Colors.white, @@ -126,6 +132,7 @@ class _ProductsUINewState extends State { catArray.add(b); catArray.add(c); catArray.add(d); + catArray.add(e); } // shimmer layout before page loads @@ -302,7 +309,7 @@ class _ProductsUINewState extends State { /// This [if] condition exists because we have only 3 types /// of categories in the DB, as we add them up, this should be /// dynamic, for now it is static - if (index < 3) { + if (index < catArray.length-1) { setState(() { tag = index; for (int i = 0; From d33bed02f01783c9c814e9948a9ee9cb140f26c2 Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Sun, 25 Oct 2020 10:57:03 +0530 Subject: [PATCH 22/23] remove import --- lib/screens/landing/mainLanding.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/screens/landing/mainLanding.dart b/lib/screens/landing/mainLanding.dart index 13e2b79..8f2c11c 100644 --- a/lib/screens/landing/mainLanding.dart +++ b/lib/screens/landing/mainLanding.dart @@ -18,7 +18,6 @@ import 'package:mvp/domain/bestsellers_repository.dart'; import 'package:mvp/screens/common/cartIcon.dart'; import 'package:mvp/screens/common/common_functions.dart'; import 'package:mvp/screens/common/sidenavbar.dart'; -import 'package:share/share.dart'; import 'package:carousel_slider/carousel_slider.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:http/http.dart' as http; From 78528a2e6e9a7f5c63150e6d481f4c5f1b667693 Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Sun, 25 Oct 2020 11:18:33 +0530 Subject: [PATCH 23/23] for 0.5.2+3 --- lib/bloc/productsapi_event.dart | 1 - lib/screens/common/sidenavbar.dart | 6 +++--- lib/screens/landing/common/featuredCards.dart | 6 +++--- lib/screens/productsNew/newUI.dart | 2 +- pubspec.yaml | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/bloc/productsapi_event.dart b/lib/bloc/productsapi_event.dart index a73fac1..45dc726 100644 --- a/lib/bloc/productsapi_event.dart +++ b/lib/bloc/productsapi_event.dart @@ -7,4 +7,3 @@ class GetProducts extends ProductsapiEvent { final String type; GetProducts({@required this.type}) : assert(type != null); } - diff --git a/lib/screens/common/sidenavbar.dart b/lib/screens/common/sidenavbar.dart index ba6dff6..8c80811 100644 --- a/lib/screens/common/sidenavbar.dart +++ b/lib/screens/common/sidenavbar.dart @@ -27,7 +27,7 @@ class Sidenav extends StatelessWidget { /// show referral instructions with an /// Alert dialog - showReferralInstructions(context,referralCode) { + showReferralInstructions(context, referralCode) { showDialog( context: context, builder: (context) { @@ -228,7 +228,7 @@ class Sidenav extends StatelessWidget { style: TextStyle(fontSize: SizeConfig.widthMultiplier * 3.65), ), onTap: () { - showReferralInstructions(context,referralCode); + showReferralInstructions(context, referralCode); }, ), ListTile( @@ -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+2"), + subtitle: Text("0.5.2+3"), onTap: null, ), ), diff --git a/lib/screens/landing/common/featuredCards.dart b/lib/screens/landing/common/featuredCards.dart index 3a7f96c..6a5edc9 100644 --- a/lib/screens/landing/common/featuredCards.dart +++ b/lib/screens/landing/common/featuredCards.dart @@ -15,16 +15,16 @@ import 'package:mvp/sizeconfig/sizeconfig.dart'; typedef ShowDialog = void Function(); -class FeaturedCards extends StatelessWidget { +class FeaturedCards extends StatelessWidget { final String textToDisplay; final int index; final String referralCode; // final ShowDialog showInstructions; - FeaturedCards({this.textToDisplay, this.index,this.referralCode}); + FeaturedCards({this.textToDisplay, this.index, this.referralCode}); // referral dialog showInstructions(context) { - Sidenav().showReferralInstructions(context,referralCode); + Sidenav().showReferralInstructions(context, referralCode); } @override diff --git a/lib/screens/productsNew/newUI.dart b/lib/screens/productsNew/newUI.dart index 76412ab..f0f4b4d 100644 --- a/lib/screens/productsNew/newUI.dart +++ b/lib/screens/productsNew/newUI.dart @@ -333,7 +333,7 @@ class _ProductsUINewState extends State { /// This [if] condition exists because we have only 3 types /// of categories in the DB, as we add them up, this should be /// dynamic, for now it is static - if (index < catArray.length-1) { + if (index < catArray.length - 1) { setState(() { tag = index; for (int i = 0; diff --git a/pubspec.yaml b/pubspec.yaml index 8d23cce..39852e4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.0+19 +version: 1.0.0+20 environment: sdk: ">=2.7.0 <3.0.0"