[iOS Simulator] Gestures are overshot

This issue has been tracked since 2022-09-23.

When I drag my map to move the camera position, the map slides to a random nearby position as soon as I release my finger. It does this only on iOS, not Android.

I noticed in version 2.1.10 changelog- "Avoids map shift when scrolling on iOS."

Perhaps I'm experiencing the same bug this refers to.

I'm using the latest version of the package google_maps_flutter: ^2.2.0 (I ran 'flutter clean' & 'flutter pub get')

I've been developing this app for 3 months on Android & it's been bug free. Trying now to build the code on iOS and running into this issue makes my app unusable.

danagbemava-nc wrote this answer on 2022-09-23

Hi @paulguitart,

Can you please provide your flutter doctor -v and flutter run --verbose logs, and a minimal complete reproducible code sample?

Can you also share a recording that captures the bug you're experiencing? That will make it easier to visualize the bug.

Thank you

paulguitart wrote this answer on 2022-09-23
flutter doctor -v
[✓] Flutter (Channel stable, 3.3.2, on macOS 12.6 21G115 darwin-arm, locale
    en-US)
    • Flutter version 3.3.2 on channel stable at
      /Users/paulwarner/Development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision e3c29ec00c (9 days ago), 2022-09-14 08:46:55 -0500
    • Engine revision a4ff2c53d8
    • Dart version 2.18.1
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/paulwarner/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14A309
    • CocoaPods version 1.11.3

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

[✓] Android Studio (version 2021.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.13+0-b1751.21-8125866)

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

[✓] Connected device (3 available)
    • iPhone 11 (mobile) • 9AC5E2E0-A179-47F4-9A75-9C72CEA06AB5 • ios
      • com.apple.CoreSimulator.SimRuntime.iOS-16-0 (simulator)
    • macOS (desktop)    • macos                                • darwin-arm64
      • macOS 12.6 21G115 darwin-arm
    • Chrome (web)       • chrome                               • web-javascript
      • Google Chrome 105.0.5195.125

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
paulguitart wrote this answer on 2022-09-23

Here's the flutter doctor & run. I'm using the simulator, haven't tested on real device yet, but that's next.

flutter-run.txt

Thanks for your reply. Working on the screen capture video & the code sample now.

paulguitart wrote this answer on 2022-09-23
Map.Shifting.Example.mov

I'm dragging the map a small bit each time, and you can see it jumps way farther when I release the mouse button.

paulguitart wrote this answer on 2022-09-23

It's almost as if it thinks I gestured a flick in that direction? Maybe a simulator/mouse thing?

Although it also jumps around sporadically after setting the map position programmatically, untouched.

paulguitart wrote this answer on 2022-09-23
 
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';

void main() async {    
  runApp(const MaterialApp(home: MapTestApp()));  
}

class MapTestApp extends StatefulWidget {
  const MapTestApp({Key? key}) : super(key: key);

  @override
  MapTestAppState createState() => MapTestAppState();
}

class MapTestAppState extends State<MapTestApp> {  

  @override
  Widget build(BuildContext context) {
    return const Scaffold(      
      body:         
          GoogleMap(
            initialCameraPosition: CameraPosition(
                target: LatLng(36.171563, -115.1391009),
                zoom: 12),
          ),        
    );
  }
}
danagbemava-nc wrote this answer on 2022-09-26

Hi @paulguitart, does this also reproduce for you on the physical device, or is it only with the simulator?

So far I can only reproduce on the simulator?

Although it also jumps around sporadically after setting the map position programmatically, untouched.

Can you also provide the sample for this scenario?

paulguitart wrote this answer on 2022-09-27

It's only on the simulator. Did you say you are able to see it on your simulator too??

I realized it's also doing it within other pages in the app (for example, a SingleChildScrollView). Try this with any long HTML file:

import 'package:flutter_html/flutter_html.dart';
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart' show rootBundle;

class LegalPage extends StatefulWidget {
  const LegalPage({Key? key}) : super(key: key);

  @override
  LegalPageState createState() => LegalPageState();
}

class LegalPageState extends State<LegalPage> {
  String _html = '';

  @override
  void initState() {
    super.initState();    
    loadHtml();
  }

  Future<void> loadHtml() async {
    final loadedData = await rootBundle.loadString('assets/terms-and-conditions.html');
    setState(() {
      _html = loadedData;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: AppBar(
        title: const Text("Terms and Conditions"),
        centerTitle: true,
      ),      
      body: SingleChildScrollView(
                scrollDirection: Axis.vertical,
                child: Padding(
            padding: const EdgeInsets.all(15.0),
            child: Html(data: _html)))
    );
  }
}
paulguitart wrote this answer on 2022-09-27
Simulator.Buggy.Behavior.mov
danagbemava-nc wrote this answer on 2022-09-27

Did you say you are able to see it on your simulator too??

Yes, I can reproduce this on my simulator as well.

I realized it's also doing it within other pages in the app (for example, a SingleChildScrollView). Try this with any long HTML file

I can reproduce it with a simple listview example.

A possibly related case from way back #79641.

recording
Screen.Recording.2022-09-27.at.07.25.36.mov

Steps to reproduce

