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

Compass cannot be displayed #685

Open
GULERTOLGA opened this issue Sep 6, 2021 · 11 comments
Open

Compass cannot be displayed #685

GULERTOLGA opened this issue Sep 6, 2021 · 11 comments
Labels
android bug Something isn't working pinned

Comments

@GULERTOLGA
Copy link
Contributor

I also tried in your example app but I failed to display the compass even though I rotated the map.

This feature was working properly before.

Device: Android 12.

[✓] Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-x64, locale en-TR)
• Flutter version 2.2.3 at /Users/xxx/flutter
• Framework revision f4abaa0735 (10 weeks ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/xxx/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5, Build version 12E262
• CocoaPods version 1.10.1

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] VS Code (version 1.59.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.25.0

[✓] Connected device (2 available)
• Redmi Note 9S (mobile) • 73a631d6 • android-arm64 • Android 10 (API 29)
• Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.159

@philiplindberg
Copy link
Contributor

I'm seeing the same thing on Android 11.

@kamami
Copy link

kamami commented Dec 9, 2021

Same here.

@felix-ht felix-ht added android bug Something isn't working labels Dec 9, 2021
@royer
Copy link

royer commented Dec 11, 2021

same here.

@tomtom99
Copy link

tomtom99 commented Jan 5, 2022

same here. It was working in an earlier version but seems to be brooken now.

@kamami
Copy link

kamami commented Jan 6, 2022

Compass is not displayed on Android, iOS is working fine.

@stale
Copy link

stale bot commented Mar 7, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 7, 2022
@stale stale bot closed this as completed Mar 14, 2022
@philiplindberg
Copy link
Contributor

This still seems to be an issue with the latest version of plugin, even when building from the master branch. Compass displays fine on iOS, but not on Android.

@kamami
Copy link

kamami commented Mar 15, 2022

Yes, no fix for this yet

@felix-ht felix-ht reopened this Mar 15, 2022
@stale stale bot removed the stale label Mar 15, 2022
@rouuuge
Copy link

rouuuge commented Aug 18, 2022

Has someone an workaround?

@spicy-tomato
Copy link

The problem is still there 😕

@tomtom99
Copy link

tomtom99 commented Sep 26, 2022

Workaround I did was to make my own compass - update it using:

Future<void> _onMapIdle() async {
    Map location = controller.cameraPosition?.toMap();

    SharedPreferences prefs = await SharedPreferences.getInstance();
    if (prefs.getDouble('bearing') != location['bearing']) {
      setState(() {
        bearing = location['bearing'];
      });
    }
   }
   
   Positioned buildCompass() {
    if (bearing != 0) {
      return Positioned(
        top: 200,
        right: 0,
        child: FlatButton(
          onPressed: () {
            Map current_location = controller.cameraPosition!.toMap();
            LatLng location = new LatLng(
                current_location['target'][0], current_location['target'][1]);
            controller.moveCamera(CameraUpdate.newCameraPosition(CameraPosition(
                target: location,
                zoom: current_location['zoom'],
                tilt: 0,
                bearing: 0)));
            controller.clearSymbols();
            setState(() {
              bearing = 0;
            });
          },
          child: Container(
            height: 30,
            width: 30,
            decoration: const BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.only(
                  topLeft: Radius.circular(25.0),
                  topRight: Radius.circular(25.0),
                  bottomLeft: Radius.circular(25.0),
                  bottomRight: Radius.circular(25.0),
                )),
            child: Transform.rotate(
              angle: -bearing * (math.pi / 180),
              child: SvgPicture.asset(
                "assets/compass.svg",
                height: 40,
                alignment: Alignment.centerLeft,
                semanticsLabel: "",
              ),
            ),
          ),
        ),
      );
    } else {
      return Positioned(child: Container());
    }
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android bug Something isn't working pinned
Projects
None yet
Development

No branches or pull requests

8 participants