A Flutter app that delivers motivation with a shake!
Shake your phone to instantly reveal a random motivational quote — powered by Flutter and native Android sensors.
As a student who loves motivation, I want my phone to show a random motivational quote whenever I shake it —
so I can get an instant dose of inspiration during study sessions without touching the screen!
Shake to Get a Quote demonstrates seamless communication between Flutter and native Android (Kotlin) code using Platform Channels.
It combines elegant Flutter UI with real device sensors for an interactive, real-world experience.
When the phone detects a shake:
- Kotlin captures accelerometer data using the Android SensorManager.
- It sends the shake event to Flutter via EventChannel.
- Flutter responds by displaying a motivational quote with smooth animation or toast notification.
- Detects device shakes using
SensorManagerandSensorEventListener(Kotlin). - Implements a simple yet effective shake detection algorithm.
- Communicates shake events to Flutter in real time via EventChannel.
- Receives events and displays random motivational quotes.
- Animated transitions and engaging visuals.
- Lightweight, responsive, and cross-platform ready.
- EventChannel: Sends continuous shake events from Kotlin → Flutter.
- MethodChannel (optional): Used to initialize or control native listeners (e.g., start/stop detection).
| Layer | Technology | Description |
|---|---|---|
| UI | Flutter | Beautiful, reactive UI |
| Native | Kotlin | Access to Android hardware sensors |
| Bridge | Platform Channels | Communication between Flutter & Android |
| Sensors | SensorManager | Detects accelerometer motion |
-
Shake Detection:
The Android side listens to accelerometer data usingSensorManager.
If acceleration exceeds a threshold → triggersonShakeDetected. -
Event Transmission:
Kotlin sends a message to Flutter using anEventChannel. -
Flutter Reaction:
Flutter receives the event and randomly selects a motivational quote to display. -
UI Feedback:
The quote appears with a friendly animation or toast, making the experience delightful.
- Shake the phone → ✨ A random quote appears instantly
git clone https://github.com/your-username/shake-to-get-quote.gitcd shake-to-get-quoteflutter pub getflutter run💼 Mobile Application Developer
🌐 Portfolio: [https://www.linkedin.com/in/israa-essa-3b5644384]
💻 GitHub: [Israa050]
This project is licensed under the MIT License — free to use, modify, and share.