How felipecastrosales/virtual-store works
Project Type and Purpose
• This is a mobile full-stack (client-heavy) e-commerce application built with Flutter (Dart) as the frontend, backed by Firebase services (Auth, Firestore, Storage, etc.).
• Users can browse products, manage a cart (CRUD), apply coupons, track orders (prep → transport → delivery), view store location (Google Maps), and contact via phone.
High-Level Components
a. Mobile Client (Flutter App)
• UI Layer: screens, tabs, tiles, widgets
• State Management Layer: models (e.g., cart_model.dart, user_model.dart)
• Data Access Layer: datas (e.g., product_data.dart, cart_product.dart)
b. Firebase Backend Services
• Authentication: sign-up / login
• Firestore Database: products, carts, orders, users
• Storage (optional): product images, demo assets
• (Potentially) Cloud Functions: coupon validation, order status updates
c. External Integrations
• Google Maps API (store location)
• Phone dialer (tel:// link)
Architectural Patterns & Design Principles
• Layered Architecture (Presentation → State → Data → Backend)
• MVVM / ScopedModel (models publish state changes to UI)
• Single codebase for Android & iOS via Flutter
• Asynchronous, event-driven calls to Firebase SDK
Relationships & Interactions
1) User taps a UI widget (e.g., “Add to Cart” button in product_tile.dart).
2) UI calls CartModel (in lib/models/cart_model.dart) → updates in-memory cart state.
3) CartModel invokes CartProduct data class (in lib/datas/cart_product.dart) → persists to Firestore via Firebase SDK.
4) Firestore triggers snapshot listeners → Model updates are propagated back to UI.
5) Authentication flows (signup_screen.dart, login_screen.dart) call Firebase Auth SDK → user credentials stored in Firestore user collection.
6) Order tracking screen subscribes to order document updates for status changes.
7) “View Location” link uses Maps Intent; “Call” link uses platform phone dialer.
1. Flutter UI Layer (Screens, Tabs, Tiles, Widgets)
2. State Management Layer (ScopedModel/ViewModel classes)
3. Data Access Layer (Dart data classes + Firebase SDK calls)
4. Firebase Cloud Services (Auth, Firestore, Storage) + External APIs
• Use rectangles for components:
• Blue for UI components (e.g., HomeScreen, ProductTile)
• Green for Models/ViewModels (e.g., CartModel, UserModel)
• Orange for Data classes & SDK interfaces (e.g., ProductData, CartProduct, Firebase SDK)
• Purple for Backend services (Auth, Firestore, Storage)
• UI → Model (user actions)
• Model → Data layer (CRUD calls)
• Data layer → Firebase services (network I/O)
• Firebase → Data layer → Model → UI (data updates)
Final Recommendations
• Every directory‐to‐class mapping: e.g., “lib/screens/cart_screen.dart → CartScreen widget.”
• Do not over-complicate: four to five major blocks, with subcomponents grouped inside.
• Iterate: start with a high-level sketch, then drill down to show key classes and interactions.