How derisstrict/pnbfoods works
1. Project shape
- This is a Flutter client application called pnbfoods.
- It is built to run on Android, iOS, web, Linux, macOS, and Windows, but the actual app behavior lives in lib/; the platform folders are mostly Flutter-generated runners and launch shells.
2. Core application entry
- The app entrypoint is lib/main.dart.
- From the file layout, the app likely boots into an authentication or role-selection flow before routing users into the buyer or seller experience.
3. High-level product domain
- The repository models a food ordering system with two main user roles:
- Pembeli = buyer/customer
- Penjual = seller/vendor
- The app domain includes canteens (kantin), products (produk), carts (keranjang), orders (orderan), payments (pembayaran), favorites (favorit), and history/receipts (riwayat).
4. Authentication and account boundary
- lib/auth/ contains the login and access-control flow:
- login page
- forgot password
- role selection
- authentication orchestration
- lib/akun/ contains user account management:
- user profile
- edit user
- change password
- This suggests identity and profile management are separated from the purchase/order flows.
5. Shared UI building blocks
- lib/common/ holds reusable UI components used across multiple screens:
- forms
- login form
- navbar
- top bar
- buttons
- color/theme constants
- a “palang tamu” component, likely a guest-access or banner-style widget
- These shared widgets form the app’s presentation layer and reduce duplication across buyer and seller screens.
6. Buyer-facing subsystem
- lib/pembeli/ is the main customer flow and is organized by business capability:
- list_kantin for browsing canteens
- list_produk for product browsing
- deskripsi_makanan for product detail pages
- favorit for saved items
- keranjang for cart review and checkout details
- order for order submission
- pembayaran for payment execution
- riwayat for transaction history
- This is the main end-user journey: browse → inspect → favorite/cart → order → pay → review history.
7. Payment flow boundary
- The payment area has its own widgets for:
- QR-style payment display (qris_box)
- payment button/action
- countdown timer for expiration
- That indicates payment is treated as a distinct stage after checkout, with time-sensitive UI state.
8. Seller-facing subsystem
- lib/penjual/ covers the merchant/admin side:
- dashboard
- canteen form
- product form
- order management
- The seller flow is focused on content management and fulfillment, not consumer browsing.
- The pesanan screen and its detail widget imply sellers can inspect incoming orders and act on them.
9. Data model layer
- lib/models/ defines the app’s shared domain objects:
- people and roles: pelanggan, penjual
- catalog: kantin, produk
- shopping state: keranjang, item_keranjang, favorit
- order lifecycle: orderan, detail_orderan, item_riwayat
- payment state: pembayaran
- These models are the main contract between UI and service layers.
10. Service/API layer
- lib/services/ is a dedicated data-access boundary, with one service per domain area:
- cart, favorites, canteens, products
- orders, order details, payments
- buyer/seller/user services
- history/riwayat
- base_url.dart indicates the app talks to an external backend API rather than storing business data locally in the client.
11. Architecture pattern
- The app is structured as a feature-based Flutter UI with:
- presentation widgets/screens in feature folders
- domain models in models/
- network/API calls in services/
- The main data flow is: screen → service → backend API → model → UI update.
12. Assets and theming
- The repo includes assets/img, fonts, and platform-specific launch/background assets.
- These support branding and visual consistency but are not central to the business architecture.
13. Platform/runtime boundaries
- The Android, iOS, desktop, and web folders are standard Flutter platform scaffolding.
- Native code exists only as generated launchers/bootstrap code (MainActivity.kt, AppDelegate.swift, Windows/Linux runners), while the product logic remains cross-platform in Dart.
14. Testing and tooling
- There is a minimal Flutter widget test in test/widget_test.dart.
- analysis_options.yaml, Gradle/Xcode configs, and Flutter tool files show a standard Flutter development toolchain, with no separate backend or microservice code inside this repository.
Main entry points: services Services · autentikasi.dart Auth · list_produk.dart Products · list_kantin.dart Canteens
Components 21
App Shell
Cross-platform Flutter entrypoints and generated runners.
- Main · Application bootstrap and startup routing.
lib/main.dart
Core Client
Shared UI, auth, account, and home navigation.
- Auth · Authentication and role selection boundary.
lib/auth/autentikasi.dart - Login · User sign-in page.
lib/auth/login_page.dart - Role Select · Chooses buyer or seller experience.
lib/auth/role_page.dart - Account · User profile editing and password change.
lib/akun/akun_user.dart - Home · Main landing screen after entry flow.
lib/homepage/home.dart - Shared UI · Reusable forms, bars, buttons, and theme constants.
lib/common
Buyer Flow
Customer-facing browsing, cart, checkout, payment, and history.
- Canteens · Browse canteens and product listings.
lib/pembeli/list_kantin/list_kantin.dart - Products · Product listing and product cards.
lib/pembeli/list_produk/list_produk.dart - Product Detail · Food description and item details.
lib/pembeli/deskripsi_makanan/deskripsi_makanan.dart - Favorites · Buyer favorites and favorite toggle UI.
lib/pembeli/favorit/favorit_page.dart - Cart · Cart review, pickup, payment method, and order summary.
lib/pembeli/keranjang/page_keranjang.dart - Order · Order placement stage.
lib/pembeli/order/page_order.dart - Payment · QR payment, countdown expiry, and payment action.
lib/pembeli/pembayaran/page_pembayaran.dart - History · Purchase history and receipt details.
lib/pembeli/riwayat/page_riwayat.dart
Seller Flow
Merchant dashboard and fulfillment tools.
- Seller Dash · Seller overview and operational hub.
lib/penjual/dashboard/dashboard.dart - Seller Forms · Canteen and product creation/editing screens.
lib/penjual/form_kantin/form_kantin.dart - Seller Orders · Incoming order inspection and order detail view.
lib/penjual/pesanan/pesanan.dart
Connections 27
- Main → Auth: boots · App starts in authentication and role routing.
- Auth → Login: sign-in · Authentication flow exposes login UI.
- Auth → Role Select: choose role · Routes users into buyer or seller experience.
- Auth → Home: enter app · Successful entry proceeds to main navigation.
- Home → Account: profile · Home connects to account management.
- Home → Canteens: browse · Buyer browsing starts from the home experience.
- Shared UI → Auth: supports · Shared widgets are used by authentication screens.
- Shared UI → Canteens: supports · Reusable UI supports buyer screens.
- Shared UI → Seller Dash: supports · Shared UI supports seller screens.
- Canteens → Products: explore · Canteen browsing leads into product lists.
- Products → Product Detail: open · Product list opens item detail views.
- Products → Favorites: save · Products can be added to favorites.
- Products → Cart: add · Products flow into cart and checkout.
- Cart → Order: checkout · Cart prepares and submits an order.
- Order → Payment: pay · Placed orders proceed to payment.
- Payment → History: record · Completed payments are reflected in history.
- Seller Dash → Seller Forms: manage catalog · Seller dashboard opens management forms.
- Seller Dash → Seller Orders: fulfill · Dashboard surfaces incoming orders.
- Services → Models: returns · API calls populate shared domain models.
- Services → API Base: configures · Services use the backend base URL.
- Auth → Services: auth api · Login and role flow depend on backend services.
- Account → Services: profile api · Account updates use service calls.
- Canteens → Services: catalog api · Buyer catalog screens fetch remote data.
- Cart → Services: cart api · Cart state is coordinated through services.
- Payment → Services: payment api · Payment stage talks to backend payment endpoints.
- Seller Orders → Services: order api · Seller fulfillment uses order services.
- History → Services: history api · History screens load transaction data from services.