A production-ready Flutter Android application for educational VR video playback using smartphone-based VR Box viewers.
This offline educational app teaches HIV/AIDS prevention through choice-based video branching. Users make choices on a normal screen, then experience the consequences through VR video playback.
Key Features:
- β State-based navigation (8 states)
- β Offline-only (no backend, no networking)
- β VR split-screen video playback
- β No interaction inside VR mode
- β Simple, production-ready architecture
0. Main Menu β PLAY button
1. Role Selection β Gay or Sex Worker (PSK)
2. Behavior Selection β Risky or Safe
3. VR Mode: Time Lapse β 5 year video (auto-exit)
4. Health Result β HIV+ (risky) or Healthy (safe)
5. Decision (if HIV+) β Continue risky? YES/NO
6A. VR Mode: Negative Outcome β Death (auto-exit)
6B. VR Mode: Recovery β Education (auto-exit)
7. Final Education β Prevention message, restart option
- Flutter SDK: 3.0.0 or higher
- Dart SDK: 3.0.0 or higher
- Android: Minimum SDK 21 (Android 5.0)
- Device: Android smartphone with landscape orientation support
cd /data/Projects/j_vbox_fe
# No need to run flutter create - already initializedfvm flutter pub getPlace the following client-provided video files in assets/videos/:
gay_risky.mp4- VR video for gay + risky behaviorgay_safe.mp4- VR video for gay + safe behaviorpsk_risky.mp4- VR video for PSK + risky behaviorpsk_safe.mp4- VR video for PSK + safe behaviorpositive_end.mp4- VR video for negative outcome (death)recovery.mp4- VR video for recovery path
Important: All videos must be in MP4 format and optimized for VR viewing.
Place a button press sound file in assets/sounds/button_press.mp3
If you don't have a sound file, the app will work silently (sound failures are handled gracefully).
# Debug mode
fvm flutter run
# Release mode (for testing)
fvm flutter run --releasefvm flutter build apk --debugfvm flutter build apk --releaseThe APK will be located at: build/app/outputs/flutter-apk/app-release.apk
Uses ChangeNotifier with Provider for simple, reactive state management.
AppController manages:
- Current application state (8 states)
- User selections (role, behavior)
- Health determination logic
- Video path resolution
- State transitions
lib/
βββ main.dart # App entry point
βββ models/
β βββ app_enums.dart # AppState, UserRole, BehaviorType enums
βββ controllers/
β βββ app_controller.dart # Central state management
βββ screens/ # 9 screen widgets (normal + VR)
β βββ main_menu_screen.dart
β βββ role_selection_screen.dart
β βββ behavior_selection_screen.dart
β βββ vr_time_lapse_screen.dart
β βββ health_result_screen.dart
β βββ decision_screen.dart
β βββ vr_negative_outcome_screen.dart
β βββ vr_recovery_screen.dart
β βββ final_education_screen.dart
βββ widgets/
β βββ vr_video_player.dart # VR split-screen player
βββ utils/
βββ constants.dart # Colors, styles, video paths
βββ sound_manager.dart # Button sound effects
assets/
βββ videos/ # VR video files (6 videos)
βββ sounds/ # Button press sound
- provider: ^6.1.1 - State management
- video_player: ^2.8.2 - Video playback
- audioplayers: ^5.2.1 - Sound effects
VR-Friendly Dark Theme:
- Dark background (#0A0E27) for VR comfort
- High contrast colors
- Large buttons (300x80)
- Clear typography
Colors:
- Primary: #6C63FF (purple)
- Secondary: #4ECDC4 (teal)
- Success: #45B7D1 (blue)
- Warning: #FFA07A (orange)
- Danger: #FF6B6B (red)
The VRVideoPlayer widget displays the same video twice side-by-side for VR Box viewing:
βββββββββββββββββββββββ¬ββββββββββββββββββββββ
β β β
β Left Eye View β Right Eye View β
β (same video) β (same video) β
β β β
βββββββββββββββββββββββ΄ββββββββββββββββββββββ
- β Fullscreen immersive mode (hides system UI)
- β Auto-play on load
- β Auto-exit on video completion
- β No user controls (no play/pause/seek)
- β Landscape orientation locked
- β Screen stays on during playback
fvm flutter test-
Navigation Flow
- Main menu displays correctly
- Role selection works (Gay/PSK)
- Behavior selection works (Risky/Safe)
- All 4 role+behavior combinations work
-
VR Mode
- Video loads and auto-plays
- Split-screen displays correctly
- Video completes and auto-exits
- System UI is hidden during playback
-
Health Logic
- Risky behavior β HIV Positive
- Safe behavior β Healthy
- HIV+ leads to decision screen
- Healthy leads to final education
-
Decision Outcomes
- YES β Negative outcome video β Main menu
- NO β Recovery video β Final education
-
VR Box Testing
- Test on physical device with VR Box
- Verify video alignment
- Check comfort and viewing experience
Issue: Video shows loading screen forever or error.
Solutions:
- Verify video files are in
assets/videos/directory - Ensure video files are named exactly as specified
- Check video format is MP4
- Try different video codecs (H.264 recommended)
- Reduce video resolution if file is too large
Issue: Button press sounds not playing.
Solutions:
- Sound failures are handled gracefully - app still works
- Add
button_press.mp3toassets/sounds/ - Check audio file format (MP3 or WAV recommended)
- Verify device volume is not muted
Issue: App doesn't lock to landscape.
Solutions:
- Check
AndroidManifest.xmlhasandroid:screenOrientation="landscape" - Verify
main.dartsets preferred orientations - Test on different Android devices
Issue: Flutter build fails.
Solutions:
# Clean build
fvm flutter clean
fvm flutter pub get
# Update dependencies
fvm flutter pub upgrade
# Check Flutter doctor
fvm flutter doctor -v- β No VR controllers
- β No gaze interaction
- β No in-VR user interaction
- β No networking or API calls
- β No backend or analytics
- β No authentication
- β No Unity or game engine
Before releasing:
- All 6 video files are optimized and tested
- Videos are in VR-compatible format
- APK is signed for distribution
- App has been tested on multiple devices
- VR Box compatibility verified
- User flow tested end-to-end
- Educational content reviewed for accuracy
Project developed for HIV/AIDS prevention education.
For issues or questions, refer to the ARCHITECTURE.md document for detailed technical information.