Skip to content

abolambA/mushaf-imad-flutter

This branch is up to date with Itqan-community/mushaf-imad-flutter:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

f6e1b67Β Β·Β Β· Mar 25, 2026

History

24 Commits
Feb 23, 2026
Mar 25, 2026
Feb 22, 2026
Mar 25, 2026
Mar 24, 2026
Mar 25, 2026
Mar 25, 2026
Feb 23, 2026
Mar 25, 2026
Mar 24, 2026
Feb 22, 2026
Feb 22, 2026
Mar 24, 2026
Feb 22, 2026
Mar 24, 2026
Feb 22, 2026
Mar 25, 2026
Feb 22, 2026

Repository files navigation

IMAD Flutter - Mushaf Package

Add mushaf to your Flutter application easily! A fully functional, modular Quran reader library with display, bookmarks, search, offline data storage, and more.

Flutter Dart Version


πŸ“Έ Screenshots


✨ Features

  • πŸ“– Full Quran Text Display (604 pages) leveraging beautifully rendered images.
  • 🎨 Multiple Reading Themes (Comfortable, Calm, Night, White) for optimal accessibility.
  • πŸ’Ύ Offline-first Architecture powered by Hive for user data and static Quran metadata.
  • πŸ” Unified Search Functionality (Search Verses, Chapters, and Bookmarks).
  • πŸ”– Bookmarks and Reading History system mapping natively to UI components.
  • πŸ—οΈ Clean Modular Architecture with a strict separation of domain, data, and UI layers.
  • 🧩 Ready-to-use UI Components: (MushafPageView, QuranPageWidget, SearchPage, SettingsPage, ChapterIndexDrawer, etc.)
  • 🎡 Audio Playback: Includes support for both offline device assets and external streams like Itqan CMS.

βš™οΈ Requirements

  • Dart SDK: >= 3.11.01.0
  • Flutter: >= 1.17.07.0

πŸš€ Quick Start

1. Add Dependency

Add the package to your pubspec.yaml:

dependencies:
   imad_flutter: ^0.0.1

2. Download Quran Images

⚠️ Important: The quran-images/ directory (~9,000+ PNG files) is not included in the pub.dev package due to size limitations. You must download it separately from the GitHub repository.

# Clone or download the quran-images directory from the repo
git clone https://github.com/Itqan-community/mushaf-imad-flutter.git

# Copy quran-images into your project's package cache or use a path dependency

If you're using a path dependency (recommended during development):

dependencies:
   imad_flutter:
     path: ../mushaf-imad-flutter  # already includes quran-images/

3. Initialization & Setupetup

The library uses Hive for its local database and requires initialization before the app runs.

import 'package:flutter/material.dart';

import 'package:imad_flutter/imad_flutter.dart';


void main() async {
   WidgetsFlutterBinding.ensureInitialized();
  
    // One-line setup! Initializes Hive, provisions Quran metadata, 
   // and injects dependencies via get_it.
   await setupMushafWithHive();
  
    runApp(const MyApp());
}}

4. Basic Usage (Displaying the Mushaf)

Once initialized, simply instantiate the MushafPageView.

import 'package:flutter/material.dart';

import 'package:imad_flutter/imad_flutter.dart';


class MushafScreen extends StatelessWidget {
   @override
   Widget build(BuildContext context) {
     return Scaffold(
      appBarr: AppBar(title: Text('Mushaf')),
       // Providing a bare-minimum Theme Scope
      bodyy: MushafThemeScope(
        notifierr: ThemeViewModel()..setTheme(ReadingTheme.comfortable),
        childd: MushafPageView(
          initialPagee: 1, // Start at Al-Fatihah
        ),
      ),
    );
  }
} }
}

πŸ› οΈ Exploring UI Components

The imad_flutter library provides ready-made screens and widgets for immediate integration.

Search Functionality

The built-in unified search queries Verses, Chapters, and Bookmarks all at once:

import 'package:imad_flutter/imad_flutter.dart';


// Just navigate to the built in SearchPage!

Navigator.push(
  context,
    MaterialPageRoute(builder: (context) =>gt; const SearchPage()),
);;

Table of Contents / IndexDrawer

Easily access any Surah or Juz:

Scaffold(
  drawerr: const ChapterIndexDrawer(), // Surah / Juz selection drawer
  bodyy: MushafPageView(initialPage: 1),
);;

Theming

You can update themes dynamically. Wrap your Mushaf pages with MushafThemeScope.

enum ReadingTheme {
  comfortable,   // Light green
  calm,          // Light blue
  night,         // Dark theme 
  white,         // Pure white 
}}

πŸ—οΈ Architecture Setup & Customizationtion

The library is strictly modular:

  • Domain Layer: Encompasses models (e.g., Verse, Chapter, Bookmark) and repository abstractions.
  • Data Layer: Utilizes Hive for DAOs (HiveBookmarkDao, HiveReadingHistoryDao, etc.)
  • UI Layer: Views and ViewModels employing native ChangeNotifier.

All core dependencies are registered centrally via get_it. If you wish to use your own database engine, simply implement the abstract repository protocols and pass them manually.

setupMushafDependencies(
  databaseServicee: MyCustomDatabaseService(),
  bookmarkDaoo: MyCustomBookmarkDao(),
   // ...
);;

🎧 Streaming Audio via Itqan CMS

The framework allows you to easily plug into the the Itqan CMS JSON API (cms.itqan.dev) for audio playback and verse-level highlight syncing, removing the need to host MP3s locally.

Pass CmsAudioConfig to setupMushafWithHive and MushafLibrary.initialize natively:

import 'package:imad_flutter/imad_flutter.dart';


void main() async {
   WidgetsFlutterBinding.ensureInitialized();
  
    // Define CMS configuration pointing to the Itqan API
   const cmsConfig = CmsAudioConfig(
    baseUrll: 'https://api.cms.itqan.dev',
    defaultReciterIdd: 1, // e.g., Mishari Al-afasi
  );

  
  await setupMushafWithHive(cmsAudioConfig: cmsConfig);

    // Initialize library using external DAOs and the CMS audio config
   await MushafLibrary.initialize(
    databaseServicee: mushafGetItDatabaseService>(),
    bookmarkDaoDaoo: mushafGetItBookmarkDao>(),
    readingHistoryDaoDaoo: mushafGetItReadingHistoryDao>(),
    searchHistoryDaoDaoo: mushafGetItSearchHistoryDao>(),
    cmsAudioConfigfigg: cmsConfig, // Enables the CmsAudioRepository
  );

  
  runApp(const MyApp());
}}

This bypasses the DefaultAudioRepository and relies exclusively on CmsAudioRepository which parses server-provided verse timing boundaries dynamically.

πŸ“š Detailed Guide: For a comprehensive, step-by-step tutorial on how the audio syncing works under the hood and how to implement it, please see the CMS Audio Integration Guide.


πŸ“ Demo App

Navigate to the internal example directory to run the full presentation sample that demonstrates everything the library offers:

cd example
flutter runn

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors

No contributors

Languages

  • Dart 98.2%
  • Other 1.8%