Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
SyedFaizan25 opened this issue Sep 23, 2022 · 8 comments

Comments

@SyedFaizan25
Copy link

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

@ChMobinansar
Copy link

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

@SyedFaizan25
Copy link
Author

SyedFaizan25 commented Sep 24, 2022 via email

@medyas
Copy link
Owner

medyas commented Oct 14, 2022

@SyedFaizan25 could you provide more details about the issue !

@iqfareez
Copy link
Contributor

I encountered the similar behavior as well. The culprit is with the flutter_compass plugins, specifically at version 0.7.0 hemanthrajv/flutter_compass#65 hemanthrajv/flutter_compass#64

There is a fix that was merged hemanthrajv/flutter_compass#68, but the author never publishes the updates to pub,dev. hemanthrajv/flutter_compass#90 hemanthrajv/flutter_compass#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: #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
Copy link

olipiskandar commented Nov 21, 2022

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
Copy link
Owner

medyas commented Nov 24, 2022

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

@md-rifatkhan
Copy link

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
Copy link
Author

SyedFaizan25 commented Feb 27, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants