Member-only story
Building E-commerce app with Flutter bloc pattern-4
Flutter bloc + Firebase
Hi Developers, In the previous module, we have built a home screen that displays the products and we have managed the state of the application using flutter_bloc
package. Now in this module, we shall build our cart screen, a settings screen, and an order screen.
On the cart screen, we will display all the products inside the cart screen, and at the bottom a button with the text Place Order
that will send all the order details on the firebase firestore database, and we will fetch these orders on the order screen.
On the order screen, we will display all the order details.
On the settings screen, we shall enable users to change their password, delete their account, and log out.
So let's build our Cart Screen,
CartScreen:
In the previous module, we have built a FloatingCartWidget
that is displayed when we add items in our cart from our home screen, when we tap on this button the user gets directed to CartScreen
, the CartScreen
also takes a list of product items.
Here is the code of FloatingCartWidget
, in this, we can see the list is passed state.list
and we have used the where() method to filter the list using the condition (element) => element.quantity > 0
…