Open L4rue opened 1 week ago
@L4rue
Can you check this issue and see if it resembles your case or not ?
If not, in your case, does it replicate without flutter_riverpod
implementation ? If so, please provide us updated code sample without that package code.
@L4rue Can you check this issue and see if it resembles your case or not ? If not, in your case, does it replicate without
flutter_riverpod
implementation ? If so, please provide us updated code sample without that package code.
Thanks for your reminding. I have checked the issue before, but nothing useful. It's look like different from what I meet.
And as your say, I remove the flutter_riverpod
from the minimal code sample.
Due to our business, the position of the marker must be returned by the backend server.
I use ChangeNotifier
Instead of Ref
which from flutter_riverpod. So that I know when to rebuild the map.
Here is the minimal code sample without flutter_riverpod
still could reproduce the problem by this code.
https://github.com/flutter/flutter/assets/32993902/7471015b-a59e-43c2-8248-4dcddab6e8d2
Thanks for the update. I tried replicating on Pixel XL api 33 emulator, but wasn't able to see the reported behavior. Also tried to use your code sample in plugin example (marker_icon.dart) but still didn't get the behavior. Can you try the same and check at your end ?
Thanks for your trying. At first, I tried replicating on Pixel XL API 33 emulator same as you and all markers are good like before. But I found the path or roads of map are black. That was strange. So, I search some about that. At this comment, he mentioned Google’s latest renderer dependency on Google Play and Pixel XL API 33 emulator has no Google Play. I suspect the reported issue is related to this. Based on the above guess, I tried replicating on Pixel 7 Pro API 33 emulator which has Google Play. In this time, the black roads are gone. But the reported behavior happened again. It's really hard but still could reproduce on emulator.
Look this video.
On real device, almost evetimes could reproduce the behavior. Just a guess, maybe the difficulty of reproducing is related to the performance of device?Because of low performance and low frame on emulator. After all, it might only last one or two frame.
Here some information of device what I used.
Thanks for the update. I tried on Samsung S10 device and also on PIxel XL emulator running Android 13, but was unable to see the flickering. Does the flickering occur while trying to drag the marker or while zooming in and out ?
https://github.com/flutter/flutter/assets/67046386/d50c0fe8-326b-4659-a67e-40618a79a840
Thanks for the update. I tried on Samsung S10 device and also on PIxel XL emulator running Android 13, but was unable to see the flickering. Does the flickering occur while trying to drag the marker or while zooming in and out ?
Screen_Recording_20240424_111624.mp4
Thanks for your trying. By your video, I think I caused a misunderstanding by not describing my operations in detail.
try this.
nowIndexProvider.changeIndex(i);
, it will change the taped marker to yellow by notifyListener as my video (camera will move to marker's position by the callback function. It's not a drag event)nowIndexProvider.changeIndex(-1);
, it will change the taped marker back to red by notifyListener as my videoMaybe useful
This is my code sample. Same as the code I provided before. Just need to change the googleMapApiKey to yourself's
By the way, did your see any black road in map on PIxel XL emulator? PIxel XL emulator has no Play Store on my mac.
Thanks for the update and patience while we try to figure this out. I followed the steps you mentioned and clicking on the marker does change the color but I didn't observe the flicker, as shown in below video:
https://github.com/flutter/flutter/assets/67046386/4b87620f-b8f6-4cdf-a7f8-34210cdb3273
I ran on latest stable version and on Pixel XL emulator running Android 13.
Could you click between marker and map, not between marker and marker? In addition, it is easier to reproduce the problem on a real device. My colleagues all reproduced this problem on their mobile phones.
Anyway, thanks for your work.
Thanks for the update. I was able to replicate this by running on S10 device with latest versions.
https://github.com/flutter/flutter/assets/67046386/9709649c-8355-4258-8051-b17a6f410510
From triage: There are major changes planned for markers. We will re-investigate after https://github.com/flutter/packages/pull/4055 lands.
Steps to reproduce
When update the marker List and rebuild, the target marker will flicker. Not every times but easy to reproduce.
Only happened on Android. iOS is good. Device: Android 14 API 34(whatever simulator or real device)
try this with the minimal code sample.
it works good before I upgrade SDK version Before:
After:
Anything helpful? Thanks to everyone.
Minimal Code sample
main.dart
```dart import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; void main() { runApp(const ProviderScope( child: MyApp(), )); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'GOOGLE MAP FLASH', theme: ThemeData( colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), useMaterial3: true, ), home: const MyHomePage(title: 'Google Map Flash'), ); } } class MyHomePage extends StatefulWidget { const MyHomePage({super.key, required this.title}); final String title; @override State> { MarkerList() : super([]); List changeMarker(int index, BitmapDescriptor bitmap, double zIndex) {
var item = state[index];
var marker = Marker(
markerId: item.markerId,
position: item.position,
consumeTapEvents: item.consumeTapEvents,
icon: bitmap,
onTap: item.onTap,
zIndex: zIndex,
);
state[index] = marker;
state = [...state];
return state;
}
void setState(List newState) {
state = newState;
}
}
final markersProvider = StateNotifierProvider>((ref) {
return MarkerList();
});
final nowIndexProvider = StateProvider((ref) {
return -1;
});
```
pubspec.yaml
```yaml name: google_map_flash description: "A new Flutter project." version: 1.0.0+1 environment: sdk: '>=3.3.1 <4.0.0' dependencies: flutter: sdk: flutter google_maps_flutter: ^2.6.1 flutter_riverpod: ^2.5.1 cupertino_icons: ^1.0.6 dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^3.0.0 flutter: uses-material-design: true ```Video
https://github.com/flutter/flutter/assets/32993902/8f94e360-b5ca-4d5e-9f56-090de04fad9e
Logs
``` D/MIUIInput( 7333): [MotionEvent] ViewRootImpl windowName 'com.example.google_map_flash/com.example.google_map_flash.MainActivity', { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=599817703, downTime=599817703, phoneEventTime=17:30:48.953 } moveCount:0 D/MIUIInput( 7333): [MotionEvent] ViewRootImpl windowName 'com.example.google_map_flash/com.example.google_map_flash.MainActivity', { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=599817745, downTime=599817703, phoneEventTime=17:30:48.995 } moveCount:0 W/ProxyAndroidLoggerBackend( 7333): Too many Flogger logs received before configuration. Dropping old logs. 6 E/FrameEvents( 7333): updateAcquireFence: Did not find frame. D/MIUIInput( 7333): [MotionEvent] ViewRootImpl windowName 'com.example.google_map_flash/com.example.google_map_flash.MainActivity', { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=599818469, downTime=599818469, phoneEventTime=17:30:49.720 } moveCount:0 D/MIUIInput( 7333): [MotionEvent] ViewRootImpl windowName 'com.example.google_map_flash/com.example.google_map_flash.MainActivity', { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=599818553, downTime=599818469, phoneEventTime=17:30:49.803 } moveCount:0 W/ProxyAndroidLoggerBackend( 7333): Too many Flogger logs received before configuration. Dropping old logs. 4 E/FrameEvents( 7333): updateAcquireFence: Did not find frame. D/MIUIInput( 7333): [MotionEvent] ViewRootImpl windowName 'com.example.google_map_flash/com.example.google_map_flash.MainActivity', { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=599819106, downTime=599819106, phoneEventTime=17:30:50.356 } moveCount:0 D/MIUIInput( 7333): [MotionEvent] ViewRootImpl windowName 'com.example.google_map_flash/com.example.google_map_flash.MainActivity', { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=599819156, downTime=599819106, phoneEventTime=17:30:50.406 } moveCount:0 W/ProxyAndroidLoggerBackend( 7333): Too many Flogger logs received before configuration. Dropping old logs. 42 E/FrameEvents( 7333): updateAcquireFence: Did not find frame. D/MIUIInput( 7333): [MotionEvent] ViewRootImpl windowName 'com.example.google_map_flash/com.example.google_map_flash.MainActivity', { action=ACTION_DOWN, id[0]=0, pointerCount=1, eventTime=599819817, downTime=599819817, phoneEventTime=17:30:51.067 } moveCount:0 D/MIUIInput( 7333): [MotionEvent] ViewRootImpl windowName 'com.example.google_map_flash/com.example.google_map_flash.MainActivity', { action=ACTION_UP, id[0]=0, pointerCount=1, eventTime=599819885, downTime=599819817, phoneEventTime=17:30:51.135 } moveCount:0 W/ProxyAndroidLoggerBackend( 7333): Too many Flogger logs received before configuration. Dropping old logs. 4 E/FrameEvents( 7333): updateAcquireFence: Did not find frame. ```Flutter Doctor output
``` [✓] Flutter (Channel stable, 3.19.6, on macOS 14.3.1 23D60 darwin-arm64, locale zh-Hans-CN) • Flutter version 3.19.6 on channel stable at /Users/a005103/fvm/versions/3.19.6 • Upstream repository https://github.com/flutter/flutter.git • Framework revision 54e66469a9 (5 days ago), 2024-04-17 13:08:03 -0700 • Engine revision c4cd48e186 • Dart version 3.3.4 • DevTools version 2.31.1 [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/a005103/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15E204a • CocoaPods version 1.15.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2023.1) • 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 17.0.7+0-17.0.7b1000.6-10550314) [✓] IntelliJ IDEA Ultimate Edition (version 2023.3.5) • IntelliJ at /Applications/IntelliJ IDEA.app • 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 [✓] VS Code (version 1.88.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.86.0 [✓] Connected device (5 available) • 23127PN0CC (mobile) • e727544e • android-arm64 • Android 14 (API 34) • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 14 (API 34) (emulator) • iPhone 15 (mobile) • B91C6079-B635-427F-90B6-1E36C2B025CC • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-4 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 14.3.1 23D60 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.61 [✓] Network resources • All expected network resources are available. ```