Skip to content

maazkhan-tech/flutter-diary-app-sqlite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flutter Diary App with SQLite

A feature-rich personal diary app built with Flutter, Riverpod state management, and SQLite local storage. Write diary entries with text, attach voice recordings, pick your mood from 5 emoji icons, browse entries on a calendar, and search across all your memos — all with full dark/light/system theme support.


Features

  • Create diary entries — title, description, mood, date & time
  • Voice recording — record, playback, and attach audio to any diary entry
  • Speech-to-text — dictate diary text using the microphone
  • Mood tracking — choose from 5 moods: Rad, Good, Meh, Bad, Awful (emoji icons)
  • Interactive calendartable_calendar view showing days with entries marked
  • Full-text search — search across all entry titles and descriptions
  • Edit & delete — update or remove any existing diary entry
  • Dark / Light / System theme — switchable from the Settings screen
  • Audio waveform playback — visual waveform display while playing back recorded audio
  • SQLite persistence — all entries stored locally in dairy.db via sqflite
  • Poppins font — custom bundled typeface throughout the app

Tech Stack

Technology Usage
Flutter UI Framework
Dart Programming Language
flutter_riverpod ^2.6.0 State management (StateNotifier, AsyncValue)
sqflite ^2.4.2 SQLite local database
record ^6.1.1 Audio recording (AAC format)
audioplayers ^6.5.0 Audio playback
audio_waveforms ^1.3.0 Waveform visualizer for playback
speech_to_text ^7.3.0 Voice-to-text dictation
table_calendar ^3.1.3 Full interactive calendar widget
path_provider ^2.1.5 File system path for audio storage
intl ^0.19.0 Date & time formatting
google_nav_bar ^5.0.7 Styled bottom navigation bar
Poppins (bundled) Custom font (assets/fonts/)

Project Structure

lib/
├── main.dart                                        # ProviderScope + theme watcher
├── common/                                          # App-wide reusable widgets
│   ├── back_button.dart                             # Custom back button
│   ├── icon.dart                                    # Asset icon path constants
│   ├── my_text.dart                                 # Styled text widget
│   ├── my_text_field.dart                           # Custom text field
│   ├── show_snackbar.dart                           # SnackBar helper
│   └── themes.dart                                  # Light & dark ThemeData
└── modules/
    ├── search_dairy/
    │   └── search_dairy.dart                        # Full-text search screen
    └── Home/
        ├── data_base/
        │   └── data_base.dart                       # SQLite singleton (CRUD)
        ├── models/
        │   └── dairy_model.dart                     # DairyModel (toMap/fromMap)
        ├── provider/
        │   └── dairy_provider.dart                  # DairyNotifier + selectedDateProvider
        ├── views/
        │   ├── home_screen.dart                     # Home with date strip & entries
        │   ├── bottom_nav_bar.dart                  # FAB + bottom nav
        │   ├── calender_provider.dart               # Date/days-in-month providers
        │   ├── more.dart                            # Settings screen
        │   └── theme/
        │       ├── themes.dart                      # Theme settings screen (radio)
        │       └── provider/
        │           └── theme_pro.dart               # ThemeNotifier (system/light/dark)
        ├── widgets/
        │   ├── calender.dart                        # TableCalendar with diary events
        │   ├── dairy_entries_list.dart              # Filtered list by selected date
        │   ├── dairy_list.dart                      # Diary card item
        │   ├── date_list_view.dart                  # Horizontal scrollable date strip
        │   ├── day_month_header.dart                # Month/year header with nav
        │   ├── home_app_bar.dart                    # Home screen AppBar
        │   ├── dailog.dart                          # Mood feeling picker dialog
        │   └── my_dailog.dart                       # Reusable dialog wrapper
        ├── add_dairy/
        │   ├── models/
        │   │   └── speech_model.dart                # SpeechState model
        │   ├── provider/
        │   │   ├── provider.dart                    # SpeechNotifier (speech-to-text)
        │   │   └── recorder_pro.dart                # RecorderNotifier (record/play)
        │   ├── views/
        │   │   └── add_dairy.dart                   # Add new diary entry screen
        │   └── widgets/
        │       ├── audio_control.dart               # Record/play audio controls
        │       ├── custom_nav_bar.dart              # Bottom bar with speech-to-text
        │       ├── edit_date.dart                   # Inline date picker widget
        │       ├── time_picker.dart                 # Time picker widget
        │       ├── save_button.dart                 # Reusable save/action button
        │       └── random_snackbar.dart             # Random motivational snackbar
        └── show_dairy/
            ├── provider/
            │   └── audio_player_pro.dart            # AudioPlayerNotifier (waveform)
            ├── views/
            │   └── dairy_info.dart                  # View diary entry detail
            ├── edit_dairy/
            │   └── edit_dairy.dart                  # Edit existing diary entry
            └── widgets/
                ├── audio_player.dart                # Waveform audio player widget
                └── delete_button.dart               # Delete with confirm dialog

