flutter_qiblah 1.0.2+1 copy "flutter_qiblah: ^1.0.2+1" to clipboard
flutter_qiblah: ^1.0.2+1 copied to clipboard

outdated

Flutter Qiblah is a package that allows you to display Qiblah direction in you app with support for both Android and iOS

Flutter Qiblah #

pub package License: MIT

Flutter Qiblah is a plugin that allows you to display Qiblah direction in you app with support for both Android and iOS.

Getting Started #

This plugin depends on both geolocator and flutter_compass. To use this plugin, add flutter_compass as a dependency in your pubspec.yaml file. For example:

dependencies:
  flutter_qiblah: '^1.0.1'

Features #

  • Check Device Sensor support (Android)
  • Request Location permission
  • Check GPS Status (Enabled and permission status)
  • Receive Qiblah direction, North direction and Qiblah offset from North

Setup #

iOS

Make sure to add keys with appropriate descriptions to the Info.plist file.

  • <key>NSLocationAlwaysUsageDescription</key>

    <string>This app needs access to location when in the background.</string>

  • <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>

    <string>This app needs access to location when open and in the background.</string>

Android

Make sure to add permissions to the app/src/main/AndroidManifest.xml file.

  • android.permission.INTERNET
  • android.permission.ACCESS_COARSE_LOCATIO
  • android.permission.ACCESS_FINE_LOCATION

API #

Check the device sensor support. For Android, a check will be made to determine whether the device contains Sensor.TYPE_ROTATION_VECTOR and return true else false. In iOS, will directly return true.

import 'package:flutter_qiblah/flutter_qiblah.dart';
final bool _deviceSupport = await FlutterQiblah.androidDeviceSensorSupport();

Request GPS Location permission

import 'package:flutter_qiblah/flutter_qiblah.dart';
final GeolocationStatus status = await FlutterQiblah.requestPermission();

Check GPS Location Status. Contains

  • bool enabled
  • GeolocationStatus status {GeolocationStatus.granted, GeolocationStatus.denied, GeolocationStatus.disabled, GeolocationStatus.unknown}
import 'package:flutter_qiblah/flutter_qiblah.dart';
final LocationStatus locationStatus = await FlutterQiblah.checkLocationStatus();

Qiblah Stream, returns a stream of QiblahDirection, containing:

  • double qiblah: The direction of Qiblah from North
  • double direction: The direction of North
  • double offset: The offset of Qiblah from North
import 'package:flutter_qiblah/flutter_qiblah.dart';
final Stream<QiblahDirection> _stream = FlutterQiblah.qiblahStream;

Screens #

Here is the Example app demo:

Example app Demo

Based on the LocationStatus class, you can add a check to see the current status of the GPS and display an error widget if it's disabled or permission is denied. check the 📝 Example Code

GPS Disabled

For devices with no sensors, a Map can be displayed with the direction from the current/selected location to Mecca. check the 📝 Example Code

Qiblah with maps

Issues #

Please file any issues, bugs or feature request as an issue on our GitHub page.

Want to contribute #

If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our contribution guide and send us your pull request.

160
likes
0
points
1.49k
downloads

Publisher

verified publishermedyas.ml

Weekly Downloads

Flutter Qiblah is a package that allows you to display Qiblah direction in you app with support for both Android and iOS

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_compass, geolocator, location_permissions, stream_transform, vector_math

More

Packages that depend on flutter_qiblah