Giter Site home page Giter Site logo

medyas / flutter_qiblah Goto Github PK

View Code? Open in Web Editor NEW
127.0 2.0 93.0 6.49 MB

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

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

License: MIT License

Kotlin 10.61% Swift 3.44% Objective-C 2.69% Dart 74.20% Ruby 9.06%
flutter qibla qiblah-direction qiblah compass plugin android sensors ios

flutter_qiblah's Introduction

Flutter Qiblah

pub package License: MIT

Getting Started

To start using this package, add flutter_qiblah dependency to your pubspec.yaml

dependencies:
  flutter_qiblah: '<latest_release>'

The package not not work on the iOS Simulator. To test on iOS please use a real device. Checkout #39

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

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.

flutter_qiblah's People

Contributors

dhafinrayhan avatar iqfareez avatar medyas avatar sagynbek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

flutter_qiblah's Issues

Execution failed for task ':flutter_compass_v2:compileDebugJavaWithJavac'. > error: invalid source release: 17

Details of device on which I'm installing running :
SM M015G
Android : 12, API : 31.

Here is the code for compass :

class _CompassScreenState extends State {
final _deviceSupport = FlutterQiblah.androidDeviceSensorSupport();
@OverRide
Widget build(BuildContext context) {
return Scaffold(
// Appbar start ===>
appBar: CustomAppBar(
title: 'Qibla Compass',
isBackButtonExist: widget.appBackButton == true ? true : false,
),

  // body start--->
  body: FutureBuilder(
    future: _deviceSupport,
    builder: (_, AsyncSnapshot<bool?> snapshot) {
      // Loading section---->
      if (snapshot.connectionState == ConnectionState.waiting) {
        return const LoadingIndicator();
      }
      // Error message show here--.
      if (snapshot.hasError) {
        return Center(
          child: Text("Error: ${snapshot.error.toString()}"),
        );
      }

      if (snapshot.data!) {
        // QiblahCompass page return here-->
        return const QiblahCompass();
      }
      // error message---.
      return const Center(
          child: Text('Our compass not support in your device'));
    },
  ),
);

}
}

Do let me know if anything else is needed.

Apk size doubling to around 71mb from 31mb

Hi, I'm using this package and it works great. The only issue is the apk size seems to double when I'm using it. I'm using this command to build an apk:
flutter build apk --obfuscate --split-debug-info=/Users/abdi/Desktop/myapp/obfuscation

Any way I can reduce my apk size

New update is slow!

I upgraded today to 2.0.2, the compass move slower than normal.
Tested on Samsung S20.

Upgrading Geolocator

This is a beautiful package and very helpful! I was hoping you could update the Geolocator dependency to the most recent version as being forced to use an older version of geolocator is breaking my app?

JzK!

Migration rxdart plugin to ^0.25.0 is needed

Please migrate rxdart to rxdart ^0.25.0. I need it badly. Actually i am using a plugin that requires rxdart ^0.25.0 unfortunately i can not use lower version for that plugin because lower version has issues.

Please upgrate rxdart ^0.25.0 if possible.

Thanks.

Error: The method 'dispose' isn't defined for the class 'FlutterCompass'.

Can't build app due to error.
Platform: Android

Log:

Launching lib\main.dart on sdk gphone x86 arm in debug mode...
lib\main.dart:1
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_qiblah-2.0.0/lib/flutter_qiblah.dart:86:22: Error: The method 'dispose' isn't defined for the class 'FlutterCompass'.
 - 'FlutterCompass' is from 'package:flutter_compass/flutter_compass.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_compass-0.6.1/lib/flutter_compass.dart').
Try correcting the name to the name of an existing method, or defining a method named 'dispose'.
    FlutterCompass().dispose();
                     ^^^^^^^
3

FAILURE: Build failed with an exception.

* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1035

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

flutter_qiblah version: 2.0.0 (direct main)
flutter_compass version: 0.6.1 (transitive)

upkeep dependency update

