Banner


Introduction ๐Ÿš€

This package allow you to display, download and play Azkar on your app in the most simple way.


Features โœจ

  • Load Azkar as categories (Sabah, Masaa, After Salahโ€ฆ). ๐Ÿ“‚
  • Track & increment Zekr progress. โœ…
  • Auto-reset Sabah & Masaa Azkar based on user timezone. ๐Ÿ”„
  • Download single or all Azkar audio files with progress. ๐Ÿ”ˆ
  • Full audio playback (play, pause, resume, seek, stop). ๐ŸŽต
  • Unified error handling via AzkaryException โš ๏ธ

Installation โฌ‡๏ธ

  1. Add azkary to your appโ€™s pubspec.yaml dependencies.
azkary: 0.0.1
  1. Initialize the package
// import package โœ…
package:azkary/azkary.dart

WidgetsFlutterBinding.ensureInitialized();

// initalize package โœ…
await Azkary.initialize();

runApp(const MyApp());

Handling Azkar ๐Ÿคฒ

NOTE: Sabah & Masaa Azkar are auto reseted acording to user timezone so user can start azkar sabah and close app then comes again to continue (unless the time of sabah azkar is passed it will be auto reseted).

/// load azkar categories (which hold the azkar inside of them)
/// ex: Azkar of sabah, massa, after salah...etc
Azkary.instance.getCategories();

/// increment the progress of zekr by one (+1)
/// ex: zekr must be said (3) times this will keep
/// increasing progress until we reach 3
Azkary.instance.incrementZekr();

/// reset zekr progress 
Azkary.instance.resetZekr(categoryId,zekrId);

/// reset all azkars inside the category 
Azkary.instance.resetCategory(categoryId,zekrId);

Azkar Structure ๐Ÿงก

Categories and azkar are loaded from assets/json/azkar.json. Field names below match ZekrCategoryModel.fromJson and ZekrModel.fromJson.

Category

{
  "id": 1,
  "category": "ุฃุฐูƒุงุฑ ุงู„ุตุจุงุญ",
  "type": "sabah",
  "azkar": [
    // azkar
  ]
}

Zekr

{
  "id": 1,
  "text": "ุฃูŽุนููˆุฐู ุจูุงู„ู„ู‘ูŽู‡ู ู…ูู†ูŽ ุงู„ุดู‘ูŽูŠุทูŽุงู†ู ุงู„ุฑู‘ูŽุฌููŠู…ู โ€ฆ",
  "count": 1,
  "audio": "audio.mp3",
  "filename": "name"
}

Downloading Azkar Audio ๐Ÿ”ˆ

/// download single zekr
Azkary.instance.downloadZekrAudio(
  categoryId,
  zekrId,
  onProgress(downloadProgress){
    var total = downloadProgress.total;
    var received = downloadProgress.received;
  }
);

/// download all the azkar audios once
Azkary.instance.downloadAllAudios(
    onProgress(downloadProgress){
        var completedItems = downloadProgress.completedItems;
        var totalItems = downloadProgress.totalItems;
        var currentFileProgress = downloadProgress.currentFileProgress;
        // for easier ui handling (calculated progress percentage)
        var overallPercent = downloadProgress.overallPercent;
    }
);

/// check if zekr audio already downloaded
Azkary.instance.isZekrAudioDownloaded();

/// cancel downloading of single zekr
Azkary.instance.cancelZekrDownload(categoryId, zekrId);

/// cancel downloading all azkar
Azkary.instance.cancelAllDownloads();

Play Zekr Audio ๐Ÿš€

/// play zekr
Azkary.instance.playZekrAudio(categoryId, zekrId);

/// pause zekr
Azkary.instance.pauseAudio();

/// resume
Azkary.instance.resumeAudio();

/// stop audio
Azkary.instance.stopAudio();

/// move forward or backward using slider
Azkary.instance.seek(Duration(minute: 1));

Clean up โœจ

// this will clean the streams, players and all other things related to package.
// be careful: if you used this function you need to re-intiialize the package again.
Azkary.instance.dispose();

Handling Errors โœ…

try{
  // any azkary operation
} on AzkaryException catch (error){
  // error will have detailed error message
}

Always Remember Them! ๐Ÿ‡ต๐Ÿ‡ธ

This package is an act of ongoing charity on behalf of the martyrs of Palestine.


Author ๐Ÿ

Github | Linked-in

Screenshots from example app ๐Ÿ“ธ

Screenshot 1 Screenshot 2 Screenshot 3

Libraries

azkary