How leduonng/pos_cafe works
Main Components
• Frontend (Presentation Layer):
• Flutter/Dart based UI located mainly in the lib/views folder.
• Different screen categories: Admin (e.g., dashboard, bill management, configuration), POS (e.g., cart, order management, QR code processing), CRUD screens (e.g., ingredients, menu, users).
• Reusable UI Widgets (lib/views/widgets) and state management through Provider.
• Business Logic Layer:
• Controllers located in lib/controllers that encapsulate the application’s business logic for various functions such as orders, payments, customer points, and more.
• Data Models:
• Models in lib/models that represent the domain entities (e.g., orders, bills, users, inventory items). These serve as the data contracts through the system.
• Data & External Services:
• Database: MySQL integration (via lib/connect_mysql.py) provides persistent storage for the business data.
• Local Storage: Usage of Hive for local data storage as indicated in the README.
• Python Scripts: For data processing tasks—note the presence of scripts in assets/data (craw_data.py) and additional utility scripts (lib/notification.py).
• Assets & Resources:
• Static assets such as images, fonts, animations, and CSV files found under the assets directory.
• These resources serve the UI, analytics (charts), and animations (using Rive).
Relationships and Interactions
• The Frontend (UI screens) interacts with the Controllers to send user events and receive processed data.
• Controllers utilize Models to validate and manipulate data.
• Controllers then interact with the database layer via the MySQL connection script for CRUD operations.
• The application uses additional libraries and external services (e.g., go_router for navigation, hive for caching, PDF and printing libraries) connected to relevant layers.
• Python scripts and other data processing utilities may interact with the database and asset data to support backend functionalities.
Architectural Patterns and Technologies
• MVC/MVVM Pattern: The division into Views (UI screens), Controllers (business logic), and Models (data structures) reflect a clear separation of concerns.
• Service Integration: Note the integration with external libraries for animations (Rive), charting (fl_chart, syncfusion_flutter_charts), and printing functionalities.
• Data Pipeline: Inclusion of data processing scripts (Python) that feed into static assets or help pre-process data before insertion into MySQL.