Jazak Allahu Khira, on a great package, can you please take a look into updating the geolocator dependency, as it was updated 3mo ago? Keeping an older version kinda holds the full project dependencies on a lower version without overrides.

Thanks in advance!

Could not load compiled classes for build file 'D:\flutter\.pub-cache\hosted\pub.dartlang.org\geolocator_android-4.1.4\android\build.gradle' from cache.

After including this package in flutter sdk 3.3.0 i got error during build

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':geolocator_android'.

Could not load compiled classes for build file 'D:\flutter.pub-cache\hosted\pub.dartlang.org\geolocator_android-4.1.4\android\build.gradle' from cache.
Failed to notify project evaluation listener.
Could not get unknown property 'android' for project ':geolocator_android' of type org.gradle.api.Project.
Could not get unknown property 'android' for project ':geolocator_android' of type org.gradle.api.Project.

MissingPluginException

E/flutter ( 1808): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: MissingPluginException(No implementation found for method checkPermissionStatus on channel flutter.baseflow.com/permissions/methods)
E/flutter ( 1808): #0 MethodChannel._invokeMethod
package:flutter/โ€ฆ/services/platform_channel.dart:175
E/flutter ( 1808):
E/flutter ( 1808): #1 MethodChannelPermissionHandler.checkPermissionStatus
package:permission_handler_platform_interface/โ€ฆ/method_channel/method_channel_permission_handler.dart:16
E/flutter ( 1808):
E/flutter ( 1808):

image

image

My Pubspec.yaml

image

Manual Location Support

@medyas bro how can we modify it for manual latitude and longitude? Can you provide some urgent support, it will be appreciated.

getting Unhandled Exception: Bad state: You cannot close the subject while items are being added from addStream

hi
i copied the example you provided , i am getting below error in logs while trying to press back button.

see below

  @override
  void dispose() {
    _locationStreamController.close();
    FlutterQiblah().dispose();
    super.dispose();
  }


Performing hot reload...
Syncing files to device HD1903...
Reloaded 3 of 1365 libraries in 529ms.
E/flutter ( 4181): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Bad state: You cannot close the subject while items are being added from addStream
E/flutter ( 4181): #0 Subject.close (package:rxdart/src/subjects/subject.dart:152:7)
E/flutter ( 4181): #1 FlutterCompass.dispose (package:flutter_compass/flutter_compass.dart:35:21)
E/flutter ( 4181): #2 FlutterQiblah.dispose (package:flutter_qiblah/flutter_qiblah.dart:87:22)
E/flutter ( 4181): #3 _QiblahCompassState.dispose (package:salatkapp/ui/prayer/qibla/qiblah_compass.dart:89:21)
E/flutter ( 4181): #4 StatefulElement.unmount (package:flutter/src/widgets/framework.dart:4729:12)
E/flutter ( 4181): #5 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1922:13)
E/flutter ( 4181): #6 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #7 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4556:14)
E/flutter ( 4181): #8 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1918:13)
E/flutter ( 4181): #9 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #10 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4556:14)
E/flutter ( 4181): #11 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1918:13)
E/flutter ( 4181): #12 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #13 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4556:14)
E/flutter ( 4181): #14 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1918:13)
E/flutter ( 4181): #15 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #16 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4556:14)
E/flutter ( 4181): #17 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1918:13)
E/flutter ( 4181): #18 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #19 MultiChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:5929:16)
E/flutter ( 4181): #20 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1918:13)
E/flutter ( 4181): #21 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #22 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4556:14)
E/flutter ( 4181): #23 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1918:13)
E/flutter ( 4181): #24 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #25 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4556:14)
E/flutter ( 4181): #26 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1918:13)
E/flutter ( 4181): #27 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #28 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4556:14)
E/flutter ( 4181): #29 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1918:13)
E/flutter ( 4181): #30 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #31 SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:5817:14)
E/flutter ( 4181): #32 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1918:13)
E/flutter ( 4181): #33 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #34 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4556:14)
E/flutter ( 4181): #35 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1918:13)
E/flutter ( 4181): #36 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #37 SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:5817:14)
E/flutter ( 4181): #38 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1918:13)
E/flutter ( 4181): #39 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1920:7)
E/flutter ( 4181): #40 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4556:14)
E/flutter ( 4181): #41
W/IInputConnectionWrapper( 4181): getExtractedText on inactive InputConnection
W/IInputConnectionWrapper( 4181): getTextBeforeCursor on inactive InputConnection
D/OnePlusJankManager( 4181): Chor uploadMDM JANK_TYPE_ONCE mViewTitle = kw.ltd.salatkapp/kw.ltd.salatkapp.MainActivity--- jank level = 1

Upgrade to Null Safety package

Issue with Geolocator

So, because <myapp> depends on both geolocator ^7.0.1 and flutter_qiblah ^1.0.3+2, version solving failed.
pub get failed 
exit code 1

Compass not working on iOS

I am experiencing an issue with the compass functionality on iOS. Specifically, the compass does not display and remains stuck on a loading indicator on AsyncSnapshot<LocationStatus>. There are no error messages printed to the console.

Here are some additional details about the issue:

  • Location services are enabled and permission has been granted.
  • The issue is specific to iOS; the compass works as expected on other platforms.
  • The device is running the latest version of iOS.
  • The issue occurs consistently and cannot be resolved by restarting the app or the device.
  • I have attempted to troubleshoot the issue by checking the relevant permissions and reviewing the code that relates to the compass functionality, but so far I have not been able to identify the root cause of the issue.

I would greatly appreciate any assistance in resolving this issue, as the compass functionality is a critical feature of our app. Thank you in advance for your help.

doesn't work with iOS

on iOS simulator it just keep loading and nothing happens for a while, just loading
may I think we need such a line like this for the iOS
final _deviceSupport = FlutterQiblah.androidDeviceSensorSupport();
or maybe I don't know what is wrong
can anyone help ?

it is lagging its not smoothly animating

hello i am new to flutter and i found this package and it is use full but there is one problem its not animating guys if you have any suggestions please let me know

geolocator

Because flutter_qiblah >=2.0.2 depends on geolocator ^7.6.0 and depends on geolocator ^8.0.0, flutter_qiblah >=2.0.2 is forbidden.
So, because uber depends on flutter_qiblah ^2.0.2, version solving failed.
pub get failed (1; So, because uber depends on flutter_qiblah ^2.0.2, version solving failed.)

version solving failed

Because no versions of camerawesome match >0.2.1+2 <0.3.0 and camerawesome 0.2.1+2 depends on rxdart ^0.25.0, camerawesome ^0.2.1+2 requires rxdart ^0.25.0.
And because flutter_qiblah >=1.0.3+2 depends on flutter_compass ^0.5.0 which depends on rxdart ^0.24.1, camerawesome ^0.2.1+2 is incompatible with flutter_qiblah >=1.0.3+2.
So, because hijrah_merchants depends on both flutter_qiblah ^1.0.3+2 and camerawesome ^0.2.1+2, version solving failed.
pub get failed (1; So, because hijrah_merchants depends on both flutter_qiblah ^1.0.3+2 and camerawesome ^0.2.1+2, version solving failed.)

I need both dependencies for my app, any way to fix this?

Compass UI customization possible??

Is this compass plugin allow customization of UI
See the below image. Does, this plugin allow to make changes to bring it closer to the image attached.

image

Compass Not Moving - Compass sensor is unreliable, device calibration is needed.

I got Compass sensor is unreliable, device calibration is needed.

import 'dart:async';
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_qiblah/flutter_qiblah.dart';
import 'package:flutter_svg/svg.dart';

class Qibla extends StatelessWidget {
  final _compassSvg = SvgPicture.asset('assets/qibla/compass.svg');
  final _needleSvg = SvgPicture.asset(
    'assets/qibla/needle.svg',
    fit: BoxFit.contain,
    height: 300,
    alignment: Alignment.center,
  );

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: StreamBuilder(
        stream: FlutterQiblah.qiblahStream,
        builder: (_, AsyncSnapshot<QiblahDirection> snapshot) {
          if (snapshot.connectionState == ConnectionState.waiting) {
            return const Center(child: CircularProgressIndicator(),);
          }

          final qiblahDirection = snapshot.data;

          return Stack(
            alignment: Alignment.center,
            children: <Widget>[
              Transform.rotate(
                angle: ((qiblahDirection?.direction ?? 0) * (pi / 180) * -1),
                child: _compassSvg,
              ),
              Transform.rotate(
                angle: ((qiblahDirection?.qiblah ?? 0) * (pi / 180) * -1),
                alignment: Alignment.center,
                child: _needleSvg,
              ),
              Positioned(
                bottom: 8,
                child: Text("${qiblahDirection?.offset.toStringAsFixed(3)}ยฐ"),
              )
            ],
          );
        },
      ),
    );
  }
}

Animation is very shaky and unstable for Android 13 & 14

Hi there, I checked all open & closed issues, but couldn't really find an answer for that(except I think it's mentioned that, it's issue with the flutter compass).

The compass works fine in older Android(tested on 8,10), but is unstable and shaky for Android 13 & 14.
Can you please tell me if this issue fixable?

Attached demonstration of 2 different apps in Android 14 using this library :

compass-issue.mp4

Can you please tell me if this issue fixable?

Thanks!

Loading indicator in iOS . Works on Android

I added permission in info.list

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

its not working and showing a loading ... forever screen instead when I am showing compass.

Qibla map real time location movement

Hello and thanks for this plugin, very helpful

I am new to flutter, and I wanted to use this plugin, but I just noticed one issue with the qibla maps related to the realtime location adjustment.

When the qibla map page opened, the line to Mecca will show along the location appearing at that time, but location is getting automatically adjusted to be more accurate and therefore it moves, where as the line to Mecca remain where it was without moving along the location.

I believe and as I have seen in other apps, the line should move with the location as it get adjusted.

can you please fix this.

Drain issue, please fix the following

First of all, thank you so much for the help dear brother! I noticed that in the dispose method, you forgot the use .drain() functionality before disposing it, so here is the fix.

Please update your dispose method:

 /// Close compass stream, and set Qiblah stream to null
  dispose() async {
    await _qiblahStream.drain();
    _qiblahStream = null;
    FlutterCompass().dispose();
  }

flutter_qiblah not compatible with newer Android gradle versions

The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher.
The following dependencies do not satisfy the required version:
project ':flutter_qiblah' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61

Starting from version 'com.android.tools.build:gradle:7.3.0'

Meaning that projects have to fix their gradle versions and not being able to update it just to support this library.

Wrong direction

The qiblah direction its showing is not correct. Please update Am from India, Its showing wrong direction

static Stream<QiblahDirection> _merge<A, B>(Stream<A> streamA, Stream<B> streamB) Not recalled in ios

static Stream _merge<A, B>(Stream streamA, Stream streamB) this method is not called again when we off location in ios and again turn it on from settings. Means after turn off location when turn it on again and we come to application then compass qiblah not working. when i checked the method above is no calling again in IOS. in android it is working good, though i have done changes to your plugin code. The state of connection in stream builder in compass qiblah screen remains in waiting state when we make qiblahstream to null.

IOS Pod install error

No podspec found for flutter_compass_v2 in .symlinks/plugins/flutter_compass_v2/ios

Build failed with an exception.

Execution failed for task ':flutter_qiblah:compileDebugKotlin'.

Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (1.8) and 'compileDebugKotlin' (17).

Probably you need to support kotlin >= 1.8

Newer version does not support.

How to detect compass accuracy?

So sometimes the qiblah direction doesn't show the correct position. A compass calibration solves the issue. How can we detect when the accuracy is low, so that we show to the user to calibrate the compass?

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.