  • Run the code sample below on the iOS simulator
  • Attempt to drag to scroll
  • Observe that it flings through the list

Alternate steps to reproduce

  • Run the google maps sample in #112244 (comment)
  • Try to pan around
  • Observe that the map moves more than you pan
code sample
import 'package:flutter/material.dart';

void main() => runApp(
      MaterialApp(
        home: Material(
          child: ListView.builder(
            itemBuilder: (context, index) {
              final child = SizedBox(
                height: 100,
                child: Center(
                  child: Text(
                    '$index',
                    textScaleFactor: 5,
                    style: const TextStyle(color: Colors.white),
                  ),
                ),
              );
              return index % 2 == 0
                  ? ColoredBox(color: Colors.blue, child: child)
                  : ColoredBox(color: Colors.red, child: child);
            },
          ),
        ),
      ),
    );
flutter doctor -v
[✓] Flutter (Channel stable, 3.3.2, on macOS 12.6 21G115 darwin-arm, locale en-GB)
    • Flutter version 3.3.2 on channel stable at /Users/nexus/dev/sdks/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision e3c29ec00c (13 days ago), 2022-09-14 08:46:55 -0500
    • Engine revision a4ff2c53d8
    • Dart version 2.18.1
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14A309
    • CocoaPods version 1.11.3

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

[✓] Android Studio (version 2021.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.13+0-b1751.21-8125866)

[✓] Android Studio (version 2021.2)
    • Android Studio at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/212.5712.43.2112.8815526/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.12+0-b1504.28-7817840)

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

[✓] Connected device (3 available)
    • iPhone 14 Pro (mobile) • 4302007A-B132-4B89-887A-C5993FCA3284 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-0 (simulator)
    • macOS (desktop)        • macos                                • darwin-arm64   • macOS 12.6 21G115 darwin-arm
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 105.0.5195.125

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
[✓] Flutter (Channel master, 3.4.0-31.0.pre.19, on macOS 12.6 21G115 darwin-arm64, locale en-GB)
    • Flutter version 3.4.0-31.0.pre.19 on channel master at /Users/nexus/dev/sdks/flutters
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 1ee9eba34b (4 hours ago), 2022-09-26 23:25:35 -0400
    • Engine revision be031b5210
    • Dart version 2.19.0 (build 2.19.0-242.0.dev)
    • DevTools version 2.17.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14A309
    • CocoaPods version 1.11.3

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

[✓] Android Studio (version 2021.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.13+0-b1751.21-8125866)

[✓] Android Studio (version 2021.2)
    • Android Studio at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/212.5712.43.2112.8815526/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.12+0-b1504.28-7817840)

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

[✓] Connected device (3 available)
    • iPhone 14 Pro (mobile) • 4302007A-B132-4B89-887A-C5993FCA3284 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-0 (simulator)
    • macOS (desktop)        • macos                                • darwin-arm64   • macOS 12.6 21G115 darwin-arm64
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 105.0.5195.125

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
jmagman wrote this answer on 2022-09-27

A possibly related case from way back #79641.

@danagbemava-nc does this reproduce when google_maps_flutter is not included in the app? Its inclusion is what forcing the simulator to run in Rosetta due to #94491

jmagman wrote this answer on 2022-09-27

A possibly related case from way back #79641.

@danagbemava-nc does this reproduce when google_maps is not included in the app? Its inclusion is what forcing the simulator to run in Rosetta due to #94491

I meant, does the simple listview example reproduce without maps.

danagbemava-nc wrote this answer on 2022-09-28

I meant, does the simple listview example reproduce without maps.

@jmagman, without google_maps_flutter in the project the scrolling is normal.

recording
Screen.Recording.2022-09-28.at.06.25.35.mov
jmagman wrote this answer on 2022-09-28

Thank you @danagbemava-nc! This is a duplicate of #79641 then, the Rosetta simulator is buggy. #94491 will eventually mean that google_maps_flutter will not cause the simulator to drop to Rosetta.

More Details About Repo
Owner Name flutter
Repo Name flutter
Full Name flutter/flutter
Language Dart
Created Date 2015-03-06
Updated Date 2022-10-04
Star Count 145499
Watcher Count 3567
Fork Count 23393
Issue Count 11206

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date