The example app uses a feature-first layout with Clean Architecture boundaries.
lib/
├── app/ # Global app shell
│ ├── main.dart
│ ├── bindings/
│ ├── routes/
│ └── theme/
├── core/ # Shared infrastructure
│ ├── constants/
│ ├── exports/
│ ├── services/
│ ├── utils/
│ └── widgets/ # Barrel: widgets.dart (vital cards, tabs, scaffolds, …)
└── features/
├── splash/
├── vitals/ # Home + health detail screens
├── device/ # Pairing & settings
├── profile/
└── health/ # Apple Health / Google Fit
Each feature follows this shape:
data/— repository implementations, models, datasource adaptersdomain/— repository interfaces, entities, use casespresentation/— GetX controllers, bindings, views/widgets
Allowed direction only:
presentation -> domaindata -> domainapp -> featuresandapp -> core
Not allowed:
domain -> datadomain -> presentationcore -> features- direct cross-feature access to concrete implementations
See full rules in docs/architecture/dependency-rules.md.
AppTheme.light/AppTheme.darkonGetMaterialAppThemeControllerpersists mode via GetStorageThemeToggleButtonon main vitals app bar- Prefer
Theme.of(context)andcontext.appThemeover hard-coded colors
Vitals chart/detail pages use a controller + thin view:
| Screen | Controller | Body widget |
|---|---|---|
| Heart rate | HeartRateDetailController |
heart_rate_detail_body.dart |
| SpO₂ | OxygenDetailController |
oxygen_detail_body.dart |
| Blood pressure | BloodPressureDetailController |
blood_pressure_detail_body.dart |
| Temperature | TemperatureDetailController |
temperature_detail_body.dart |
| Sleep (day/week/month) | SleepDetailsController |
sleep_details_body.dart |
| Activities (steps/cal/distance) | ActivitiesDetailsController |
activities_details_body.dart |
| Activity monitor | ActivityMonitorController |
activity_monitor_body.dart |
| Band reminders | BandRemindersController |
band_reminders_body.dart |
| Do not disturb | DoNotDisturbController |
do_not_disturb_body.dart |
| Weather on band | WeatherInDetailsController |
weather_in_details_body.dart |
| Firmware upgrade | FirmwareUpgradeController |
firmware_upgrade_body.dart |
| Apple/Google bind | AppleGoogleBindController |
apple_google_bind_body.dart |
| Profile update | ProfileUpdateController |
profile_update_body.dart |
Shared mixins: VitalDetailDateMixin (day navigation), BleTestListenerMixin (BP/SpO₂/temp BLE callbacks).
Charts and stat rows use Obx so only the chart/stats rebuild when data changes—not the full scaffold.
- App-level shared services are registered in
app/bindings/initial_binding.dart. - Feature-level repositories and use cases are registered in feature bindings (for example
vitals_binding.dart,device_binding.dart). - Controllers should depend on use cases/repositories, not directly on shared service internals when a feature abstraction exists.
VitalMainControllerkeeps BLE/sync orchestration out of the widget tree.VitalMainStepsCard,VitalMainStatusBanners,VitalMainVitalListreduce rebuild scope.GetBuilder/Obxare used for targeted updates.- Syncfusion charts are wrapped with
RepaintBoundaryin detail screens.
vital_data_widget.dart,icon_text_widget.dart,dwm_tabs.dart— vitals home & tabbed detailscupertino_button_widget.dart,custom_assets_bar.dart— forms and sleep chartsvital_detail_scaffold.dart— detail page scaffolds (below)
VitalColoredAppBar— accent header + theme toggle (HR, BP, SpO2, …)SettingsPageScaffold— settings/reminders/DND screensDetailDateNavigator/DetailActivityHeader— reused on chart detail pagesVitalTabDetailScaffold— tabbed vitals (activities, sleep, temperature)
Use focused barrels and direct imports instead of one mega-export:
| Barrel | Use when |
|---|---|
core/exports/core_exports.dart |
Flutter + GetX only |
common/common_imports.dart |
Band SDK + constants + GlobalMethods |
core/exports/vitals_imports.dart |
Detail screens with charts + shared widgets |
| Direct imports | Theme, a single widget, or one model |
Avoid importing widgets.dart in controllers or services.
- Docs index: docs/README.md
- Plugin full workflow: docs/plugin/full-implementation-guide.md
- Feature template: docs/architecture/feature-template.md