assets/
├── fonts/
│   └── Poppins-Regular.ttf                          # Bundled Poppins font
└── icons/
    ├── rad.png                                       # 😄 Mood icon
    ├── good.png                                      # 🙂 Mood icon
    ├── meh.png                                       # 😐 Mood icon
    ├── bad.png                                       # 😟 Mood icon
    ├── awful.png                                     # 😞 Mood icon
    ├── dairy_title_.png
    ├── home_icon.png
    ├── home_calender.png
    └── home_search.png

Database Schema

CREATE TABLE dairy (
  id          INTEGER PRIMARY KEY AUTOINCREMENT,
  title       TEXT,
  description TEXT,
  time        TEXT,
  dateTime    TEXT,   -- stored as ISO 8601 string
  mode        TEXT,   -- mood icon asset path
  modeText    TEXT,   -- mood label (Rad/Good/Meh/Bad/Awful)
  audioPath   TEXT    -- local file path to .aac recording
);

Architecture

View (ConsumerWidget / ConsumerStatefulWidget)
              ↓  ref.watch / ref.read
   Providers (StateNotifierProvider)
              ↓
   StateNotifier → AsyncValue<List<DairyModel>>
              ↓
   DatabaseHelper (SQLite singleton)
              ↓
        dairy.db (local storage)

Providers overview:

Provider Type Responsibility
dairyNotifierProvider StateNotifierProvider Full CRUD + search for diary entries
selectedDateProvider StateProvider Currently selected date on home screen
themeProvider StateNotifierProvider App theme (system / light / dark)
recorderProvider StateNotifierProvider Audio recording & playback state
speechProvider StateNotifierProvider Speech-to-text state
audioPlayerProvider StateNotifierProvider.family Per-entry audio waveform playback
currentDateProvider StateProvider Calendar month navigation
daysInMonthProvider Provider Computed days list for current month

Getting Started

Prerequisites

  • Flutter SDK >=3.8.1
  • Dart SDK >=3.0.0
  • Android Studio / VS Code with Flutter extension
  • Microphone permission on device (for recording & speech-to-text)

Installation

  1. Clone the repository

    git clone https://github.com/maazkhan-tech/flutter-diary-app-sqlite.git
    cd flutter-diary-app-sqlite
  2. Install dependencies

    flutter pub get
  3. Run the app

    flutter run

Permissions Required

Add the following to android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

For iOS, add to ios/Runner/Info.plist:

<key>NSMicrophoneUsageDescription</key>
<string>Required for voice diary recording</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>Required for speech-to-text diary input</string>

Dependencies

dependencies:
  flutter_riverpod: ^2.6.0
  riverpod: ^2.6.1
  sqflite: ^2.4.2
  path_provider: ^2.1.5
  record: ^6.1.1
  audioplayers: ^6.5.0
  audio_waveforms: ^1.3.0
  speech_to_text: ^7.3.0
  table_calendar: ^3.1.3
  intl: ^0.19.0
  google_nav_bar: ^5.0.7
  cupertino_icons: ^1.0.8

What I Learned

  • StateNotifierProvider.family for per-instance state (audio player per diary entry)
  • SQLite singleton pattern with sqflite and path for persistent local storage
  • record + audioplayers integration for full audio record/playback workflows
  • audio_waveforms PlayerController for real-time waveform visualization
  • speech_to_text initialization and stream-based result handling
  • table_calendar with custom event loaders and day selection
  • ThemeMode switching via Riverpod with system/light/dark support
  • WidgetsBinding.addPostFrameCallback for post-render scroll actions
  • StateNotifierProvider.family keyed by file path for audio player instances
  • Custom font bundling with pubspec.yaml assets declaration

Roadmap / Future Improvements

  • Persist theme preference with shared_preferences
  • Add PIN / biometric lock for privacy
  • Export diary entries as PDF
  • Add photo attachment to diary entries
  • Reminder notifications for daily journaling
  • Backup & restore entries to cloud

Contributing

Contributions, issues, and feature requests are welcome! Feel free to open an issue or submit a pull request.


License

This project is open source and available under the MIT License.


👨‍💻 Author

Your Name

About

A Flutter personal diary app with SQLite storage, voice recording, speech-to-text, mood tracking, calendar view, search, and dark/light theme support

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors