adhan_flutter 0.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • new62

adhan_flutter #

This plugin is an Intergration for adhan-java Library in Flutter using Platform Intergration/Platform Channels.

Installation #

In the dependencies: section of your pubspec.yaml, add the following line:

  adhan_flutter: <latest_version>

Usage #

// intl package for formatting date & time
import 'package:intl/intl.dart';
import 'package:adhan_flutter/adhan_flutter.dart';

class MyWidget extends StatelessWidget {
  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
        // getTodayFajrTime()
        Padding(
          padding: const EdgeInsets.all(8.0),
          child: FutureBuilder(
            future: getTodayFajrTime(),
            builder: (context, AsyncSnapshot<DateTime> snapshot) {
              if (snapshot.hasData) {
                final dateTime = snapshot.data.toLocal();
                return Text(DateFormat.jm().format(dateTime), style: TextStyle(
                  fontSize: 26,
                  fontWeight: FontWeight.bold
                ),);
              } else if (snapshot.hasError) {
                return Text(snapshot.error.toString());
              } else {
                return Text('Waiting...');
              }
            },
          ),
        ),
        
        // getCurrentPrayer()
        Padding(
          padding: const EdgeInsets.all(8.0),
          child: FutureBuilder(
            future: getCurrentPrayer(),
            builder: (context, AsyncSnapshot<Prayer> snapshot) {
              if (snapshot.hasData) {
                final prayer = snapshot.data;
                return Text(prayer.toString(), style: TextStyle(
                    fontSize: 26,
                    fontWeight: FontWeight.bold
                ),);
              } else if (snapshot.hasError) {
                return Text(snapshot.error.toString());
              } else {
                return Text('Waiting...');
              }
            },
          ),
        ),
      ]
    );
  }
  
  Future<DateTime> getTodayFajrTime() async {
    final adhan = AdhanFlutter.create(Coordinates(latitude, longitude), DateTime.now(), CalculationMethod.KARACHI);
    return await adhan.fajr;
  }

  Future<Prayer> getCurrentPrayer() async {
    final adhan = AdhanFlutter.create(Coordinates(latitude, longitude), DateTime.now(), CalculationMethod.KARACHI);
    return await adhan.currentPrayer();
  }
}

CalculationMethod

ValueDescription
MUSLIM_WORLD_LEAGUEMuslim World League. Fajr angle: 18, Isha angle: 17
EGYPTIANEgyptian General Authority of Survey. Fajr angle: 19.5, Isha angle: 17.5
KARACHIUniversity of Islamic Sciences, Karachi. Fajr angle: 18, Isha angle: 18
UMM_AL_QURAUmm al-Qura University, Makkah. Fajr angle: 18, Isha interval: 90. Note: you should add a +30 minute custom adjustment for Isha during Ramadan.
DUBAIMethod used in UAE. Fajr and Isha angles of 18.2 degrees.
QATARModified version of Umm al-Qura used in Qatar. Fajr angle: 18, Isha interval: 90.
KUWAITMethod used by the country of Kuwait. Fajr angle: 18, Isha angle: 17.5
MOON_SIGHTING_COMMITTEEMoonsighting Committee. Fajr angle: 18, Isha angle: 18. Also uses seasonal adjustment values.
SINGAPOREMethod used by Singapore. Fajr angle: 20, Isha angle: 18.
NORTH_AMERICAReferred to as the ISNA method. This method is included for completeness but is not recommended. Fajr angle: 15, Isha angle: 15
KUWAITKuwait. Fajr angle: 18, Isha angle: 17.5
OTHERFajr angle: 0, Isha angle: 0. This is the default value for method when initializing a CalculationParameters object.

Madhab

ValueDescription
SHAFIEarlier Asr time
HANAFILater Asr time

HighLatitudeRule

ValueDescription
MIDDLE_OF_THE_NIGHTFajr will never be earlier than the middle of the night and Isha will never be later than the middle of the night
SEVENTH_OF_THE_NIGHTFajr will never be earlier than the beginning of the last seventh of the night and Isha will never be later than the end of the first seventh of the night
TWILIGHT_ANGLESimilar to SEVENTH_OF_THE_NIGHT, but instead of 1/7, the fraction of the night used is fajrAngle/60 and ishaAngle/60

Example #

View the Flutter app in the example directory to see all the available Examples.

Projects Used #

TODO #

0.0.1 #

  • TODO: Describe initial release.

example/README.md

adhan_flutter_example #

Demonstrates how to use the adhan_flutter plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  adhan_flutter: ^0.0.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:adhan_flutter/adhan_flutter.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
34
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
77
Overall:
Weighted score of the above. [more]
62
Learn more about scoring.

We analyzed this package on Feb 26, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.8

Health issues and suggestions

Document public APIs. (-1 points)

54 out of 54 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/adhan_flutter.dart.

Run flutter format to format lib/adhan_flutter.dart.

Maintenance suggestions

The package description is too short. (-13 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test