mindfullness-app-flutter-androidstudio

🌿 5 Steps to Build the Ultimate Mental Wellness App in Flutter – Mood Tracker, Gratitude & Meditation

🌿 Build MindHaven: A Flutter Mental Wellness App with Mood Tracker, Gratitude, and Meditation

🌿 Build MindHaven: A Flutter Mental Wellness App with Mood Tracker, Gratitude, and Meditation

In today’s fast-paced world, mental wellness is more important than ever. With Flutter, you can create a powerful, cross-platform app to support mindfulness and emotional well-being. This beginner-friendly tutorial guides you through building MindHaven, a feature-rich mental wellness app that includes mood tracking, gratitude journaling, guided meditations, breathing exercises, calming soundscapes, and mindful reminders. Whether you’re a new Flutter developer or an experienced coder looking to create a meaningful project, this step-by-step guide provides everything you need to build a polished app with a modern UI, local storage via Hive, and optional cloud syncing with Firebase. Let’s create an app that inspires calm and positivity! 💚

By the end of this tutorial, you’ll have a fully functional app with a neumorphic design, animated timers, and shareable content, ready to run on Android, iOS, web, or desktop. Plus, you’ll learn how to integrate audio playback, local persistence, and cloud storage, making this a great project to showcase in your portfolio or share with others.

✨ Key Features of MindHaven

  • Mood Tracking: Log your emotions (Happy, Sad, Anxious, Calm) with notes and visualize mood trends over time.
  • Gratitude Journaling: Reflect on daily moments of gratitude with randomized prompts to inspire positivity.
  • Guided Meditations: Follow step-by-step meditation sessions with timers and reflection prompts for morning calm, stress relief, and more.
  • Breathing Exercises: Practice a 4-7-8 breathing cycle with an animated radial timer to promote relaxation.
  • Calming Soundscapes: Play looping audio tracks like rainforest or ocean waves with visual timers for immersive relaxation.
  • Custom Affirmations: Create and share personalized affirmations alongside a library of motivational quotes.
  • Mindful Reminders: Set periodic reminders to encourage mindfulness practices throughout the day.
  • Modern UI: Enjoy a neumorphic design with gradient backgrounds, animations, and dark/light mode support.
  • Offline Support: Store data locally with Hive, with optional Firebase cloud syncing for seamless access.

🛠️ Step 1: Create a New Flutter Project

Open your terminal or Android Studio and run the following command to create a new Flutter project:

flutter create mental_wellness_app

✅ Ensure you have Flutter installed and configured for Android, iOS, web, and desktop platforms. Run flutter doctor to verify your setup.


📦 Step 2: Configure pubspec.yaml

Open the pubspec.yaml file in your project and add the necessary dependencies for Hive, Firebase, audio playback, and sharing features. Also, include the audio assets for soundscapes. Replace the file’s contents with the configuration below. Click the button to view or hide the full code; a preview is shown below.


name: mind_haven
description: An offline mental health companion app
version: 1.0.0

environment:
  sdk: '>=2.12.0 <3.0.0'

dependencies:
  flutter:
    sdk: flutter
  hive: ^2.2.3
  hive_flutter: ^1.1.0
  share_plus: ^7.2.1
  firebase_core: ^2.24.0
  cloud_firestore: ^4.14.0
  google_fonts: ^6.1.0
  just_audio: ^0.9.39

flutter:
  uses-material-design: true
  assets:
    - assets/audio/rainforest_retreat.mp3
    - assets/audio/ocean_waves.mp3
    - assets/audio/mountain_breeze.mp3
    

Run flutter pub get to install the dependencies.


💻 Step 3: Implement main.dart

Navigate to lib/main.dart and replace its contents with the full Flutter code for MindHaven, which includes the UI, mood tracking, gratitude journaling, guided meditations, breathing exercises, soundscapes, and reminders. Download the main.dart file below to get the complete code.

The code sets up a responsive UI with neumorphic buttons, gradient backgrounds, and animations, using Hive for local storage and Firebase for optional cloud syncing.


🎵 Step 4: Add Calming Soundscape Files

Download royalty-free MP3 files for the soundscapes (e.g., rainforest, ocean waves, mountain breeze). Create an assets/audio folder in your project’s root directory and place the files there. Download the sample soundscape files below.

Ensure these files are listed under the assets: section in your pubspec.yaml as shown in Step 2.


🚀 Step 5: Run the App

Connect a device or emulator and run the app using:

flutter run

🎉 Congratulations! You’ve built MindHaven, a fully functional mental wellness app with mood tracking, gratitude journaling, guided meditations, breathing exercises, calming soundscapes, and mindful reminders. Test the app on your preferred platform and explore its features!


🔽 Download Full Source Code & Assets

Get the complete project files to jumpstart your development:

Download main.dart
Download pubspec.yaml
Download Sample Soundscape Files

🌟 What’s Next?

You’ve just created MindHaven, a powerful tool to promote mental well-being and mindfulness. This app is not only a great addition to your portfolio but also a meaningful project that can help users manage stress and cultivate positivity. To take it further, consider adding features like user authentication, push notifications, or integration with wearables for heart rate monitoring. Share your app with friends, contribute to the open-source community, or publish it on app stores to make a real impact. Keep coding, keep creating, and keep spreading positivity! 💚

We’d love to hear about your experience building MindHaven! Drop a comment below, share your customizations on social media, or join our community to connect with other Flutter developers. Happy coding!

Leave a Reply