Skip to content

Commit

Permalink
See docs/release_notes/v0.1.2a release notes.md for changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammadkamal committed Jun 27, 2021
1 parent 84edf15 commit 7a0665a
Show file tree
Hide file tree
Showing 95 changed files with 3,092 additions and 1,253 deletions.
125 changes: 121 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,126 @@
# Bayya

An e-commerce flutter application.
The application features:

## Features
* Shopping Cart & Watchlist tracking
* User Login and registration support
* Reviewing the products
* Different views
* Dynamic search mechanism

## Challenges
* Build list views on demand - less memory
Using ```ListView.builder()``` instead of ```ListView()``` default constructor
Example:
More-memory consuming code

```dart
Widget _listOfProducts() {
return ListView(
padding: EdgeInsets.symmetric(vertical: 8.0),
children: //Check if the list is empty
Provider.of<ShoppingCart>(context).shoppingItemQuantites.isNotEmpty
? Provider.of<ShoppingCart>(context)
.shoppingItemQuantites
.keys
.map((e) {
return ShoppingCartItem(productId: e);
}).toList()
: []);
}
```

Less-memory consuming code

```dart
Widget _listOfProducts() {
return ListView.builder(
padding: EdgeInsets.symmetric(vertical: 8.0),
// Get items count using Provider
itemCount: Provider.of<ShoppingCart>(context)
.shoppingItemQuantites
.keys
.length,
itemBuilder: (context, index) {
return ShoppingCartItem(
productId: Provider.of<ShoppingCart>(context)
.shoppingItemQuantites
.keys
.elementAt(index));
});
}
```

* Future code organization
Using ```FutureBuilder``` instead of setting the state manually
Example:
Manual state management

```dart
String _vendor = 'Vendor not provided';
Widget _vendorCard() {
_getVendorName();
return Container(
padding: const EdgeInsets.all(4),
margin: const EdgeInsets.only(bottom: 2),
color: Colors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [Text('Vendor:')],
),
Row(
children: [Text(_vendor)],
)
],
),
);
}
Future<void> _getVendorName() async {
var _result = await Provider.of<VendorsList>(context).getVendorNameByUid(
Provider.of<Catalog>(context).productsCatalog[widget.productId].vendor);
_vendor = _result;
}
```

Future state managemet
```dart
Widget _vendorText() {
return FutureBuilder(
future: Provider.of<VendorsList>(context).getVendorNameByUid(
Provider.of<Catalog>(context)
.productsCatalog[widget.productId]
.vendor),
builder: (context, snapshot) {
if (snapshot.hasData) {
return Text(snapshot.data,
style: TextStyle(fontWeight: FontWeight.bold));
} else {
return Text("Vendor isn't provieded");
}
});
}
```

## Demo & Images
### Video Demo
[![Demo](https://img.youtube.com/vi/mIx5fLc2f2E/0.jpg)](https://www.youtube.com/watch?v=mIx5fLc2f2E)

### Main screen
![List view](docs\homepage_screenshot_listview.jpg)
![Grid view](docs\homepage_screenshot_gridview.jpg)

### Sidebar
![Sidebar](docs\application_sidebar.jpg)

### Product page
![Product main screen](docs\product_screenshot.jpg)
![Added to cart](docs\product_added_to_shopping_cart.jpg)
![Watchlist](docs\product_watchlisted.jpg)
![Reviews](docs\product_reviews.jpg)

## Demo
[![Demo](https://img.youtube.com/vi/mIx5fLc2f2E/0.jpg)](https://www.youtube.com/watch?v=mIx5fLc2f2E)
### Search page
![Search](docs\search_page.jpg)
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.Bayya">
<uses-permission android:name="android.permission.INTERNET"/>
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.mohammadkamal.bayya

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
Binary file removed assets/20-inch-samsung-led-tv.jpg
Binary file not shown.
Binary file removed assets/blue jeans.jpg
Binary file not shown.
Binary file removed assets/nutella jar.jpg
Binary file not shown.
Binary file added docs/application_sidebar.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/application_sidebar.png
Binary file not shown.
Binary file removed docs/homepage_screenshot.png
Binary file not shown.
Binary file added docs/homepage_screenshot_gridview.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/homepage_screenshot_listview.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/product_added_to_shopping_cart.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/product_added_to_shopping_cart.png
Binary file not shown.
Binary file added docs/product_reviews.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/product_screenshot.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/product_screenshot.png
Binary file not shown.
Binary file added docs/product_watchlisted.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/product_watchlisted.png
Binary file not shown.
27 changes: 27 additions & 0 deletions docs/release_notes/v0.1.2a release notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Bayya 0.1.2 release notes

## Fixes
* Added internet permission for android
* Replaced manual getters for async functions with FutureBuilders
* Replaced ListViews with ListViewBuilders to decrease memory consuming
* Fixed decrement button on shopping cart items
* Enabled action buttons (search, submit... etc) on keyboard inputs

## Features
* Designed a new UI
* Applied Tween animation to navigations
* Added number of products indicator floating over shopping cart icon
* Added grid items for product lists
* Added refresh functionality to shopping list
* Added product reviews

## Issues
* Review on a product might not appear after adding it

## Others
* Removed local pictures of products
* Updated dependencies
* Updated gradle to 6.7
* Abstracted image and vendor widget at product views and list items
* Deleted adding and editing products for vendors
* Added future support for windows desktop application
Binary file added docs/search_page.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/search_page.png
Binary file not shown.
Binary file added docs/shopping_cart.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/shopping_cart.png
Binary file not shown.
Binary file added docs/watchlist.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/watchlist.png
Binary file not shown.
4 changes: 2 additions & 2 deletions lib/cart/shopping_cart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ShoppingCart extends ChangeNotifier {
}

void decrement(String key) {
if (_shoppingItemQuantites[key] >= 1) {
if (_shoppingItemQuantites[key] >= 2) {
_shoppingItemQuantites[key]--;
} else {
_shoppingItemQuantites[key] = 1;
Expand All @@ -56,7 +56,7 @@ class ShoppingCart extends ChangeNotifier {
}

Future<void> fetchData() async {
DocumentSnapshot documentSnapshot = await shoppingCartRemote
DocumentSnapshot<Map<String, dynamic>> documentSnapshot = await shoppingCartRemote
.doc(FirebaseAuth.instance.currentUser.email)
.get();
documentSnapshot.data().forEach((key, value) {
Expand Down
Loading

0 comments on commit 7a0665a

Please sign in to comment.