Skip to content

davitelesn1/app_shop

Repository files navigation

Flutter Online Store with Provider

📷 App Images

Description

This is a mobile application project developed in Flutter, simulating a basic online store. The app allows you to view products, add them to your cart, mark them as favorites, complete orders, and view your purchase history. It uses dummy data for demonstration purposes and focuses on efficient state management. ## Main Features

  • Product Listing: Product grid with filter for favorites.

  • Product Details: Dedicated page with image, price, and description.

  • Favorites: Mark/unmark products as favorites.

  • Shopping Cart: Add/remove items, calculate total, and clear cart.

  • Orders: Checkout and view expandable history.

  • Navigation: Drawer to switch between store and orders.

  • Example Counter: A simple page to demonstrate basic status (optional).

Lessons Learned During Development

During the development of this app, I learned several key Flutter concepts, with an emphasis on state management using the provider package:

  • State Management with Provider:

  • I used ChangeNotifierProvider and MultiProvider in main.dart to provide global states such as ProductList, Cart, and OrderList.

  • I created models such as Product, Cart, and OrderList that extend ChangeNotifier, notifying listeners with notifyListeners() when data changes (e.g., adding to cart or toggling a favorite).

  • I used Provider.of<T>(context) to access and modify states without unnecessary rebuilds, and Consumer<T> for localized rebuilds (e.g., badge in cart and favorite icon).

  • I understood the difference between listen: true/false to optimize performance, avoiding rebuilds in widgets that don't need to react to changes.

  • I implemented filtering of favorite products via ProductList, showing how shared states facilitate features like dynamic filters.

  • Other Points Learned:

  • Navigation and Routes: Configuration of named routes in app_routes.dart and use of Navigator.pushNamed for smooth transitions.

  • Responsive UI: Widgets like GridView.builder for product grids, Dismissible for removing items from the cart, and implicit ExpansionPanel in expandable orders.

  • Models and Data: Creation of classes like Product, CartItem, and Order for data structure, with dummy data for rapid prototyping.

  • Theme and Style: Application of ThemeData for color and font consistency.

  • Local vs. Global State: Comparison with local state on pages like the counter, highlighting when to use setState vs. Provider.

This project reinforced the importance of separating UI logic, making the code more scalable and testable.

``bash

git clone https://github.com/your-username/loja-virtual-flutter.git

About

Simple Flutter e-commerce application demonstrating state management with Provider. Includes product listing, details, favorites, shopping cart, and orders. Ideal for learning UI and state concepts in Flutter.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors