Coder Social home page Coder Social logo

mohamedashraf701 / prayers_times Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 1.0 521 KB

Seamlessly access precise prayer times with our Flutter package tailored to your location. Enhance your namaz routine effortlessly.

Home Page: https://pub.dev/packages/prayers_times

License: MIT License

Java 0.60% Dart 94.83% Shell 1.16% Objective-C 0.65% C++ 0.35% C 0.65% CMake 1.60% Swift 0.16%
dart flutter flutter-app flutter-examples flutter-package flutter-plugin muslim muslim-prayer-times muslims-prayer namaz

prayers_times's Introduction

prayers_times

Flutter Platform pub package

بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيْمِ

Prayers Times is a Flutter package that provides utilities for calculating and displaying Islamic prayer times (Namaz times), as well as related insights like Qibla direction. It's a comprehensive solution for handling prayer timings in your Flutter applications.

Features

  • Calculate accurate Islamic prayer times (Namaz times) based on various calculation methods.
  • Determine Qibla direction based on geographical coordinates.
  • Calculate middle of the night and last third of the night times.
  • Conversion utilities for different Islamic time formats.

Namaz_times

Installation

Add prayers_times as a dependency in your pubspec.yaml file:

dependencies:
  flutter:
    sdk: flutter
  prayers_times: <latest_version>

Usage

Import the package in your Dart file:

import 'package:prayers_times/prayers_times.dart';

Calculate Prayer Times

To calculate and display prayer times for a specific location, follow these steps:

  1. Define the geographical coordinates for the location.
  2. Specify the calculation parameters for prayer times, such as the calculation method and madhab.
  3. Create a PrayerTimes instance using the provided coordinates and parameters.
  4. Use the provided methods to access various prayer times and convenience utilities.
// Define the geographical coordinates for the location
Coordinates coordinates = Coordinates(21.1959, 72.7933);

// Specify the calculation parameters for prayer times
PrayerCalculationParameters params = PrayerCalculationMethod.karachi();
params.madhab = PrayerMadhab.hanafi;

// Create a PrayerTimes instance for the specified location
PrayerTimes prayerTimes = PrayerTimes(
  coordinates: coordinates,
  calculationParameters: params,
  precision: true,
  locationName: 'Asia/Kolkata',
);

Prayer Times With Specific Date

To calculate prayer times for a specific date, you can create an instance of the PrayerTimes class and provide a custom DateTime object using the dateTime parameter.

PrayerTimes prayerTimes = PrayerTimes(
  coordinates: Coordinates(latitude, longitude),
  calculationParameters: CalculationMethod.karachi(),
  locationName: 'Your Location',
  dateTime: DateTime(2023, 8, 15), // Specify the desired date
);

Prayer Times

Display prayer times or Calculate accurate Islamic prayer times (Namaz times) based on various calculation methods.

print('Fajr Start Time:\t${prayerTimes.fajrStartTime!}');
print('Fajr End Time:\t${prayerTimes.fajrEndTime!}');
print('Sunrise Time:\t${prayerTimes.sunrise!}');
print('Dhuhr Start Time:\t${prayerTimes.dhuhrStartTime!}');
print('Dhuhr End Time:\t${prayerTimes.dhuhrEndTime!}');
print('Asr Start Time:\t${prayerTimes.asrStartTime!}');
print('Asr End Time:\t${prayerTimes.asrEndTime!}');
print('Maghrib Start Time:\t${prayerTimes.maghribStartTime!}');
print('Maghrib End Time:\t${prayerTimes.maghribEndTime!}');
print('Isha Start Time:\t${prayerTimes.ishaStartTime!}');
print('Isha End Time:\t${prayerTimes.ishaEndTime!}');

Tahajjud & Sehri End Time

print('Isha End Time:\t${prayerTimes.ishaEndTime!}');
print('Tahajjud End Time:\t${prayerTimes.tahajjudEndTime!}');

Convenience Utilities

The PrayerTimes instance provides convenience utilities to determine the current and next prayer times, making it easy to display relevant information to users.

// Convenience Utilities
String current = prayerTimes.currentPrayer();
String next = prayerTimes.nextPrayer();
print('Current Prayer: $current ${prayerTimes.timeForPrayer(current)}');
print('Next Prayer: $next ${prayerTimes.timeForPrayer(next)}');

Sunnah Times

Utilize the SunnahInsights class to calculate and display Sunnah times, such as the middle of the night and the last third of the night.

// Sunnah Times
SunnahInsights sunnahInsights = SunnahInsights(prayerTimes);
print('Middle of the Night: ${sunnahInsights.middleOfTheNight}');
print('Last Third of the Night: ${sunnahInsights.lastThirdOfTheNight}');

Qibla and Madina Directions

The Qibla class provides methods to calculate the Qibla direction (direction of the Kaaba in Makkah) and the madina direction (direction of Al-Masjid an-Nabawi) from a given location. These calculations are based on the geographic coordinates (latitude and longitude) of the specified location and the coordinates of Makkah and Al-Masjid an-Nabawi. The calculations use spherical trigonometry to determine the angle between the specified location and the respective directions.

Calculate Qibla Direction

The qibla method calculates the Qibla direction based on the geographic coordinates of the specified location and the coordinates of Makkah (the Holy Kaaba). The result is the clockwise angle from the North direction.

double qiblaDirection = Qibla.qibla(coordinates);

Calculate Madina Direction

The madina method calculates the madina direction based on the geographic coordinates of the specified location and the coordinates of Al-Masjid an-Nabawi. The result is the clockwise angle from the North direction.

double madinaDirection = Qibla.madina(coordinates);

Customization

The package offers customization options for various properties and calculations. Refer to the documentation for detailed information on customization options.


Documentation

For detailed usage instructions and API documentation, please refer to the documentation.


Changelog

See the CHANGELOG for a history of changes in the package.


License

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


Get in touch

If you have any questions, feel free to reach out:


Contributing

Contributions to the prayers_times package are welcome! Please read the contribution guidelines before submitting a pull request.


Support

ashraf704




Feel free to explore the features of the prayers_times package and customize it to suit your needs. If you have any questions or feedback, don't hesitate to reach out. Happy coding!

prayers_times's People

Contributors

kishan-ck avatar md-tarikul-islam-juel avatar mohamedashraf701 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

omaralmgerbie

prayers_times's Issues

after night 12 isha time change , it show next day data before fajr

prayerTimes.ishaStartTime : 2023-11-25 18:30:15.000+0600 it should be 2023-11-24 18:30:15.000+0600
prayerTimes.ishaEndTime : 2023-11-26 05:01:00.000+0600 it shuld be 2023-11-25 05:01:00.000+0600

I checked it at 3 am 2023-11-25 but before Fajr, it should remain the same as the 2023-11-24 start time of Isha After Fajar I think it should be changed

Jakim calculation method

Please provide a Jakim calculation method for your package. Jakim is a Malaysian calculation method

1 hour differences facr and Isha times in Switzerland according to Turkiye Diyanet

Hello Dear Brother,
Thank you very much for your effort and made us create benefical app with easy way. This is not an issue but maybe I cant understand the calculation exactly. I will appriciate if you give me any idea.

The issue is a user from Switzerland reports me that facr and isha times have 1 hour in diyanet mobile app and in my app
I believe it is about calculation parameters but I could not determine which parameter can cause it. its perfectly fine in Turkiye cities but this occurs only Switzerland. I tried to change highLatitudeRule but it provide me not exact result, which parameters else I should consider to change.

regards.

prayerTimes.currentPrayer();

PrayerTimes prayerTimes = PrayerTimes(
coordinates: coordinates,
calculationParameters: params,
precision: true,
locationName: 'Asia/Kolkata',
);

when i pass coordinates value for different different country,, its always showing my current time prayer 'prayerTimes.currentPrayer();'

Question: prayerTimes.currentPrayer()

at 4am i checked prayerTimes.currentPrayer() it returns "ishabefore" string
what dost it mean can you explain ?

and can you please tell me all possible values of return of prayerTimes.currentPrayer()

question : sunset time

hi bro
good job
thanks in advance for this
i have a question:
how to get sunset time?
can you add this to your lib or if not , how can calculate it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.