From 6e4b51b6424b236be40fc15510f01627a7a32f50 Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Mon, 26 Oct 2020 11:25:07 +0530 Subject: [PATCH 01/26] added data --- lib/static-data/categories.json | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 lib/static-data/categories.json diff --git a/lib/static-data/categories.json b/lib/static-data/categories.json new file mode 100644 index 0000000..ab97f76 --- /dev/null +++ b/lib/static-data/categories.json @@ -0,0 +1,27 @@ +[ + { + "name":"Vegetables", + "categoryName":"vegetable", + "hasData":true + }, + { + "name":"Fruits", + "categoryName":"fruit", + "hasData":true + }, + { + "name":"Milk, Eggs & Bread", + "categoryName":"dailyEssential", + "hasData":true + }, + { + "name":"Groceries", + "categoryName":"groceries", + "hasData":true + }, + { + "name":"More Coming Soon!", + "categoryName":"", + "hasData":false + } +] \ No newline at end of file From 820c63d5c10dcaaaa56d6a1b85f1a86e2e896d15 Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Mon, 26 Oct 2020 11:27:39 +0530 Subject: [PATCH 02/26] category model --- lib/models/categories.dart | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 lib/models/categories.dart diff --git a/lib/models/categories.dart b/lib/models/categories.dart new file mode 100644 index 0000000..6a1f990 --- /dev/null +++ b/lib/models/categories.dart @@ -0,0 +1,29 @@ +import 'dart:convert'; + +List jsonToCategory(String str) => List.from(json.decode(str).map((x) => CategoryJSON.fromJson(x))); + +String categoryToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); + +class CategoryJSON { + CategoryJSON({ + this.name, + this.categoryName, + this.hasData, + }); + + String name; + String categoryName; + bool hasData; + + factory CategoryJSON.fromJson(Map json) => CategoryJSON( + name: json["name"], + categoryName: json["categoryName"], + hasData: json["hasData"], + ); + + Map toJson() => { + "name": name, + "categoryName": categoryName, + "hasData": hasData, + }; +} From 38fadfc3481a093afaabd4d39ec0fea6cf7eb457 Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Mon, 26 Oct 2020 11:32:29 +0530 Subject: [PATCH 03/26] class setup --- lib/models/categories.dart | 39 ++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/lib/models/categories.dart b/lib/models/categories.dart index 6a1f990..8a4cde4 100644 --- a/lib/models/categories.dart +++ b/lib/models/categories.dart @@ -1,29 +1,40 @@ import 'dart:convert'; +import 'dart:ui'; -List jsonToCategory(String str) => List.from(json.decode(str).map((x) => CategoryJSON.fromJson(x))); +import 'package:flutter/material.dart'; +import 'package:mvp/constants/themeColours.dart'; -String categoryToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); +List jsonToCategory(String str) => List.from( + json.decode(str).map((x) => CategoryJSON.fromJson(x))); + +String categoryToJson(List data) => + json.encode(List.from(data.map((x) => x.toJson()))); class CategoryJSON { - CategoryJSON({ - this.name, - this.categoryName, - this.hasData, - }); + CategoryJSON( + {this.name, + this.categoryName, + this.hasData, + this.backgroundColor = Colors.white, + this.textColor}) { + this.textColor = ThemeColoursSeva().pallete1; + } - String name; - String categoryName; - bool hasData; + String name; + String categoryName; + bool hasData; + Color backgroundColor; + Color textColor; - factory CategoryJSON.fromJson(Map json) => CategoryJSON( + factory CategoryJSON.fromJson(Map json) => CategoryJSON( name: json["name"], categoryName: json["categoryName"], hasData: json["hasData"], - ); + ); - Map toJson() => { + Map toJson() => { "name": name, "categoryName": categoryName, "hasData": hasData, - }; + }; } From 16369760529d485bcdce6a522f2219791f30d1fa Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Mon, 26 Oct 2020 14:27:49 +0530 Subject: [PATCH 04/26] category model & data --- lib/models/categories.dart | 40 -------------------- lib/models/category.dart | 19 ++++++++++ lib/screens/productsNew/newUI.dart | 61 +----------------------------- lib/static-data/categories.dart | 30 +++++++++++++++ lib/static-data/categories.json | 27 ------------- 5 files changed, 51 insertions(+), 126 deletions(-) delete mode 100644 lib/models/categories.dart create mode 100644 lib/models/category.dart create mode 100644 lib/static-data/categories.dart delete mode 100644 lib/static-data/categories.json diff --git a/lib/models/categories.dart b/lib/models/categories.dart deleted file mode 100644 index 8a4cde4..0000000 --- a/lib/models/categories.dart +++ /dev/null @@ -1,40 +0,0 @@ -import 'dart:convert'; -import 'dart:ui'; - -import 'package:flutter/material.dart'; -import 'package:mvp/constants/themeColours.dart'; - -List jsonToCategory(String str) => List.from( - json.decode(str).map((x) => CategoryJSON.fromJson(x))); - -String categoryToJson(List data) => - json.encode(List.from(data.map((x) => x.toJson()))); - -class CategoryJSON { - CategoryJSON( - {this.name, - this.categoryName, - this.hasData, - this.backgroundColor = Colors.white, - this.textColor}) { - this.textColor = ThemeColoursSeva().pallete1; - } - - String name; - String categoryName; - bool hasData; - Color backgroundColor; - Color textColor; - - factory CategoryJSON.fromJson(Map json) => CategoryJSON( - name: json["name"], - categoryName: json["categoryName"], - hasData: json["hasData"], - ); - - Map toJson() => { - "name": name, - "categoryName": categoryName, - "hasData": hasData, - }; -} diff --git a/lib/models/category.dart b/lib/models/category.dart new file mode 100644 index 0000000..6ea81a4 --- /dev/null +++ b/lib/models/category.dart @@ -0,0 +1,19 @@ +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; + + Category( + {@required this.name, + @required this.categoryName, + @required this.backgroundColor, + this.textColor, + @required this.hasData}) { + this.textColor = ThemeColoursSeva().pallete1; + } +} \ No newline at end of file diff --git a/lib/screens/productsNew/newUI.dart b/lib/screens/productsNew/newUI.dart index f0f4b4d..e79bbe4 100644 --- a/lib/screens/productsNew/newUI.dart +++ b/lib/screens/productsNew/newUI.dart @@ -7,6 +7,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'; @@ -19,25 +20,11 @@ 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:mvp/static-data/categories.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; // import 'package:provider/provider.dart'; import 'package:shimmer/shimmer.dart'; -class Category { - final String name; - final String categoryName; - Color backgroundColor; - Color textColor; - final bool hasData; - - Category( - {@required this.name, - @required this.categoryName, - @required this.backgroundColor, - @required this.textColor, - @required this.hasData}); -} - class ProductsUINew extends StatefulWidget { final int tagFromMain; ProductsUINew({this.tagFromMain}); @@ -52,7 +39,6 @@ class _ProductsUINewState extends State { // will receive from server /// This Array is populated by the ListView Builder to show on /// the left side of the screen (1st row) - final List catArray = []; String category; /// This tag will be used for 2 things mainly - @@ -78,7 +64,6 @@ class _ProductsUINewState extends State { @override initState() { super.initState(); - makeArray(); /// Intialize it to 0 - by default to get Vegetables /// as it is on the first List Tile @@ -117,48 +102,6 @@ class _ProductsUINewState extends State { _refreshController.loadComplete(); } - /// UTIL func - /// Makes the array - /// - /// This array needs to be populated by the server - void makeArray() { - final a = Category( - name: "Vegetables", - categoryName: "vegetable", - backgroundColor: Colors.white, - textColor: ThemeColoursSeva().pallete1, - hasData: true); - final b = Category( - name: "Fruits", - categoryName: "fruit", - backgroundColor: Colors.white, - textColor: ThemeColoursSeva().pallete1, - hasData: true); - final c = Category( - name: "Milk, Eggs & Bread", - categoryName: "dailyEssential", - backgroundColor: Colors.white, - 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, - textColor: ThemeColoursSeva().pallete1, - hasData: false); - catArray.add(a); - catArray.add(b); - catArray.add(c); - catArray.add(d); - catArray.add(e); - } - // shimmer layout before page loads _shimmerLayout() { var array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; diff --git a/lib/static-data/categories.dart b/lib/static-data/categories.dart new file mode 100644 index 0000000..22a0634 --- /dev/null +++ b/lib/static-data/categories.dart @@ -0,0 +1,30 @@ +import 'package:flutter/material.dart'; +import 'package:mvp/models/category.dart'; + +final List catArray = [ + Category( + name: "Vegetables", + categoryName: "vegetable", + backgroundColor: Colors.white, + hasData: true), + Category( + name: "Fruits", + categoryName: "fruit", + backgroundColor: Colors.white, + hasData: true), + Category( + name: "Milk, Eggs & Bread", + categoryName: "dailyEssential", + backgroundColor: Colors.white, + hasData: true), + Category( + name: "Groceries", + categoryName: "groceries", + backgroundColor: Colors.white, + hasData: true), + Category( + name: "More Coming soon!", + categoryName: "", + backgroundColor: Colors.white, + hasData: false) +]; diff --git a/lib/static-data/categories.json b/lib/static-data/categories.json deleted file mode 100644 index ab97f76..0000000 --- a/lib/static-data/categories.json +++ /dev/null @@ -1,27 +0,0 @@ -[ - { - "name":"Vegetables", - "categoryName":"vegetable", - "hasData":true - }, - { - "name":"Fruits", - "categoryName":"fruit", - "hasData":true - }, - { - "name":"Milk, Eggs & Bread", - "categoryName":"dailyEssential", - "hasData":true - }, - { - "name":"Groceries", - "categoryName":"groceries", - "hasData":true - }, - { - "name":"More Coming Soon!", - "categoryName":"", - "hasData":false - } -] \ No newline at end of file From f726167d4a109da80d3664582750d5abf99c9f55 Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Mon, 26 Oct 2020 14:30:29 +0530 Subject: [PATCH 05/26] optimize --- lib/models/category.dart | 4 ++-- lib/screens/productsNew/newUI.dart | 1 - lib/static-data/categories.dart | 26 ++++---------------------- 3 files changed, 6 insertions(+), 25 deletions(-) diff --git a/lib/models/category.dart b/lib/models/category.dart index 6ea81a4..3b01978 100644 --- a/lib/models/category.dart +++ b/lib/models/category.dart @@ -11,9 +11,9 @@ class Category { Category( {@required this.name, @required this.categoryName, - @required this.backgroundColor, + this.backgroundColor = Colors.white, this.textColor, @required this.hasData}) { this.textColor = ThemeColoursSeva().pallete1; } -} \ No newline at end of file +} diff --git a/lib/screens/productsNew/newUI.dart b/lib/screens/productsNew/newUI.dart index e79bbe4..f9e8883 100644 --- a/lib/screens/productsNew/newUI.dart +++ b/lib/screens/productsNew/newUI.dart @@ -22,7 +22,6 @@ import 'package:mvp/screens/productsNew/details.dart'; import 'package:mvp/sizeconfig/sizeconfig.dart'; import 'package:mvp/static-data/categories.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; -// import 'package:provider/provider.dart'; import 'package:shimmer/shimmer.dart'; class ProductsUINew extends StatefulWidget { diff --git a/lib/static-data/categories.dart b/lib/static-data/categories.dart index 22a0634..74ef83b 100644 --- a/lib/static-data/categories.dart +++ b/lib/static-data/categories.dart @@ -1,30 +1,12 @@ -import 'package:flutter/material.dart'; import 'package:mvp/models/category.dart'; final List catArray = [ - Category( - name: "Vegetables", - categoryName: "vegetable", - backgroundColor: Colors.white, - hasData: true), - Category( - name: "Fruits", - categoryName: "fruit", - backgroundColor: Colors.white, - hasData: true), + Category(name: "Vegetables", categoryName: "vegetable", hasData: true), + Category(name: "Fruits", categoryName: "fruit", hasData: true), Category( name: "Milk, Eggs & Bread", categoryName: "dailyEssential", - backgroundColor: Colors.white, hasData: true), - Category( - name: "Groceries", - categoryName: "groceries", - backgroundColor: Colors.white, - hasData: true), - Category( - name: "More Coming soon!", - categoryName: "", - backgroundColor: Colors.white, - hasData: false) + Category(name: "Groceries", categoryName: "groceries", hasData: true), + Category(name: "More Coming soon!", categoryName: "", hasData: false) ]; From 17dacf8cd774dbdfc4edbbb2bbdecd2066fb3913 Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Wed, 4 Nov 2020 13:36:17 +0530 Subject: [PATCH 06/26] remove unused import --- lib/screens/profile.dart | 271 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 271 insertions(+) create mode 100644 lib/screens/profile.dart diff --git a/lib/screens/profile.dart b/lib/screens/profile.dart new file mode 100644 index 0000000..aa48e91 --- /dev/null +++ b/lib/screens/profile.dart @@ -0,0 +1,271 @@ +import 'dart:convert'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:hive/hive.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:http/http.dart' as http; +import 'package:mvp/screens/orders/ordersScreen.dart'; +import 'package:mvp/sizeconfig/sizeconfig.dart'; + +class Profile extends StatefulWidget { + final String username; + final String mobile; + final String email; + Profile({this.username, this.mobile, this.email}); + @override + _ProfileState createState() => _ProfileState(); +} + +class _ProfileState extends State { + String _email; + + //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(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.pop(context); + Navigator.of(context).push(CupertinoPageRoute( + builder: (BuildContext context) { + return GoogleLocationScreen( + userEmail: _email, + ); + })); + }, + child: Text("Change"), + color: ThemeColoursSeva().pallete1, + textColor: Colors.white, + ); + } else + return Container(); + }, + ), + ], + ); + }, + ); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text( + "My Account", + style: TextStyle( + color: ThemeColoursSeva().pallete1, fontWeight: FontWeight.w500), + ), + backgroundColor: ThemeColoursSeva().pallete3, + centerTitle: true, + elevation: 1.0, + leading: IconButton( + icon: Icon( + Icons.arrow_back, + color: Colors.black54, + ), + onPressed: () => Navigator.of(context).pop(), + ), + actions: [CartIcon()], + ), + // This is for the scrolling effect + body: SingleChildScrollView( + child: Column( + children: [ + Container( + decoration: BoxDecoration(color: ThemeColoursSeva().pallete3), + height: 200, + child: Padding( + padding: const EdgeInsets.only(top: 8.0), + child: Center( + child: Column( + children: [ + Icon( + Icons.account_circle, + color: Colors.black54, + size: 70, + ), + SizedBox( + height: 10, + ), + Text( + widget.username, + style: TextStyle( + fontSize: 2.4 * SizeConfig.textMultiplier, + color: ThemeColoursSeva().pallete1), + ), + SizedBox( + height: 20, + ), + Text( + widget.mobile, + style: TextStyle( + fontSize: 2.1 * SizeConfig.textMultiplier, + color: ThemeColoursSeva().pallete1), + ), + SizedBox( + height: 10, + ), + Text( + widget.email, + style: TextStyle( + fontSize: 2.1 * SizeConfig.textMultiplier, + color: ThemeColoursSeva().pallete1), + ) + ], + )), + ), + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Card( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + const ListTile( + title: Text('My Orders'), + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + const SizedBox(width: 8), + TextButton( + child: const Text('VIEW ALL ORDERS'), + onPressed: () { + Navigator.of(context).push(CupertinoPageRoute( + builder: (BuildContext context) { + return NewOrdersScreen(); + })); + }, + ), + const SizedBox(width: 8), + ], + ), + ], + ), + ), + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Card( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + const ListTile( + title: Text('Location'), + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + const SizedBox(width: 8), + TextButton( + child: const Text('VIEW MY LOCATION'), + onPressed: () { + _showLocation(context); + }, + ), + const SizedBox(width: 8), + ], + ), + ], + ), + ), + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Card( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + ListTile( + title: Center( + child: TextButton( + child: const Text('Logout'), + onPressed: () async { + // clearing the data from hive + await Hive.deleteFromDisk(); + Navigator.of(context).pushNamedAndRemoveUntil( + '/login', (Route route) => false); + }, + + /* ... */ + ), + ), + ), + ], + ), + ), + ), + ], + ), + ), + ); + } +} From 10ae51da5c267546817e0d2fd9452608907571b2 Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Wed, 4 Nov 2020 13:41:17 +0530 Subject: [PATCH 07/26] add categories common --- lib/models/category.dart | 4 +++- lib/static-data/categories.dart | 22 +++++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/lib/models/category.dart b/lib/models/category.dart index 3b01978..0f0ce32 100644 --- a/lib/models/category.dart +++ b/lib/models/category.dart @@ -7,13 +7,15 @@ class Category { 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.hasData, + @required this.imgURL}) { this.textColor = ThemeColoursSeva().pallete1; } } diff --git a/lib/static-data/categories.dart b/lib/static-data/categories.dart index 74ef83b..803eef2 100644 --- a/lib/static-data/categories.dart +++ b/lib/static-data/categories.dart @@ -1,12 +1,24 @@ import 'package:mvp/models/category.dart'; final List catArray = [ - Category(name: "Vegetables", categoryName: "vegetable", hasData: true), - Category(name: "Fruits", categoryName: "fruit", hasData: true), + Category( + name: "Vegetables", + categoryName: "vegetable", + hasData: true, + imgURL: + "https://storepictures.theonestop.co.in/products/all-vegetables.jpg"), + Category( + name: "Fruits", + categoryName: "fruit", + hasData: true, + imgURL: "https://storepictures.theonestop.co.in/new2/AllFruits.jpg"), Category( name: "Milk, Eggs & Bread", categoryName: "dailyEssential", - hasData: true), - Category(name: "Groceries", categoryName: "groceries", hasData: true), - Category(name: "More Coming soon!", categoryName: "", hasData: false) + hasData: true, + imgURL: + "https://storepictures.theonestop.co.in/illustrations/supermarket.png"), + // Category(name: "Groceries", categoryName: "groceries", hasData: true), + Category( + name: "More Coming soon!", categoryName: "", hasData: false, imgURL: "") ]; From c6dbba882db172a3c5831f78040b791c0400e861 Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Wed, 4 Nov 2020 13:57:08 +0530 Subject: [PATCH 08/26] showCards change --- lib/screens/landing/common/showCards.dart | 10 +++--- lib/screens/landing/mainLanding.dart | 40 ++++++++++++----------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/lib/screens/landing/common/showCards.dart b/lib/screens/landing/common/showCards.dart index 65bf2b4..c509e78 100644 --- a/lib/screens/landing/common/showCards.dart +++ b/lib/screens/landing/common/showCards.dart @@ -12,6 +12,7 @@ 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'; @@ -19,9 +20,10 @@ 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(); @@ -93,12 +95,12 @@ class _ShowCardsState extends State { : 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, 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...")), errorWidget: (context, url, error) => Icon(Icons.error), @@ -119,7 +121,7 @@ class _ShowCardsState extends State { fontWeight: FontWeight.w700), ) : Text( - "${widget.sp.name}", + "${widget.cat.name}", overflow: TextOverflow.clip, style: TextStyle( color: ThemeColoursSeva().pallete1, diff --git a/lib/screens/landing/mainLanding.dart b/lib/screens/landing/mainLanding.dart index 3e5a7b2..c838b94 100644 --- a/lib/screens/landing/mainLanding.dart +++ b/lib/screens/landing/mainLanding.dart @@ -17,6 +17,7 @@ import 'package:mvp/domain/bestsellers_repository.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:mvp/static-data/categories.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:carousel_slider/carousel_slider.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; @@ -86,23 +87,23 @@ class _MainLandingScreenState extends State { initState() { super.initState(); // Populating the categories array - d = new StoreProduct( - name: "Vegetables", - pictureURL: - "https://storepictures.theonestop.co.in/products/all-vegetables.jpg", - ); - e = new StoreProduct( - name: "Fruits", - pictureURL: "https://storepictures.theonestop.co.in/new2/AllFruits.jpg", - ); - f = new StoreProduct( - name: "Daily Essentials", - pictureURL: - "https://storepictures.theonestop.co.in/illustrations/supermarket.png", - ); - categories.add(d); - categories.add(e); - categories.add(f); + // d = new StoreProduct( + // name: "Vegetables", + // pictureURL: + // "https://storepictures.theonestop.co.in/products/all-vegetables.jpg", + // ); + // e = new StoreProduct( + // name: "Fruits", + // pictureURL: "https://storepictures.theonestop.co.in/new2/AllFruits.jpg", + // ); + // f = new StoreProduct( + // name: "Daily Essentials", + // pictureURL: + // "https://storepictures.theonestop.co.in/illustrations/supermarket.png", + // ); + // categories.add(d); + // categories.add(e); + // categories.add(f); getUsername(); _fcm = new FirebaseMessaging(); _saveDeviceToken(); @@ -194,9 +195,10 @@ class _MainLandingScreenState extends State { Padding( padding: const EdgeInsets.only(left: 6.0), child: ShowCards( - sp: itemsList[index], + sp: store ? itemsList[index] : null, store: store, index: index, + cat: !store ? itemsList[index] : null ), ), ], @@ -417,7 +419,7 @@ class _MainLandingScreenState extends State { HelperFunctions.commonText( height, "Categories", "", "SEE ALL"), SizedBox(height: 9.0), - commonWidget(height, categories, false), + commonWidget(height, catArray, false), SizedBox(height: 9.0) ], ), From ee89558f71cc200d9119071b3e0661094b548c58 Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Wed, 4 Nov 2020 14:03:41 +0530 Subject: [PATCH 09/26] smaller boxes --- lib/screens/landing/common/showCards.dart | 18 +++++++++--------- lib/screens/landing/mainLanding.dart | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/screens/landing/common/showCards.dart b/lib/screens/landing/common/showCards.dart index c509e78..990e7f8 100644 --- a/lib/screens/landing/common/showCards.dart +++ b/lib/screens/landing/common/showCards.dart @@ -63,13 +63,13 @@ class _ShowCardsState extends State { }, 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: 1.2, ) : Border.all( color: !this.widget.sp.details[0].outOfStock @@ -77,7 +77,7 @@ class _ShowCardsState extends State { : ThemeColoursSeva().grey, width: !this.widget.sp.details[0].outOfStock ? 1.5 : 0.2, ), - borderRadius: BorderRadius.circular(20.0)), + borderRadius: BorderRadius.circular(10.0)), child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ @@ -89,7 +89,7 @@ class _ShowCardsState extends State { color: !this.widget.sp.details[0].outOfStock ? ThemeColoursSeva().pallete1 : ThemeColoursSeva().grey, - fontSize: 3.4 * SizeConfig.widthMultiplier, + fontSize: 2.6 * SizeConfig.widthMultiplier, fontWeight: FontWeight.w700), ) : SizedBox.shrink(), @@ -98,11 +98,11 @@ class _ShowCardsState extends State { 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: 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("Loading...")), errorWidget: (context, url, error) => Icon(Icons.error), ), ), @@ -117,7 +117,7 @@ class _ShowCardsState extends State { color: !this.widget.sp.details[0].outOfStock ? ThemeColoursSeva().pallete1 : ThemeColoursSeva().grey, - fontSize: 3.4 * SizeConfig.widthMultiplier, + fontSize: 2.6 * SizeConfig.widthMultiplier, fontWeight: FontWeight.w700), ) : Text( @@ -125,7 +125,7 @@ class _ShowCardsState extends State { overflow: TextOverflow.clip, style: TextStyle( color: ThemeColoursSeva().pallete1, - fontSize: 3.4 * SizeConfig.widthMultiplier, + fontSize: 2.6 * SizeConfig.widthMultiplier, fontWeight: FontWeight.w700), ) ], diff --git a/lib/screens/landing/mainLanding.dart b/lib/screens/landing/mainLanding.dart index c838b94..af3279d 100644 --- a/lib/screens/landing/mainLanding.dart +++ b/lib/screens/landing/mainLanding.dart @@ -180,7 +180,7 @@ class _MainLandingScreenState extends State { //Common Card widget for both the best sellers and Categories Widget commonWidget(height, itemsList, store) { return Container( - height: height * 0.22, + height: height * 0.15, child: Row( children: [ Expanded( From dd0f410e13ba92b3241e36d96719327ba8a1fd82 Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Wed, 4 Nov 2020 14:13:44 +0530 Subject: [PATCH 10/26] shimmer layout --- lib/screens/landing/common/showCards.dart | 54 +++++++---------------- lib/screens/landing/mainLanding.dart | 2 +- 2 files changed, 17 insertions(+), 39 deletions(-) diff --git a/lib/screens/landing/common/showCards.dart b/lib/screens/landing/common/showCards.dart index 990e7f8..2ff8991 100644 --- a/lib/screens/landing/common/showCards.dart +++ b/lib/screens/landing/common/showCards.dart @@ -23,7 +23,7 @@ class ShowCards extends StatefulWidget { final Category cat; final bool store; final int index; - ShowCards({this.sp,@required this.store, @required this.index, this.cat}); + ShowCards({this.sp, @required this.store, @required this.index, this.cat}); @override _ShowCardsState createState() => _ShowCardsState(); @@ -69,30 +69,18 @@ class _ShowCardsState extends State { border: !this.widget.store ? Border.all( color: ThemeColoursSeva().pallete3, - width: 1.2, + 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(10.0)), child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - widget.store - ? Text( - "${widget.sp.name}", - overflow: TextOverflow.clip, - style: TextStyle( - color: !this.widget.sp.details[0].outOfStock - ? ThemeColoursSeva().pallete1 - : ThemeColoursSeva().grey, - fontSize: 2.6 * SizeConfig.widthMultiplier, - fontWeight: FontWeight.w700), - ) - : SizedBox.shrink(), // Hero animation on clicking any bestseller card Hero( tag: this.widget.store ? widget.sp.name : this.widget.cat.name, @@ -100,34 +88,24 @@ class _ShowCardsState extends State { child: Container( height: height * 0.06, child: CachedNetworkImage( - imageUrl: this.widget.store ? widget.sp.pictureURL : this.widget.cat.imgURL, + imageUrl: this.widget.store + ? widget.sp.pictureURL + : this.widget.cat.imgURL, placeholder: (context, url) => - Container(height: 20.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: 2.6 * SizeConfig.widthMultiplier, - fontWeight: FontWeight.w700), - ) - : Text( - "${widget.cat.name}", - overflow: TextOverflow.clip, - style: TextStyle( - color: ThemeColoursSeva().pallete1, - fontSize: 2.6 * 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), + ) ], ), ), diff --git a/lib/screens/landing/mainLanding.dart b/lib/screens/landing/mainLanding.dart index af3279d..3ef9de7 100644 --- a/lib/screens/landing/mainLanding.dart +++ b/lib/screens/landing/mainLanding.dart @@ -223,7 +223,7 @@ class _MainLandingScreenState extends State { borderRadius: BorderRadius.circular(10), color: Colors.grey, ), - height: height * 0.20, + height: height * 0.12, width: width * 0.27, ) ], From 97a8eaaca3569640b59bbbc8d8fa7b403c29654f Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Thu, 5 Nov 2020 09:34:10 +0530 Subject: [PATCH 11/26] remove unwanted code --- lib/screens/landing/mainLanding.dart | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/lib/screens/landing/mainLanding.dart b/lib/screens/landing/mainLanding.dart index 3ef9de7..704165a 100644 --- a/lib/screens/landing/mainLanding.dart +++ b/lib/screens/landing/mainLanding.dart @@ -52,13 +52,6 @@ class _MainLandingScreenState extends State { "Order Now and support your local stores." ]; - // This Array is populated by the categories card data - List categories = []; - - // static categories - StoreProduct d; - StoreProduct e; - StoreProduct f; String _email; String _username; Timer x; @@ -86,24 +79,6 @@ class _MainLandingScreenState extends State { @override initState() { super.initState(); - // Populating the categories array - // d = new StoreProduct( - // name: "Vegetables", - // pictureURL: - // "https://storepictures.theonestop.co.in/products/all-vegetables.jpg", - // ); - // e = new StoreProduct( - // name: "Fruits", - // pictureURL: "https://storepictures.theonestop.co.in/new2/AllFruits.jpg", - // ); - // f = new StoreProduct( - // name: "Daily Essentials", - // pictureURL: - // "https://storepictures.theonestop.co.in/illustrations/supermarket.png", - // ); - // categories.add(d); - // categories.add(e); - // categories.add(f); getUsername(); _fcm = new FirebaseMessaging(); _saveDeviceToken(); From c63c7b062585e3676e0d5933bce1267d6ace95f3 Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Thu, 5 Nov 2020 09:56:05 +0530 Subject: [PATCH 12/26] fix loading --- lib/screens/common/common_functions.dart | 2 +- lib/screens/landing/mainLanding.dart | 3 ++- lib/screens/loading.dart | 11 ++++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/screens/common/common_functions.dart b/lib/screens/common/common_functions.dart index 0d21316..aadb165 100644 --- a/lib/screens/common/common_functions.dart +++ b/lib/screens/common/common_functions.dart @@ -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: () { diff --git a/lib/screens/landing/mainLanding.dart b/lib/screens/landing/mainLanding.dart index 704165a..b73e2a6 100644 --- a/lib/screens/landing/mainLanding.dart +++ b/lib/screens/landing/mainLanding.dart @@ -79,6 +79,7 @@ class _MainLandingScreenState extends State { @override initState() { super.initState(); + catArray.removeLast(); getUsername(); _fcm = new FirebaseMessaging(); _saveDeviceToken(); @@ -392,7 +393,7 @@ class _MainLandingScreenState extends State { }, ), HelperFunctions.commonText( - height, "Categories", "", "SEE ALL"), + height, "Categories", "", context), SizedBox(height: 9.0), commonWidget(height, catArray, false), SizedBox(height: 9.0) diff --git a/lib/screens/loading.dart b/lib/screens/loading.dart index e58f436..c96c162 100644 --- a/lib/screens/loading.dart +++ b/lib/screens/loading.dart @@ -33,7 +33,7 @@ class LoadingScreen extends StatefulWidget { class _LoadingScreenState extends State { bool _showLoginScreen; String _showText; - bool _connected = false; + bool _connected; CIBox _ciBox; @override @@ -63,11 +63,14 @@ class _LoadingScreenState extends State { try { final result = await InternetAddress.lookup('google.com'); if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) { - _connected = true; + setState(() { + _connected = true; + }); _checkForUserToken(); } } on SocketException catch (_) { setState(() { + _connected = false; _showText = "Oops! No internet connection."; }); } @@ -163,7 +166,9 @@ class _LoadingScreenState extends State { @override Widget build(BuildContext context) { - if (!_connected) _checkConnection(); + if (_connected != null) { + if (!_connected) _checkConnection(); + } return Scaffold( body: Container( child: Center( From e1878cba9220b87783e24685645498e2a07d5007 Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Thu, 5 Nov 2020 10:15:21 +0530 Subject: [PATCH 13/26] ui changes --- lib/screens/common/customappBar.dart | 2 +- lib/screens/common/sidenavbar.dart | 2 +- lib/screens/landing/graphics/lightBG.dart | 2 +- lib/screens/landing/mainLanding.dart | 28 ++++++++++++++--------- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/lib/screens/common/customappBar.dart b/lib/screens/common/customappBar.dart index 040eb9e..a98a3fa 100644 --- a/lib/screens/common/customappBar.dart +++ b/lib/screens/common/customappBar.dart @@ -124,7 +124,7 @@ class CustomAppBar extends PreferredSize { @override Widget build(BuildContext context) { return Container( - color: ThemeColoursSeva().pallete3, + color: ThemeColoursSeva().pallete4, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ diff --git a/lib/screens/common/sidenavbar.dart b/lib/screens/common/sidenavbar.dart index 8c80811..dd906d3 100644 --- a/lib/screens/common/sidenavbar.dart +++ b/lib/screens/common/sidenavbar.dart @@ -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, ), ), diff --git a/lib/screens/landing/graphics/lightBG.dart b/lib/screens/landing/graphics/lightBG.dart index 22b211b..da94881 100644 --- a/lib/screens/landing/graphics/lightBG.dart +++ b/lib/screens/landing/graphics/lightBG.dart @@ -29,7 +29,7 @@ class LightBlueBG extends CustomPainter { ovalPath.close(); // paint - paint.color = ThemeColoursSeva().vlgColor; + paint.color = ThemeColoursSeva().pallete4; canvas.drawPath(ovalPath, paint); } diff --git a/lib/screens/landing/mainLanding.dart b/lib/screens/landing/mainLanding.dart index b73e2a6..80b1936 100644 --- a/lib/screens/landing/mainLanding.dart +++ b/lib/screens/landing/mainLanding.dart @@ -171,11 +171,10 @@ class _MainLandingScreenState extends State { Padding( padding: const EdgeInsets.only(left: 6.0), child: ShowCards( - sp: store ? itemsList[index] : null, - store: store, - index: index, - cat: !store ? itemsList[index] : null - ), + sp: store ? itemsList[index] : null, + store: store, + index: index, + cat: !store ? itemsList[index] : null), ), ], ), @@ -254,10 +253,10 @@ class _MainLandingScreenState extends State { painter: LightBlueBG(), child: Container(), ), - CustomPaint( - painter: DarkColourBG(), - child: Container(), - ), + // CustomPaint( + // painter: DarkColourBG(), + // child: Container(), + // ), Positioned.fill( child: Align( alignment: Alignment.topCenter, @@ -290,7 +289,7 @@ class _MainLandingScreenState extends State { style: TextStyle( color: ThemeColoursSeva().dkGreen, fontWeight: FontWeight.w900, - fontSize: 2.7 * SizeConfig.textMultiplier), + fontSize: 2.3 * SizeConfig.textMultiplier), ), ), ], @@ -396,7 +395,14 @@ class _MainLandingScreenState extends State { height, "Categories", "", context), SizedBox(height: 9.0), commonWidget(height, catArray, false), - SizedBox(height: 9.0) + SizedBox(height: 25.0), + Center( + child: Text( + "More Coming Soon!", + style: TextStyle( + color: ThemeColoursSeva().black, + fontSize: 2.2 * SizeConfig.textMultiplier), + )) ], ), ), From 59603a084a6575cdb582950105b3333f13c34de7 Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Thu, 5 Nov 2020 12:27:19 +0530 Subject: [PATCH 14/26] featured graphics --- lib/models/featured.dart | 14 ++++++++ lib/screens/landing/common/featuredCards.dart | 35 ++++++++++--------- lib/screens/landing/mainLanding.dart | 10 +++--- lib/static-data/featured.dart | 9 +++++ 4 files changed, 47 insertions(+), 21 deletions(-) create mode 100644 lib/models/featured.dart create mode 100644 lib/static-data/featured.dart diff --git a/lib/models/featured.dart b/lib/models/featured.dart new file mode 100644 index 0000000..7c3353c --- /dev/null +++ b/lib/models/featured.dart @@ -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}); +} diff --git a/lib/screens/landing/common/featuredCards.dart b/lib/screens/landing/common/featuredCards.dart index 6a5edc9..ce6e047 100644 --- a/lib/screens/landing/common/featuredCards.dart +++ b/lib/screens/landing/common/featuredCards.dart @@ -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) { @@ -33,7 +36,7 @@ class FeaturedCards extends StatelessWidget { double width = MediaQuery.of(context).size.width; return GestureDetector( onTap: () { - if (index == 1) showInstructions(context); + // if (index == 1) showInstructions(context); }, child: Container( // fallback height @@ -41,19 +44,19 @@ class FeaturedCards extends StatelessWidget { 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: 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), ), ); } diff --git a/lib/screens/landing/mainLanding.dart b/lib/screens/landing/mainLanding.dart index 80b1936..640712c 100644 --- a/lib/screens/landing/mainLanding.dart +++ b/lib/screens/landing/mainLanding.dart @@ -18,6 +18,7 @@ import 'package:mvp/screens/common/common_functions.dart'; import 'package:mvp/screens/common/customappBar.dart'; import 'package:mvp/screens/common/sidenavbar.dart'; import 'package:mvp/static-data/categories.dart'; +import 'package:mvp/static-data/featured.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:carousel_slider/carousel_slider.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; @@ -28,7 +29,6 @@ import 'package:mvp/constants/themeColours.dart'; 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/sizeconfig/sizeconfig.dart'; import 'package:shimmer/shimmer.dart'; import 'graphics/lightBG.dart'; @@ -46,8 +46,8 @@ class _MainLandingScreenState extends State { // This Array is populated by the data that is visible on // each caraousel var texts = [ - "Free Deliveries and no minimum order!\n" + "\nOrder Now.", - "Share your referral code with friends to get Rs 25 cashback", + // "Free Deliveries and no minimum order!\n" + "\nOrder Now.", + // "Share your referral code with friends to get Rs 25 cashback", "Super fast delivery within 45 minutes!", "Order Now and support your local stores." ]; @@ -304,11 +304,11 @@ class _MainLandingScreenState extends State { Expanded( child: CarouselSlider( items: mapIndexed( - texts, + featuredArr, (index, item) => Builder( builder: (BuildContext context) { return FeaturedCards( - textToDisplay: item, + featuredItem: item, index: index, referralCode: _referralCode); }, diff --git a/lib/static-data/featured.dart b/lib/static-data/featured.dart new file mode 100644 index 0000000..5f36c15 --- /dev/null +++ b/lib/static-data/featured.dart @@ -0,0 +1,9 @@ +import 'package:mvp/models/featured.dart'; + +final List featuredArr = [ + Featured( + name: 'SuperFastDelivery', + imgURL: + "https://storepictures.theonestop.co.in/illustrations/SuperFastDelivery-2.png", + clickable: false) +]; From a9398a1386f866c112e3724dd276b465d237c5ca Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Thu, 5 Nov 2020 12:59:49 +0530 Subject: [PATCH 15/26] featured graphics implementation --- lib/screens/landing/common/showCards.dart | 6 +++--- lib/screens/landing/mainLanding.dart | 23 +++-------------------- lib/static-data/featured.dart | 10 ++++++++++ 3 files changed, 16 insertions(+), 23 deletions(-) diff --git a/lib/screens/landing/common/showCards.dart b/lib/screens/landing/common/showCards.dart index 2ff8991..bc8268c 100644 --- a/lib/screens/landing/common/showCards.dart +++ b/lib/screens/landing/common/showCards.dart @@ -69,15 +69,15 @@ class _ShowCardsState extends State { border: !this.widget.store ? Border.all( color: ThemeColoursSeva().pallete3, - width: 0.7, + width: 0.9, ) : Border.all( color: !this.widget.sp.details[0].outOfStock ? ThemeColoursSeva().pallete3 : ThemeColoursSeva().grey, - width: !this.widget.sp.details[0].outOfStock ? 0.7 : 0.2, + width: !this.widget.sp.details[0].outOfStock ? 0.9 : 0.2, ), - borderRadius: BorderRadius.circular(10.0)), + borderRadius: BorderRadius.circular(2.0)), child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ diff --git a/lib/screens/landing/mainLanding.dart b/lib/screens/landing/mainLanding.dart index 640712c..7d9bd8a 100644 --- a/lib/screens/landing/mainLanding.dart +++ b/lib/screens/landing/mainLanding.dart @@ -41,16 +41,6 @@ class MainLandingScreen extends StatefulWidget { class _MainLandingScreenState extends State { final GlobalKey _scaffoldKey = new GlobalKey(); BestsellersBloc apiBloc; - //Todo: Screen Visible after login - - // This Array is populated by the data that is visible on - // each caraousel - var texts = [ - // "Free Deliveries and no minimum order!\n" + "\nOrder Now.", - // "Share your referral code with friends to get Rs 25 cashback", - "Super fast delivery within 45 minutes!", - "Order Now and support your local stores." - ]; String _email; String _username; @@ -239,7 +229,6 @@ class _MainLandingScreenState extends State { ), drawer: SizedBox( width: width * 0.5, - /// Side Drawer visible after login child: Sidenav( height: height, @@ -253,10 +242,6 @@ class _MainLandingScreenState extends State { painter: LightBlueBG(), child: Container(), ), - // CustomPaint( - // painter: DarkColourBG(), - // child: Container(), - // ), Positioned.fill( child: Align( alignment: Alignment.topCenter, @@ -326,7 +311,7 @@ class _MainLandingScreenState extends State { enableInfiniteScroll: true, reverse: false, autoPlay: true, - autoPlayInterval: Duration(seconds: 4), + autoPlayInterval: Duration(seconds: 6), autoPlayAnimationDuration: Duration(milliseconds: 600), autoPlayCurve: Curves.fastOutSlowIn, @@ -335,12 +320,10 @@ class _MainLandingScreenState extends State { ), ), ), - - /// text visible in the carousel card Row( mainAxisAlignment: MainAxisAlignment.center, - children: texts.map((url) { - int index = texts.indexOf(url); + children: + mapIndexed(featuredArr, (index, item) { return Container( width: 8.0, height: 8.0, diff --git a/lib/static-data/featured.dart b/lib/static-data/featured.dart index 5f36c15..6d560d0 100644 --- a/lib/static-data/featured.dart +++ b/lib/static-data/featured.dart @@ -5,5 +5,15 @@ final List featuredArr = [ name: 'SuperFastDelivery', imgURL: "https://storepictures.theonestop.co.in/illustrations/SuperFastDelivery-2.png", + clickable: false), + Featured( + name: 'SupportLocal', + imgURL: + "https://storepictures.theonestop.co.in/illustrations/SupportLocal.png", + clickable: false), + Featured( + name: 'ReferAFriend', + imgURL: + "https://storepictures.theonestop.co.in/illustrations/ReferAFriend.png", clickable: false) ]; From f2ba47aaeec83cedec4cea415eda1852081d789d Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Thu, 5 Nov 2020 13:01:18 +0530 Subject: [PATCH 16/26] referrals --- lib/screens/landing/common/featuredCards.dart | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/lib/screens/landing/common/featuredCards.dart b/lib/screens/landing/common/featuredCards.dart index ce6e047..679560a 100644 --- a/lib/screens/landing/common/featuredCards.dart +++ b/lib/screens/landing/common/featuredCards.dart @@ -36,7 +36,7 @@ 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 @@ -45,17 +45,6 @@ class FeaturedCards extends StatelessWidget { decoration: BoxDecoration( borderRadius: BorderRadius.circular(20.0), ), - // 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), ), ); From b7f38864cb7c75af7d7772679a6274d723fadac2 Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Thu, 5 Nov 2020 13:10:43 +0530 Subject: [PATCH 17/26] borders --- lib/screens/landing/common/showCards.dart | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/screens/landing/common/showCards.dart b/lib/screens/landing/common/showCards.dart index bc8268c..b8b996b 100644 --- a/lib/screens/landing/common/showCards.dart +++ b/lib/screens/landing/common/showCards.dart @@ -55,9 +55,6 @@ class _ShowCardsState extends State { })); else { // open the modal container - // this.widget.sp.details.forEach((element) { - // if (!element.outOfStock) onClickProduct(); - // }); if (!this.widget.sp.details[0].outOfStock) onClickProduct(); } }, @@ -69,13 +66,13 @@ class _ShowCardsState extends State { border: !this.widget.store ? Border.all( color: ThemeColoursSeva().pallete3, - width: 0.9, + width: 0.7, ) : Border.all( color: !this.widget.sp.details[0].outOfStock ? ThemeColoursSeva().pallete3 : ThemeColoursSeva().grey, - width: !this.widget.sp.details[0].outOfStock ? 0.9 : 0.2, + width: !this.widget.sp.details[0].outOfStock ? 0.7 : 0.2, ), borderRadius: BorderRadius.circular(2.0)), child: Column( From 9e1606aa3b1788e69d8930430deace2ae7a8adb2 Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Thu, 5 Nov 2020 13:49:09 +0530 Subject: [PATCH 18/26] location changes --- lib/screens/common/customappBar.dart | 14 ++++++++++++-- lib/screens/landing/mainLanding.dart | 3 +++ lib/screens/location.dart | 25 ++++++++++++++----------- test/widgets/location_test.dart | 2 +- 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/lib/screens/common/customappBar.dart b/lib/screens/common/customappBar.dart index a98a3fa..3d60202 100644 --- a/lib/screens/common/customappBar.dart +++ b/lib/screens/common/customappBar.dart @@ -25,7 +25,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); @@ -71,7 +71,17 @@ class CustomAppBar extends PreferredSize { ); }); } else - return Container(child: Text("Loading Address ...")); + return Container( + height: 120.0, + width: 100.0, + child: Center( + child: CircularProgressIndicator( + backgroundColor: ThemeColoursSeva().pallete1, + valueColor: AlwaysStoppedAnimation( + ThemeColoursSeva().vlgColor), + ), + ), + ); }), actions: [ FutureBuilder( diff --git a/lib/screens/landing/mainLanding.dart b/lib/screens/landing/mainLanding.dart index 7d9bd8a..59e91ef 100644 --- a/lib/screens/landing/mainLanding.dart +++ b/lib/screens/landing/mainLanding.dart @@ -135,7 +135,9 @@ class _MainLandingScreenState extends State { final preferences = await Preferences.getInstance(); final username = preferences.getData("username"); final mobile = preferences.getData("mobile"); + final email = preferences.getData("email"); setState(() { + _email = email; _username = username; _mobileNumber = mobile; _referralCode = @@ -229,6 +231,7 @@ class _MainLandingScreenState extends State { ), drawer: SizedBox( width: width * 0.5, + /// Side Drawer visible after login child: Sidenav( height: height, diff --git a/lib/screens/location.dart b/lib/screens/location.dart index 6278e9b..9b91355 100644 --- a/lib/screens/location.dart +++ b/lib/screens/location.dart @@ -27,7 +27,7 @@ import 'package:mvp/sizeconfig/sizeconfig.dart'; class GoogleLocationScreen extends StatefulWidget { final String userEmail; - GoogleLocationScreen({this.userEmail}); + GoogleLocationScreen({@required this.userEmail}); @override _GoogleLocationScreenState createState() => _GoogleLocationScreenState(); } @@ -91,9 +91,12 @@ class _GoogleLocationScreenState extends State { } } Fluttertoast.showToast( - msg: "Getting your location, just a moment!", + msg: "Getting your location. Please wait 3 seconds ...", toastLength: Toast.LENGTH_LONG, gravity: ToastGravity.CENTER); + setState(() { + _loader = true; + }); Future.delayed(const Duration(seconds: 3), () async { _locationData = await location.getLocation(); getCurrentLocation(_locationData); @@ -190,7 +193,7 @@ class _GoogleLocationScreenState extends State { await Geocoder.local.findAddressesFromCoordinates(coordinates); var first = addresses.first; var subLocality; - + print(first.addressLine); if (first.subLocality != null) { subLocality = first.subLocality; } else if (first.subAdminArea != null) { @@ -200,11 +203,7 @@ class _GoogleLocationScreenState extends State { } else { subLocality = "None"; } - final subArea = first.subAdminArea; - final state = first.adminArea; - final pincode = first.postalCode; - final country = first.countryName; - final address = "$subArea,$state,$pincode,$country"; + final address = first.addressLine; this.setState(() { _markerAddress = address; _subLocality = subLocality; @@ -218,8 +217,8 @@ class _GoogleLocationScreenState extends State { String houseno = _houseno.text.trim(); String landmark = _landmark.text.trim(); String geocodedaddress = _markerAddress; - user.email = widget.userEmail; - user.address = '$houseno,$landmark,$geocodedaddress'; + user.email = this.widget.userEmail; + user.address = '$houseno, $landmark, $geocodedaddress'; user.latitude = _lat.toString(); user.longitude = _lng.toString(); @@ -310,7 +309,11 @@ class _GoogleLocationScreenState extends State { constraints: BoxConstraints( maxHeight: MediaQuery.of(context).size.height), child: Center( - child: CircularProgressIndicator(), + child: CircularProgressIndicator( + backgroundColor: ThemeColoursSeva().pallete1, + valueColor: AlwaysStoppedAnimation( + ThemeColoursSeva().vlgColor), + ), ), ), ], diff --git a/test/widgets/location_test.dart b/test/widgets/location_test.dart index 56fac26..2f669be 100644 --- a/test/widgets/location_test.dart +++ b/test/widgets/location_test.dart @@ -4,7 +4,7 @@ import 'package:mvp/screens/location.dart'; void main() { testWidgets('Location screen test', (WidgetTester tester) async { - await tester.pumpWidget(buildTestableWidget(GoogleLocationScreen())); + await tester.pumpWidget(buildTestableWidget(GoogleLocationScreen(userEmail: "vk.rahul318@gmail.com",))); final houseNoText = find.text('House No/Flat No:'); expect(houseNoText, findsOneWidget); From 6ac295dd7bf5d04e9bba011ce82e3d496c52e9e9 Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Thu, 5 Nov 2020 13:56:43 +0530 Subject: [PATCH 19/26] bug --- lib/screens/landing/mainLanding.dart | 2 +- lib/screens/location.dart | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/screens/landing/mainLanding.dart b/lib/screens/landing/mainLanding.dart index 59e91ef..8a2da11 100644 --- a/lib/screens/landing/mainLanding.dart +++ b/lib/screens/landing/mainLanding.dart @@ -69,7 +69,7 @@ class _MainLandingScreenState extends State { @override initState() { super.initState(); - catArray.removeLast(); + if (catArray[catArray.length - 1].imgURL == "") catArray.removeLast(); getUsername(); _fcm = new FirebaseMessaging(); _saveDeviceToken(); diff --git a/lib/screens/location.dart b/lib/screens/location.dart index 9b91355..ea6e150 100644 --- a/lib/screens/location.dart +++ b/lib/screens/location.dart @@ -249,8 +249,7 @@ class _GoogleLocationScreenState extends State { await p.setEmail(json.decode(response.body)["email"]); await p.setMobile(json.decode(response.body)["mobile"]); if (!far) { - Navigator.pushNamedAndRemoveUntil( - context, '/main', ModalRoute.withName('/main')); + Navigator.pushReplacementNamed(context, "/main"); } else { Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) { From f7bc8f05c4464127e5e66dba24fcc474c2d68fc7 Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Thu, 5 Nov 2020 14:01:58 +0530 Subject: [PATCH 20/26] common indicator --- lib/screens/auth/login.dart | 5 +++-- lib/screens/auth/register.dart | 3 ++- lib/screens/common/customappBar.dart | 7 ++----- lib/screens/common/progressIndicator.dart | 12 ++++++++++++ lib/screens/location.dart | 8 +++----- lib/screens/productsNew/newUI.dart | 3 ++- lib/screens/shoppingCart/loading.dart | 3 ++- 7 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 lib/screens/common/progressIndicator.dart diff --git a/lib/screens/auth/login.dart b/lib/screens/auth/login.dart index 9991317..7004538 100644 --- a/lib/screens/auth/login.dart +++ b/lib/screens/auth/login.dart @@ -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'; @@ -124,7 +125,7 @@ class _LoginScreenState extends State { if (_otpLoader) return Padding( padding: const EdgeInsets.only(top: 8.0), - child: CircularProgressIndicator(), + child: CommonGreenIndicator(), ); else return Container(); @@ -133,7 +134,7 @@ class _LoginScreenState extends State { // basic loader _showLoader() { if (_loading) { - return CircularProgressIndicator(); + return CommonGreenIndicator(); } else return showOTPField ? Padding( diff --git a/lib/screens/auth/register.dart b/lib/screens/auth/register.dart index dfec7aa..ca61784 100644 --- a/lib/screens/auth/register.dart +++ b/lib/screens/auth/register.dart @@ -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'; @@ -55,7 +56,7 @@ class _RegisterScreenState extends State { if (_loading == true) { return Container( child: Center( - child: CircularProgressIndicator(), + child: CommonGreenIndicator(), ), ); } else { diff --git a/lib/screens/common/customappBar.dart b/lib/screens/common/customappBar.dart index 3d60202..e189d1c 100644 --- a/lib/screens/common/customappBar.dart +++ b/lib/screens/common/customappBar.dart @@ -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'; @@ -75,11 +76,7 @@ class CustomAppBar extends PreferredSize { height: 120.0, width: 100.0, child: Center( - child: CircularProgressIndicator( - backgroundColor: ThemeColoursSeva().pallete1, - valueColor: AlwaysStoppedAnimation( - ThemeColoursSeva().vlgColor), - ), + child: CommonGreenIndicator(), ), ); }), diff --git a/lib/screens/common/progressIndicator.dart b/lib/screens/common/progressIndicator.dart new file mode 100644 index 0000000..9dc6e32 --- /dev/null +++ b/lib/screens/common/progressIndicator.dart @@ -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(ThemeColoursSeva().vlgColor), + ); + } +} diff --git a/lib/screens/location.dart b/lib/screens/location.dart index ea6e150..bfb7319 100644 --- a/lib/screens/location.dart +++ b/lib/screens/location.dart @@ -24,6 +24,8 @@ import 'package:http/http.dart' as http; import 'package:mvp/screens/errors/notServing.dart'; import 'package:mvp/sizeconfig/sizeconfig.dart'; +import 'common/progressIndicator.dart'; + class GoogleLocationScreen extends StatefulWidget { final String userEmail; @@ -308,11 +310,7 @@ class _GoogleLocationScreenState extends State { constraints: BoxConstraints( maxHeight: MediaQuery.of(context).size.height), child: Center( - child: CircularProgressIndicator( - backgroundColor: ThemeColoursSeva().pallete1, - valueColor: AlwaysStoppedAnimation( - ThemeColoursSeva().vlgColor), - ), + child: CommonGreenIndicator(), ), ), ], diff --git a/lib/screens/productsNew/newUI.dart b/lib/screens/productsNew/newUI.dart index f9e8883..703251c 100644 --- a/lib/screens/productsNew/newUI.dart +++ b/lib/screens/productsNew/newUI.dart @@ -18,6 +18,7 @@ import 'package:mvp/constants/themeColours.dart'; import 'package:mvp/domain/product_repository.dart'; import 'package:mvp/models/storeProducts.dart'; import 'package:mvp/screens/common/cartIcon.dart'; +import 'package:mvp/screens/common/progressIndicator.dart'; import 'package:mvp/screens/productsNew/details.dart'; import 'package:mvp/sizeconfig/sizeconfig.dart'; import 'package:mvp/static-data/categories.dart'; @@ -356,7 +357,7 @@ class _ProductsUINewState extends State { fontSize: 2 * SizeConfig.textMultiplier), )); } else - return CircularProgressIndicator(); + return CommonGreenIndicator(); }, ), ), diff --git a/lib/screens/shoppingCart/loading.dart b/lib/screens/shoppingCart/loading.dart index ed60453..a27e2a2 100644 --- a/lib/screens/shoppingCart/loading.dart +++ b/lib/screens/shoppingCart/loading.dart @@ -13,6 +13,7 @@ import 'package:mvp/classes/prefrenses.dart'; import 'package:mvp/models/newCart.dart'; import 'package:mvp/models/ordersModel.dart'; import 'package:http/http.dart' as http; +import 'package:mvp/screens/common/progressIndicator.dart'; import 'package:provider/provider.dart'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:mvp/constants/apiCalls.dart'; @@ -104,7 +105,7 @@ class _OrderLoaderState extends State { return Material( child: Scaffold( body: Center( - child: CircularProgressIndicator(), + child: CommonGreenIndicator(), ), ), ); From 33fd862dcd7c8f1a15d02c76ad6235aa78560d5e Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Thu, 5 Nov 2020 14:06:08 +0530 Subject: [PATCH 21/26] order change --- lib/static-data/featured.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/static-data/featured.dart b/lib/static-data/featured.dart index 6d560d0..4f7d5b3 100644 --- a/lib/static-data/featured.dart +++ b/lib/static-data/featured.dart @@ -2,14 +2,14 @@ import 'package:mvp/models/featured.dart'; final List featuredArr = [ Featured( - name: 'SuperFastDelivery', + name: 'SupportLocal', imgURL: - "https://storepictures.theonestop.co.in/illustrations/SuperFastDelivery-2.png", + "https://storepictures.theonestop.co.in/illustrations/SupportLocal.png", clickable: false), Featured( - name: 'SupportLocal', + name: 'SuperFastDelivery', imgURL: - "https://storepictures.theonestop.co.in/illustrations/SupportLocal.png", + "https://storepictures.theonestop.co.in/illustrations/SuperFastDelivery-2.png", clickable: false), Featured( name: 'ReferAFriend', From 20f46fa31d5e4648b60da39d2169cccadcb2edff Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Thu, 5 Nov 2020 14:37:05 +0530 Subject: [PATCH 22/26] loading screen --- lib/screens/loading.dart | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/lib/screens/loading.dart b/lib/screens/loading.dart index c96c162..e9ebc96 100644 --- a/lib/screens/loading.dart +++ b/lib/screens/loading.dart @@ -18,6 +18,7 @@ import 'package:mvp/constants/themeColours.dart'; import 'package:mvp/models/newCart.dart'; import 'package:mvp/models/storeProducts.dart'; import 'package:mvp/screens/auth/login.dart'; +import 'package:mvp/screens/common/progressIndicator.dart'; import 'package:mvp/screens/errors/notServing.dart'; import 'package:mvp/screens/introScreen.dart'; import 'dart:io'; @@ -35,6 +36,7 @@ class _LoadingScreenState extends State { String _showText; bool _connected; CIBox _ciBox; + final _scaffoldKey = GlobalKey(); @override void setState(fn) { @@ -73,6 +75,10 @@ class _LoadingScreenState extends State { _connected = false; _showText = "Oops! No internet connection."; }); + final snackBar = SnackBar( + content: Text("Please connect to the internet and try again"), + ); + _scaffoldKey.currentState.showSnackBar(snackBar); } } @@ -164,22 +170,38 @@ class _LoadingScreenState extends State { } } + _showloading(){ + if(_connected==null)return CommonGreenIndicator(); + else if(_connected!=null){ + if(_connected==true)return CommonGreenIndicator(); + else return Container(); + } + } + @override Widget build(BuildContext context) { if (_connected != null) { if (!_connected) _checkConnection(); } return Scaffold( + key: _scaffoldKey, body: Container( child: Center( child: Padding( padding: const EdgeInsets.all(20.0), - child: Text( - _showText, - style: TextStyle( - color: ThemeColoursSeva().dkGreen, - fontSize: 24.0, - fontWeight: FontWeight.bold), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + _showloading(), + SizedBox(height: 20.0), + Text( + _showText, + style: TextStyle( + color: ThemeColoursSeva().dkGreen, + fontSize: 16.0, + fontWeight: FontWeight.bold), + ) + ], ), ), ), From f62316b3304ce739990263dfa1fb7fe6351d95ad Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Fri, 6 Nov 2020 10:11:45 +0530 Subject: [PATCH 23/26] cleaner UI --- lib/screens/shoppingCart/loading.dart | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/lib/screens/shoppingCart/loading.dart b/lib/screens/shoppingCart/loading.dart index a27e2a2..e2233d8 100644 --- a/lib/screens/shoppingCart/loading.dart +++ b/lib/screens/shoppingCart/loading.dart @@ -10,6 +10,7 @@ import 'package:flutter/material.dart'; import 'package:mvp/classes/prefrenses.dart'; +import 'package:mvp/constants/themeColours.dart'; import 'package:mvp/models/newCart.dart'; import 'package:mvp/models/ordersModel.dart'; import 'package:http/http.dart' as http; @@ -104,10 +105,28 @@ class _OrderLoaderState extends State { if (_postOnce) _postDataToServer(this.widget.paymentId, cart); return Material( child: Scaffold( - body: Center( - child: CommonGreenIndicator(), + body: Container( + child: Center( + child: Padding( + padding: const EdgeInsets.all(20.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + CommonGreenIndicator(), + SizedBox(height: 20.0), + Text( + "Placing your order", + style: TextStyle( + color: ThemeColoursSeva().dkGreen, + fontSize: 16.0, + fontWeight: FontWeight.bold), + ) + ], + ), + ), ), ), + ), ); } } From 8c31762286f349a3d543674d2ed8db4e48ef924f Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Fri, 6 Nov 2020 10:12:17 +0530 Subject: [PATCH 24/26] better word --- lib/screens/shoppingCart/loading.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/screens/shoppingCart/loading.dart b/lib/screens/shoppingCart/loading.dart index e2233d8..6745026 100644 --- a/lib/screens/shoppingCart/loading.dart +++ b/lib/screens/shoppingCart/loading.dart @@ -77,7 +77,7 @@ class _OrderLoaderState extends State { await http.post(url, headers: requestHeaders, body: jsonBody); if (response.statusCode == 200) { Fluttertoast.showToast( - msg: "Order posted!", + msg: "Order placed!", toastLength: Toast.LENGTH_LONG, gravity: ToastGravity.BOTTOM); // clear the cart here From e46274246e4ea0c6db6c555f08841036f7135a26 Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Fri, 6 Nov 2020 10:16:32 +0530 Subject: [PATCH 25/26] fix color --- lib/screens/productsNew/newUI.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/screens/productsNew/newUI.dart b/lib/screens/productsNew/newUI.dart index 703251c..89678ab 100644 --- a/lib/screens/productsNew/newUI.dart +++ b/lib/screens/productsNew/newUI.dart @@ -232,7 +232,13 @@ class _ProductsUINewState extends State { Icons.arrow_back, color: Colors.black54, ), - onPressed: () => Navigator.of(context).pop(), + onPressed: (){ + catArray.forEach((i) { + i.backgroundColor=Colors.white; + i.textColor=ThemeColoursSeva().pallete1; + }); + Navigator.of(context).pop(); + }, ), actions: [CartIcon()], ), @@ -276,7 +282,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) { setState(() { tag = index; for (int i = 0; From ff3543657518dd65c7e9ec3e3e10a3db241b5ae8 Mon Sep 17 00:00:00 2001 From: Rahul_Vijay Date: Fri, 6 Nov 2020 10:20:07 +0530 Subject: [PATCH 26/26] optimize --- lib/screens/productsNew/newUI.dart | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/screens/productsNew/newUI.dart b/lib/screens/productsNew/newUI.dart index 89678ab..96cf42b 100644 --- a/lib/screens/productsNew/newUI.dart +++ b/lib/screens/productsNew/newUI.dart @@ -16,6 +16,7 @@ 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/category.dart'; import 'package:mvp/models/storeProducts.dart'; import 'package:mvp/screens/common/cartIcon.dart'; import 'package:mvp/screens/common/progressIndicator.dart'; @@ -232,11 +233,14 @@ class _ProductsUINewState extends State { Icons.arrow_back, color: Colors.black54, ), - onPressed: (){ - catArray.forEach((i) { - i.backgroundColor=Colors.white; - i.textColor=ThemeColoursSeva().pallete1; - }); + onPressed: () { + Category item = catArray.singleWhere( + (i) => i.backgroundColor != Colors.white, + orElse: () => null); + if (item != null) { + item.backgroundColor = Colors.white; + item.textColor = ThemeColoursSeva().pallete1; + } Navigator.of(context).pop(); }, ),