A Flutter mobile application for managing order suggestions and purchase orders, integrated with the TrueUp Lite backend API.
- Generate Order Suggestions: Automatically generate purchase recommendations based on stock levels and reorder points
- Supplier-wise Grouping: View suggestions organized by suppliers
- Product Details: View detailed product information including current stock, minimum thresholds, and suggested quantities
- Quantity Adjustments: Modify suggested quantities before creating purchase orders
- Basket Management: Add, remove, and update items in your purchase basket
- Supplier Grouping: View basket items grouped by suppliers
- Bulk Operations: Add multiple items to basket at once
- Create Purchase Orders: Generate purchase orders directly from basket items
- Order History: View past order suggestions with detailed information
- Weekly Purchase History: Analyze purchase patterns over time
- Statistics: Get insights into ordering patterns and costs
- Excel Export: Export order suggestions to Excel format
- PDF Export: Generate PDF reports of order suggestions
- Text Export: Export data in simple text format
- Riverpod: Used for state management and dependency injection
- Provider Pattern: Clean separation of business logic and UI
- HTTP Client: RESTful API integration with the TrueUp Lite backend
- Error Handling: Comprehensive error handling and user feedback
- Offline Support: Graceful handling of network issues
- Material Design 3: Modern, consistent UI following Material Design guidelines
- Responsive Layout: Optimized for different screen sizes
- Loading States: Clear feedback during data loading
- Error States: User-friendly error messages and retry options
lib/
├── main.dart # App entry point
├── models/ # Data models
│ ├── supplier_order_suggestion.dart
│ ├── product_order_suggestion.dart
│ ├── po_basket_item.dart
│ ├── order_suggestion_history.dart
│ ├── weekly_purchase_history.dart
│ ├── request_models.dart
│ └── response_models.dart
├── providers/ # State management
│ └── order_suggestions_provider.dart
├── screens/ # UI screens
│ ├── home_screen.dart
│ └── order_suggestions/
│ ├── order_suggestions_screen.dart
│ ├── order_suggestions_basket_screen.dart
│ ├── order_suggestions_history_screen.dart
│ └── weekly_purchase_history_screen.dart
└── services/ # API services
└── api_service.dart
- Flutter SDK (3.0.0 or higher)
- Dart SDK (3.0.0 or higher)
- Android Studio / VS Code with Flutter extensions
- TrueUp Lite Backend running (for API integration)
-
Clone the repository
git clone <repository-url> cd trueup-lite-flutter
-
Install dependencies
flutter pub get
-
Generate code (for JSON serialization)
flutter packages pub run build_runner build
-
Configure API endpoint
Update the
baseUrlinlib/services/api_service.dart:static const String baseUrl = 'http://your-backend-url:8080';
-
Run the app
flutter run
The app expects the TrueUp Lite backend to be running with the following endpoints available:
GET /order-suggestions/generate- Generate order suggestionsPOST /order-suggestions/basket/add- Add items to basketGET /order-suggestions/basket- Get basket itemsPOST /order-suggestions/basket/create-po- Create purchase ordersGET /order-suggestions/history- Get order historyGET /order-suggestions/weekly-purchase-history- Get weekly history
Update the API base URL in lib/services/api_service.dart to point to your backend server:
static const String baseUrl = 'http://localhost:8080'; // Change thisThe app is configured for Android builds. For iOS builds, additional configuration may be required.
- Displays supplier-wise order suggestions
- Shows product details with stock information
- Allows adding items to basket
- Supports bulk operations
- Real-time basket updates
- Supplier grouping
- Item quantity modifications
- Purchase order creation
- Paginated order history
- Weekly purchase analytics
- Detailed action tracking
| Endpoint | Method | Purpose |
|---|---|---|
/order-suggestions/generate |
GET | Generate order suggestions |
/order-suggestions/generate-for-suppliers |
POST | Generate for specific suppliers |
/order-suggestions/update-quantities |
POST | Update suggested quantities |
/order-suggestions/create-purchase-order |
POST | Create purchase order |
/order-suggestions/basket/add |
POST | Add item to basket |
/order-suggestions/basket/remove/{id} |
DELETE | Remove item from basket |
/order-suggestions/basket/update |
PUT | Update basket item |
/order-suggestions/basket |
GET | Get basket items |
/order-suggestions/basket/clear |
DELETE | Clear basket |
/order-suggestions/basket/create-po |
POST | Create PO from basket |
/order-suggestions/basket/add-suggestion |
POST | Add suggestion to basket |
/order-suggestions/basket/add-multiple-suggestions |
POST | Add multiple suggestions |
/order-suggestions/basket/grouped |
GET | Get grouped basket items |
/order-suggestions/history |
GET | Get order history |
/order-suggestions/weekly-purchase-history |
GET | Get weekly history |
/order-suggestions/statistics |
GET | Get statistics |
/order-suggestions/export-excel |
POST | Export to Excel |
/order-suggestions/export-pdf |
POST | Export to PDF |
/order-suggestions/export-text |
POST | Export to text |
The app uses JSON serialization. After modifying model classes, run:
flutter packages pub run build_runner build --delete-conflicting-outputs- Create/update models in
lib/models/ - Add API methods in
lib/services/api_service.dart - Update providers in
lib/providers/ - Create/update UI screens in
lib/screens/
flutter testflutter build apk --releaseflutter build ios --release-
API Connection Issues
- Check if backend is running
- Verify API base URL configuration
- Check network connectivity
-
Build Issues
- Run
flutter cleanandflutter pub get - Regenerate code with build_runner
- Check Flutter and Dart SDK versions
- Run
-
State Management Issues
- Check provider configurations
- Verify data flow in Riverpod providers
- Check for proper error handling
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is part of the TrueUp Lite application suite.