Shop-floor HMI (Windows desktop .exe) and QC tablet app (Android) for LineGuard MES. Backend:
Zee7X/LineGuard-MES-BE.
Built with Flutter 3.50 (Dart 3.14), Riverpod 3, Dio, signalr_netcore, fl_chart, flutter_secure_storage
and drift.
Light "bento" design (Outfit font bundled offline): floating icon sidebar on desktop/tablet, bottom bar on phones.
| Desktop HMI | Tablet | Phone |
|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
Regenerate with SCREENSHOTS_DIR=build/screenshots flutter test test/layout_test.dart (sample data, no backend). App icons: python3 tool/generate_icons.py <MaterialIcons-Regular.otf>.
| Module | What the app does |
|---|---|
| Login & shift (FR-1) | Employee ID + password, shift selection for operators/supervisors, session resumed from the OS keystore, 15-minute idle auto-lock on desktop (unlock = password re-verified by the server). |
| Live dashboard (FR-3) | Line overview cards with ISA colours (green running, yellow warning/idle, red fault/stopped, blue maintenance), 60-second rolling temperature/pressure charts with MAX lines, current-shift OEE gauges, anomaly injection for Admin/Supervisor. |
| Alarms (FR-3.3) | Real-time alarm push with sound, badge in the app bar, acknowledgement with mandatory action notes. |
| Weighing (FR-4) | Supervisor creates production orders; operator sees the live scale (SETTLING/STABLE), captures weight, gets the Lot ID. Out-of-tolerance opens the supervisor override flow (written reason + supervisor co-signature at the station). |
| Downtime (FR-5) | Auto-opened tickets with live duration; root cause + description required to release the machine. |
| QC (FR-6) | Tablet-friendly queue updated live, pH/moisture/viscosity/visual entry, PASS/HOLD/REJECT signed with an e-signature. Offline drafts stored AES-256-GCM encrypted in SQLite (drift); when the connection is back the inspector reviews and signs each draft (signatures are never stored or replayed). |
| Reports (FR-7.1/7.2) | Shift summary, OEE table, downtime Pareto, critical alarms; export PDF/CSV to a chosen file. |
| Audit (FR-7.3) | Filter by entity/action/user/date, old/new values, hash-chain verification (Plant Manager/Admin). |
| Admin | Users & roles (create, edit, deactivate, reset password, unlock), machine thresholds with e-signature. |
Navigation is filtered by role; the server enforces every permission regardless of the UI.
- Access token kept in memory only; refresh token, device id and the draft encryption key in
flutter_secure_storage(Windows Credential Manager / DPAPI, Android Keystore). Nothing in SharedPreferences or plain files. - Automatic token refresh with a single in-flight request; if the server revokes the session (logout, reuse detection, account disabled) the app returns to the login screen.
- HTTPS only (plain HTTP is rejected unless built with
--dart-define=LINEGUARD_ALLOW_INSECURE=truefor local dev). Android: cleartext traffic disabled, backups disabled. - Every request carries
X-Device-IdandX-Correlation-Id(shown in error messages for support). - SignalR uses WebSockets with exponential backoff (1 s → 30 s, jitter, unlimited) and an
OFFLINE MODEbanner.
flutter pub get
# Desktop HMI (Windows)
flutter run -d windows --dart-define=LINEGUARD_API=https://mes-server:7080
# QC tablet (Android)
flutter run -d <device> --dart-define=LINEGUARD_API=https://mes-server:7080Build-time options (--dart-define):
| Key | Default | Purpose |
|---|---|---|
LINEGUARD_API |
https://localhost:7080 |
Default server URL (can be changed on the login screen, stored in the keystore). |
LINEGUARD_IDLE_LOCK_MINUTES |
15 |
Desktop idle auto-lock, 0 disables. |
LINEGUARD_ALLOW_INSECURE |
false |
Allow http:// for local development only. |
Release builds: flutter build windows --release → build/windows/x64/runner/Release/lineguard_mes.exe;
flutter build apk --release. CI (.github/workflows/ci.yml) runs analyze + tests and uploads the Windows build
and the APK as artifacts. Set the repository variable LINEGUARD_API to bake in your server URL. The APK is signed
with the debug key until you configure a release keystore.
| Workflow | Trigger | Output |
|---|---|---|
flutter-ci |
pull requests, main |
analyze + tests, Windows and Android build check |
release |
tag v* or manual run |
GitHub Release with LineGuard-MES-Setup.exe, LineGuard-MES-LocalDemo-Setup.exe (app + local server), portable zips and lineguard-qc-android.apk |
pages |
push to main |
Web test build at https://zee7x.github.io/LineGuard-MES/ |
Builds point to the hosted test API https://lineguard-api-9bgq.onrender.com (Render + Neon) unless the LINEGUARD_API repository variable overrides it.
Windows installers (recommended): every release has two Setup.exe files. They install per user (no admin
rights), add Start-menu/desktop shortcuts and an uninstaller, and bundle the Visual C++ runtime.
LineGuard-MES-Setup.exe: the desktop HMI, connected to the hosted server.LineGuard-MES-LocalDemo-Setup.exe: fully offline demo. Installs the app and the local API server (SQLite file database, from the latest backend release). Start LineGuard Local Server first (it asks once for the demo password), then LineGuard MES Local Demo.
Portable zips (lineguard-mes-windows*.zip) are still attached for running without installing. The installers are
not code-signed yet, so Windows SmartScreen shows "Windows protected your PC" → More info → Run anyway.
Web build (GitHub Pages): the page is served over HTTPS, so the browser can only reach an API that is also
HTTPS and allows the https://zee7x.github.io origin (CORS), e.g. the Render + Neon setup described in the backend
README. Enter the API address with the server button on the login screen. On the web, tokens are kept by
flutter_secure_storage in browser storage (encrypted with WebCrypto), which is weaker than the OS keystore: use the
web build for testing only. Offline drafts use SQLite compiled to WASM (web/sqlite3.wasm, web/drift_worker.js).
dart run build_runner build # only after changing the drift table
flutter analyze
flutter test
# Contract test against a running backend (dev server with Seed:DemoPassword):
LINEGUARD_E2E_URL=http://127.0.0.1:5080 LINEGUARD_E2E_PASSWORD=<demo password> flutter test test/e2e_api_test.dartThe end-to-end test drives the full flow through the client API layer and SignalR: order → scale STABLE → capture → out-of-tolerance override with supervisor co-sign → QC release with e-signature → RBAC 403 → shift report PDF → audit chain verification.




