Skip to content

Preston2012/choplight

Repository files navigation

ChopLight

Gesture flashlight for Android. Double-chop your wrist, torch turns on. Chop again, torch turns off.

Built by Preston Winters at Winters Code.

Flutter Dart Platform License: MIT

Status: code complete, pending Play Store launch.


What it does

A flashlight you trigger by gesture, not by tapping a screen.

Two sharp wrist movements (a "double chop") toggle the camera torch. Works with the screen off, the phone in your pocket, or your hands full. Runs as a foreground service so accelerometer sampling continues with the screen locked.

Designed for: walking the dog at night, finding the keyhole in the dark, hands full of groceries, getting up at 2am.

How it works

  1. Accelerometer sampling. Sensors-plus stream at 20ms (or 50ms in battery saver mode).
  2. Peak detection. A chop is a sharp spike above the calibration threshold (default: 80% of average peak from 5-chop calibration).
  3. Pattern matching. Two peaks within 600ms = double chop. Three peaks within 900ms = SOS trigger (premium).
  4. Action dispatch. Camera torch toggle via torch_light, or SOS pattern loop via the same.

The state model is a singleton with stream-based detection. The foreground service keeps the isolate alive when the screen is off.

Architecture

lib/
├── main.dart                          # Entry point + onboarding gate
├── theme.dart                         # OLED black, amber accent
├── state/
│   └── chop_light_state.dart          # Singleton state + sensor stream
├── services/
│   ├── chop_light_functions.dart      # SharedPreferences, RevenueCat init
│   └── chop_light_actions.dart        # All user-triggered actions
├── screens/
│   ├── onboarding_screen.dart         # 5-chop calibration on first run
│   ├── home_screen.dart               # One big circle. Glow = on.
│   └── settings_screen.dart           # All toggles + premium gate
└── widgets/
    ├── torch_circle.dart              # The home circle widget
    └── upgrade_sheet.dart             # RevenueCat purchase sheet

About 3,200 lines of Dart. Single feature, well-factored.

Stack

  • Flutter 3.16+ / Dart 3.2+
  • sensors_plus for accelerometer streams
  • torch_light for camera torch control
  • flutter_foreground_task for background detection (Android specialUse FGS)
  • purchases_flutter (RevenueCat) for the freemium gate
  • shared_preferences for state persistence
  • vibration + battery_plus for haptics and battery guard

No backend. All processing on-device. No network calls except RevenueCat.

Pricing

Free tier: double-chop toggle, calibration, pocket lock, demo mode, battery saver, chop counter.

Premium ($0.99/mo with 7-day trial, or $4.99 lifetime): SOS pattern, auto-off timer, battery guard, screen flash mode, sensitivity slider, gesture test.

See CHOPLIGHT_FEATURE_SPEC.md for the full locked spec.

Build

This repo is the source. To build:

  1. flutter pub get
  2. Configure Android manifest permissions (see CHOPLIGHT_DEPLOY_GUIDE.md)
  3. Replace goog_YOUR_REVENUECAT_KEY in lib/services/chop_light_functions.dart with your real key
  4. flutter build appbundle --release

The deploy guide walks through the full Play Store submission process, including the foreground-service-specialUse declaration which Google requires explicit justification for.

License

MIT. See LICENSE.

Contact

winterscode.com | preston@winterscode.com

Part of Winters Code, a solo software shop in Bandon, Oregon.

About

Gesture flashlight for Android. Double-chop your wrist, torch toggles. Flutter + Dart, foreground service, freemium via RevenueCat.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages