medyas / flutter_qiblah

Flutter Qiblah is a plugin that allows you to display Qiblah direction in you app with support for both Android and iOS.
https://pub.dev/packages/flutter_qiblah
MIT License
127 stars 91 forks source link

Qibla is Jumping in it and not smoothly moving apply animation on it but didn't work on it. #34

Open SyedFaizan25 opened 1 year ago

SyedFaizan25 commented 1 year ago

Qibla is Jumping in it and not smoothly moving apply animation on it but didn't work on it.

ChMobinansar commented 1 year ago

@SyedFaizan25 What is mean By smoothly Word? What you Exact want?

SyedFaizan25 commented 1 year ago

check the package first then you got the idea what is the issue in it.

On Sat, Sep 24, 2022, 1:23 PM Mobin Ansar @.***> wrote:

@SyedFaizan25 https://github.com/SyedFaizan25 What is mean By smoothly Word? What you Exact want?

— Reply to this email directly, view it on GitHub https://github.com/medyas/flutter_qiblah/issues/34#issuecomment-1256907492, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXD43RX3GFDROFNJCNGFVWLV723BTANCNFSM6AAAAAAQTXQ53E . You are receiving this because you were mentioned.Message ID: @.***>

medyas commented 1 year ago

@SyedFaizan25 could you provide more details about the issue !

iqfareez commented 1 year ago

I encountered the similar behavior as well. The culprit is with the flutter_compass plugins, specifically at version 0.7.0 https://github.com/hemanthrajv/flutter_compass/issues/65 https://github.com/hemanthrajv/flutter_compass/issues/64

There is a fix that was merged https://github.com/hemanthrajv/flutter_compass/pull/68, but the author never publishes the updates to pub,dev. https://github.com/hemanthrajv/flutter_compass/issues/90 https://github.com/hemanthrajv/flutter_compass/issues/80

So, a workaround is to override the flutter_compass plugin to its latest code. In your pubspec.yaml file. Add this section:

dependency_overrides:
  flutter_compass:
    git: https://github.com/hemanthrajv/flutter_compass.git

Related: https://github.com/medyas/flutter_qiblah/issues/30

I found a similar, relatively new package to flutter_compass, which is smooth_compass. I'll test it out and see if it performs better compared to flutter_compass.

olipiskandar commented 1 year ago

i use this code to solve problem (android) jumping & smooth animation rotation on simulator & real device

return AnimatedRotation(
  turns: (qiblahDirection!.qiblah * (pi / 180) * -1),
  duration: const Duration(seconds: 1),
  child: Image.asset(
    'assets/images/icon/kibla-white.png',
    fit: BoxFit.contain,
    height: 100,
  ),
);

Related: #30

medyas commented 1 year ago

Thanks @iqfareez & @olipiskandar for your commets. @iqfareez do keep us updated about the smooth_compass

md-rifatkhan commented 4 months ago

Anybody help? my compass not moving , getting null value on Text("${qiblahDirection?.offset.toStringAsFixed(3)}°"),, tested on 3 real device,

class Qiblah 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,
  );
  final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
      FlutterLocalNotificationsPlugin();

  Qiblah({super.key});

  @override
  Widget build(BuildContext context) {
    FlutterQiblah.androidDeviceSensorSupport();
    return Scaffold(
      body: Column(
        children: [
          StreamBuilder(
            stream: FlutterQiblah.qiblahStream,
            builder: (_, AsyncSnapshot<QiblahDirection> snapshot) {
              if (snapshot.connectionState == ConnectionState.waiting)
                return 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)}°"),
                  )
                ],
              );
            },
          ),
        ],
      ),
    );
  }
}
SyedFaizan25 commented 4 months ago

Contact me on WhatsApp # +923470504900

On Tue, Feb 27, 2024, 12:45 PM RIfat Khan @.***> wrote:

Anybody help? my compass not moving , getting null value on Text("${qiblahDirection?.offset.toStringAsFixed(3)}°"),, tested on 3 real device,

class Qiblah 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, ); final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();

Qiblah({super.key});

@override Widget build(BuildContext context) { FlutterQiblah.androidDeviceSensorSupport(); return Scaffold( body: Column( children: [ StreamBuilder( stream: FlutterQiblah.qiblahStream, builder: (_, AsyncSnapshot snapshot) { if (snapshot.connectionState == ConnectionState.waiting) return 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)}°"),
              )
            ],
          );
        },
      ),
    ],
  ),
);

} }

— Reply to this email directly, view it on GitHub https://github.com/medyas/flutter_qiblah/issues/34#issuecomment-1965959711, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXD43RW6CHO3NZTLZAYSKHDYVWFHZAVCNFSM6AAAAAAQTXQ53GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRVHE2TSNZRGE . You are receiving this because you were mentioned.Message ID: @.***>