flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
164.68k stars 27.14k forks source link

platformview doesn't correctly clip in scrollview on iOS #76097

Closed yasargil closed 3 years ago

yasargil commented 3 years ago

When a GoogleMap Widget scrolls offscreen it will be not correctly clipped.

Steps to Reproduce

  1. Run flutter create bug.
  2. Update the files as follows:

Add google maps dependency to pubspec.yaml and add your api key to appdelegate.

pubspec.yaml ```yaml dependencies: flutter: sdk: flutter google_maps_flutter: ^1.2.0 ```

lib/main.dart

code sample ```dart import 'package:flutter/material.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: MyHomePage(title: 'Flutter Demo Home Page'), ); } } class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; @override _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State { @override Widget build(BuildContext context) { var data = MediaQuery.of(context); var size = data.size; var padding = data.padding; var height = size.height - padding.top - padding.bottom - 100; return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: SingleChildScrollView( child: Column( children: [ Container( color: Colors.blue, height: height / 2.0, ), Container( color: Colors.red, height: height / 2.0, ), Map(), ], ), ), bottomNavigationBar: Container( color: Colors.purple, height: 150, ), ); } } class Map extends StatefulWidget { @override _MapState createState() => _MapState(); } class _MapState extends State { static final CameraPosition _kGooglePlex = CameraPosition( target: LatLng(37.42796133580664, -122.085749655962), zoom: 14.4746, ); @override Widget build(BuildContext context) { return AspectRatio( aspectRatio: 1.75, child: GoogleMap( gestureRecognizers: {}, buildingsEnabled: false, compassEnabled: false, indoorViewEnabled: false, mapToolbarEnabled: false, myLocationButtonEnabled: false, myLocationEnabled: false, padding: EdgeInsets.only( left: 0, top: 0, right: 0, bottom: 0, ), trafficEnabled: false, zoomControlsEnabled: false, zoomGesturesEnabled: false, rotateGesturesEnabled: false, scrollGesturesEnabled: false, tiltGesturesEnabled: false, initialCameraPosition: _kGooglePlex, ), ); } } ```
  1. Scroll to the bottom of scrollview until the map is visible. Scroll back up again.

Expected results: The map is not visible anymore

Actual results: Depending on the scroll velocity a part of the map will still be visible

This happens on a iPhone Xr with iOS 13.2 in release and debug mode.

Logs ``` [✓] Flutter (Channel dev, 1.27.0-1.0.pre, on macOS 11.1 20C69 darwin-x64, locale de-CH) • Flutter version 1.27.0-1.0.pre at /Users/yasargil/tools/flutter • Framework revision 68c96f100e (vor 7 Tagen), 2021-02-08 16:14:15 -0800 • Engine revision b04955656c • Dart version 2.13.0 (build 2.13.0-0.0.dev) [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2) • Android SDK at /Users/yasargil/Library/Android/sdk • Platform android-30, build-tools 29.0.2 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.2, Build version 12B45b • CocoaPods version 1.10.0 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 4.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 1.8.0_242-release-1644-b3-6915495) [!] IntelliJ IDEA Community Edition (version 2017.1.4) • IntelliJ at /Applications/IntelliJ IDEA CE.app ✗ Flutter plugin version 14.0 - the recommended minimum version is 16.0.0 • Dart plugin version 171.4694.29 • For information about installing plugins, see https://flutter.dev/intellij-setup/#installing-the-plugins [✓] VS Code (version 1.53.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.19.0 ```
TahaTesser commented 3 years ago

Hi @yasargil Thanks for filing the issue, I can reproduce it oniOS 14.4 physical and iOS 13.7 simulator, no issue on Android

iOS Android
code sample ```dart import 'package:flutter/material.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: MyHomePage(title: 'Flutter Demo Home Page'), ); } } class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; @override _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State { @override Widget build(BuildContext context) { var data = MediaQuery.of(context); var size = data.size; var padding = data.padding; var height = size.height - padding.top - padding.bottom - 100; return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: SingleChildScrollView( child: Column( children: [ Container( color: Colors.blue, height: height / 2.0, ), Container( color: Colors.red, height: height / 2.0, ), Map(), ], ), ), bottomNavigationBar: Container( color: Colors.purple, height: 150, ), ); } } class Map extends StatefulWidget { @override _MapState createState() => _MapState(); } class _MapState extends State { static final CameraPosition _kGooglePlex = CameraPosition( target: LatLng(37.42796133580664, -122.085749655962), zoom: 14.4746, ); @override Widget build(BuildContext context) { return AspectRatio( aspectRatio: 1.75, child: GoogleMap( gestureRecognizers: {}, buildingsEnabled: false, compassEnabled: false, indoorViewEnabled: false, mapToolbarEnabled: false, myLocationButtonEnabled: false, myLocationEnabled: false, padding: EdgeInsets.only( left: 0, top: 0, right: 0, bottom: 0, ), trafficEnabled: false, zoomControlsEnabled: false, zoomGesturesEnabled: false, rotateGesturesEnabled: false, scrollGesturesEnabled: false, tiltGesturesEnabled: false, initialCameraPosition: _kGooglePlex, ), ); } } ```
flutter doctor -v ```bash [✓] Flutter (Channel stable, 1.22.6, on macOS 11.2.1 20D74 darwin-x64, locale en-GB) • Flutter version 1.22.6 at /Users/tahatesser/Code/flutter_stable • Framework revision 9b2d32b605 (3 weeks ago), 2021-01-22 14:36:39 -0800 • Engine revision 2f0af37152 • Dart version 2.10.5 [✗] Android toolchain - develop for Android devices ✗ Unable to locate Android SDK. Install Android Studio from: https://developer.android.com/studio/index.html On first launch it will assist you in installing the Android SDK components. (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions). If the Android SDK has been installed to a custom location, set ANDROID_SDK_ROOT to that location. You may also want to add it to your PATH environment variable. [!] Xcode - develop for iOS and macOS (Xcode 12.4) • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer • Xcode 12.4, Build version 12D4e ✗ CocoaPods not installed. CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side. Without CocoaPods, plugins will not work on iOS or macOS. For more info, see https://flutter.dev/platform-plugins To install: sudo gem install cocoapods [!] Android Studio (version 4.1) • Android Studio at /Applications/Android Studio.app/Contents ✗ Flutter plugin not installed; this adds Flutter specific functionality. ✗ Dart plugin not installed; this adds Dart specific functionality. • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) [✓] VS Code (version 1.53.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.19.0 [✓] Connected device (2 available) • Taha’s iPhone (mobile) • 00008020-001059882212002E • ios • iOS 14.4 • iPhone 11 Pro Max (mobile) • 9C306016-57B8-46AB-A7ED-9E7EB11039CF • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-7 (simulator) ! Doctor found issues in 3 categories. ``` ```bash [✓] Flutter (Channel beta, 1.26.0-17.5.pre, on macOS 11.2.1 20D74 darwin-x64, locale en-GB) • Flutter version 1.26.0-17.5.pre at /Users/tahatesser/Code/flutter_beta • Framework revision 1fe38dcb5f (5 days ago), 2021-02-10 16:25:47 -0800 • Engine revision d4453f6018 • Dart version 2.12.0 (build 2.12.0-259.9.beta) [✗] Android toolchain - develop for Android devices ✗ Unable to locate Android SDK. Install Android Studio from: https://developer.android.com/studio/index.html On first launch it will assist you in installing the Android SDK components. (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions). If the Android SDK has been installed to a custom location, please use `flutter config --android-sdk` to update to that location. [!] Xcode - develop for iOS and macOS • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer • Xcode 12.4, Build version 12D4e ✗ CocoaPods not installed. CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side. Without CocoaPods, plugins will not work on iOS or macOS. For more info, see https://flutter.dev/platform-plugins To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions. [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 4.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 1.8.0_242-release-1644-b3-6915495) [✓] VS Code (version 1.53.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.19.0 [✓] Connected device (3 available) • Taha’s iPhone (mobile) • 00008020-001059882212002E • ios • iOS 14.4 • iPhone 11 Pro Max (mobile) • 9C306016-57B8-46AB-A7ED-9E7EB11039CF • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-7 (simulator) • Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.150 ! Doctor found issues in 2 categories. ``` ```bash [✓] Flutter (Channel master, 1.27.0-2.0.pre.103, on macOS 11.2.1 20D74 darwin-x64, locale en-GB) • Flutter version 1.27.0-2.0.pre.103 at /Users/tahatesser/Code/flutter_master • Framework revision f49956598b (3 hours ago), 2021-02-16 00:56:06 -0500 • Engine revision 1d537824d6 • Dart version 2.13.0 (build 2.13.0-30.0.dev) [✗] Android toolchain - develop for Android devices ✗ Unable to locate Android SDK. Install Android Studio from: https://developer.android.com/studio/index.html On first launch it will assist you in installing the Android SDK components. (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions). If the Android SDK has been installed to a custom location, please use `flutter config --android-sdk` to update to that location. [!] Xcode - develop for iOS and macOS • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer • Xcode 12.4, Build version 12D4e ✗ CocoaPods not installed. CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side. Without CocoaPods, plugins will not work on iOS or macOS. For more info, see https://flutter.dev/platform-plugins To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions. [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 4.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 1.8.0_242-release-1644-b3-6915495) [✓] VS Code (version 1.53.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.19.0 [✓] Connected device (4 available) • Taha’s iPhone (mobile) • 00008020-001059882212002E • ios • iOS 14.4 • iPhone 11 Pro Max (mobile) • 9C306016-57B8-46AB-A7ED-9E7EB11039CF • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-7 (simulator) • macOS (desktop) • macos • darwin-x64 • macOS 11.2.1 20D74 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.150 ! Doctor found issues in 2 categories. ```

Thank you

yasargil commented 3 years ago

Just a wild guess but could it be that this change is responsible. I am almost sure that it did not see that behaviour bevor November. @cyanglaz @flar https://github.com/flutter/engine/pull/22336

Edit. If we use an Scrollcontroller to jump to an offset without animation the issue is even more visible because the map stays in place over all other content. I think the map does not get redrawn if it is offscreen in the next frame.

Edit2: If we push a new route over the map it is still visible.

yasargil commented 3 years ago

In the video we can see that the map in the route below bleeds into the top route on pop for some/one frames. This happens only when both routes have a native view. https://user-images.githubusercontent.com/7766525/111281761-953f1b00-863d-11eb-8796-3cef61472a13.MP4

mitch2na commented 3 years ago

I just confirmed this is happening with flutter 2.0.1 as well and only for iOS. You get the same behavior with both GoogleMap and WebView within a vertically scrollable widget.

Anyone find a workaround for this?

flar commented 3 years ago

I have confirmed with bisection that https://github.com/flutter/engine/pull/22336 was where this problem arose. I have a couple of ideas for fixing it.

TahaTesser commented 3 years ago

i can confirm it as regression

webview (1.22.6) webiew (2.1) maps (1.22.6) maps (2.1)
ezgif com-gif-maker (4) ezgif com-gif-maker (5) ezgif com-gif-maker (2) ezgif com-gif-maker (3)
flutter doctor -v ```bash [✓] Flutter (Channel stable, 2.0.3, on macOS 11.2.3 20D91 darwin-x64, locale en-GB) • Flutter version 2.0.3 at /Users/tahatesser/Code/flutter_stable • Framework revision 4d7946a68d (11 days ago), 2021-03-18 17:24:33 -0700 • Engine revision 3459eb2436 • Dart version 2.12.2 [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at /Volumes/Extreme/SDK • Platform android-30, build-tools 30.0.3 • ANDROID_HOME = /Volumes/Extreme/SDK • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer • Xcode 12.4, Build version 12D4e • CocoaPods version 1.10.1 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 4.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 1.8.0_242-release-1644-b3-6915495) [✓] VS Code (version 1.54.3) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.20.0 [✓] Connected device (3 available) • iPhone 12 (mobile) • 83060656-28E7-44CD-801E-B11EC3EC89BA • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator) • macOS (desktop) • macos • darwin-x64 • macOS 11.2.3 20D91 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.90 • No issues found! ``` ```bash [✓] Flutter (Channel master, 2.1.0-13.0.pre.322, on macOS 11.2.3 20D91 darwin-x64, locale en-GB) • Flutter version 2.1.0-13.0.pre.322 at /Users/tahatesser/Code/flutter_master • Framework revision e93590474d (2 hours ago), 2021-03-30 02:14:03 -0400 • Engine revision dbcbf69a57 • Dart version 2.13.0 (build 2.13.0-175.0.dev) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at /Volumes/Extreme/SDK • Platform android-30, build-tools 30.0.3 • ANDROID_HOME = /Volumes/Extreme/SDK • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer • Xcode 12.4, Build version 12D4e • CocoaPods version 1.10.1 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 4.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 1.8.0_242-release-1644-b3-6915495) [✓] VS Code (version 1.54.3) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.20.0 [✓] Connected device (3 available) • iPhone 12 (mobile) • 83060656-28E7-44CD-801E-B11EC3EC89BA • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator) • macOS (desktop) • macos • darwin-x64 • macOS 11.2.3 20D91 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.90 • No issues found! ```
philipgiuliani commented 3 years ago

I can confirm this happening on Flutter 2.0 with the mapbox_gl Plugin (which also uses a PlatformView).

zanderso commented 3 years ago

@xster @gaaclarke on https://github.com/flutter/engine/pull/25161 (which is a bit of a hack) @flar suggests that "A better fix would be to modify the iOS embedder so that it paints nothing if its Paint() method is not actually called." This appears to already be the behavior in the Android embedder. Do either of you know where to look? Could be a small fix.

gaaclarke commented 3 years ago

@zanderso I'm not quite sure, the platform views implementation is divorced quite a bit from the underlying platform, I know a fraction of what the platform views engineers know. If I was looking into this bug, I'd investigate the geometry (frame) of the layer that is being rendered. I know there is some magic to synchronize the layer's geometry (frame) to match where it should go in relation to the Flutter renderer. It appears that code is out of wack, potentially stopping updating the frame of the layer one screen render (frame) prematurely.

bohdan1krokhmaliuk commented 3 years ago

Is there any progress on this issue? Can we add this (hack) to next flutter version? It is better to have working hack than not working platform views in scrollable widgets.

cyanglaz commented 3 years ago

I will take a look at this. Might update the milestone when I understand what's going on and can give a more accurate estimate

sooxt98 commented 3 years ago

Here's the bug im facing, basically jump scroll wont clear out the google map render cache https://user-images.githubusercontent.com/13378059/113733524-20876a00-972d-11eb-98d9-42dc749d6aea.MP4

bohdan1krokhmaliuk commented 3 years ago

I will take a look at this. Might update the milestone when I understand what's going on and can give a more accurate estimate

Does this mean that this will be fixed at July Beta Release (1.32) and till July it most likely will be not fixed? That's sad, because of this only issue I can't update the app to Flutter 2.0.

Does anyone know any workaround that I can use to fix the issue?

mouseface99 commented 3 years ago

I will take a look at this. Might update the milestone when I understand what's going on and can give a more accurate estimate

Does this mean that this will be fixed at July Beta Release (1.32) and till July it most likely will be not fixed? That's sad, because of this only issue I can't update the app to Flutter 2.0.

Does anyone know any workaround that I can use to fix the issue?

My temporary workaround was using the custom list view physics and reduce the max velocity of the scroller

class CustomScrollPhysics extends ScrollPhysics {
  const CustomScrollPhysics({ScrollPhysics parent}) : super(parent: parent);

  @override
  CustomScrollPhysics applyTo(ScrollPhysics ancestor) {
    return CustomScrollPhysics(parent: buildParent(ancestor));
  }

  @override
  Simulation createBallisticSimulation(ScrollMetrics position, double velocity) {

    // When it scrolls out of screen, use the original physics to bouncing back
    if (position.outOfRange)
      return super.createBallisticSimulation(position, velocity);

    ...

    return ClampingScrollSimulation(
      position: position.pixels,
      velocity: velocity / 3, // can use 1/2 or 1/3 for better user experience
      tolerance: tolerance,
    );
  }
}

Once the max scrolling velocity was reduced, the platform view blocking area would be small and only appear on the edge of top/bottom and won't cover the main center content.

FYR and Hope it helps :)

bohdan1krokhmaliuk commented 3 years ago

I will take a look at this. Might update the milestone when I understand what's going on and can give a more accurate estimate

Does this mean that this will be fixed at July Beta Release (1.32) and till July it most likely will be not fixed? That's sad, because of this only issue I can't update the app to Flutter 2.0. Does anyone know any workaround that I can use to fix the issue?

My temporary workaround was using the custom list view physics and reduce the max velocity of the scroller

class CustomScrollPhysics extends ScrollPhysics {
  const CustomScrollPhysics({ScrollPhysics parent}) : super(parent: parent);

  @override
  CustomScrollPhysics applyTo(ScrollPhysics ancestor) {
    return CustomScrollPhysics(parent: buildParent(ancestor));
  }

  @override
  Simulation createBallisticSimulation(ScrollMetrics position, double velocity) {

    // When it scrolls out of screen, use the original physics to bouncing back
    if (position.outOfRange)
      return super.createBallisticSimulation(position, velocity);

    ...

    return ClampingScrollSimulation(
      position: position.pixels,
      velocity: velocity / 3, // can use 1/2 or 1/3 for better user experience
      tolerance: tolerance,
    );
  }
}

Once the max scrolling velocity was reduced, the platform view blocking area would be small and only appear on the edge of top/bottom and won't cover the main center content.

FYR and Hope it helps :)

As I do understand that doesn't fix the problem, but just makes it less visible :(

flutter2k20 commented 3 years ago

I will take a look at this. Might update the milestone when I understand what's going on and can give a more accurate estimate

We have spend a lot of effort to move to Flutter 2.0 with null safety and what not, only to find out the ads package we use, suffers from the same issue others are facing for google maps or web view. This issue completely ruins the user experience with having the ads appear out of place when the users scrolls the listview, most times hiding some important UI components, essentially rending the app useless and we seeing a big impact of that in the time the users spend on our app.

There are so many effected packages/users with this bug, really surprised to see it is considered such low priority that its scheduled for July! Can someone please increase the priority of this issue?

flutter2k20 commented 3 years ago

I will take a look at this. Might update the milestone when I understand what's going on and can give a more accurate estimate

Just to name a few issues impacted by this bug for an googleads package.

mustafa-707 commented 3 years ago

same here after migrate to flutter 2 all ads plugins banner is floating and something goes wrong with ads and video players performance and the UI , i just got back to flutter 1.66.2 and all fine there .

testing :

android 8 and 10: it works fine and no floating issues but have a bad performance i don't know if this caused by the plugin googleads-mobile-flutter or by flutter 2 but its fine overall

andorid 5 : the ads makes the app to crash when ads appear and it gives me this kind of errors after integrate sentry 111313357-ee707400-8668-11eb-8c92-ec0913132bbe

I/Ads     ( 4439): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("3AE64AB069F1295E3CB0DF0395543D38")) to get test ads on this device.
I/AdCheck ( 4439): APS: blockAdView: android.widget.FrameLayout{3567934 G.E...... ......ID 0,0-720,1208 #1020002 android:id/content}
I/cr_Ime  ( 4439): ImeThread is enabled.
W/cr_BindingManager( 4439): Cannot call determinedVisibility() - never saw a connection for the pid: 4439
I/AdCheck ( 4439): APS: blockAdView: com.google.android.gms.ads.internal.webview.ac{2b3a81 GFE.HV... ......I. 0,0-0,0}
I/AdCheck ( 4439): APS: blockAdView: com.google.android.gms.ads.internal.webview.y{b03b8b9 G.E...... ......I. 0,0-0,0}
I/cr_Ime  ( 4439): ImeThread is enabled.
W/cr_BindingManager( 4439): Cannot call determinedVisibility() - never saw a connection for the pid: 4439
[log] interstitialAd onAdLoaded Maps
I/SendBroadcastPermission( 4439): action:huawei.intent.action.APS_UPDATE_DATA_ACTION, mPermissionType:0
I/AdCheck ( 4439): APS: blockAdView: android.widget.FrameLayout{8ffbfe9 G.E...... ......I. 0,0-0,0 #1020002 android:id/content}
E/art     ( 4439): invalid stream - problem with parameter iterator in /data/data/com.google.android.gms/app_chimera/m/0000000b/dl-AdsFdrDynamite.integ_210402101000000.apk for method void com.google.android.gms.ads.nonagon.ad.event.p.a(java.lang.Object)

iOS 12.5.1 and 14.3 : the ads floating and stuck over my App UI

Screen Shot 2021-04-27 at 12 40 22 AM

and again , all this issues just appear after migrate to flutter 2 and all was good with flutter 1.66.2 with same plugin and dart 2.10.5

My current Flutter version is 2.0.5 and the issue still going

flutter2k20 commented 3 years ago

same here after migrate to flutter 2 all ads plugins banner is floating and something goes wrong with ads and video players performance and the UI , i just got back to flutter 1.66.2 and all fine there .

testing :

android 8 and 10: it works fine and no floating issues but have a bad performance i don't know if this caused by the plugin googleads-mobile-flutter or by flutter 2 but its fine overall

andorid 5 : the ads makes the app to crash when ads appear and it gives me this kind of errors after integrate sentry 111313357-ee707400-8668-11eb-8c92-ec0913132bbe

I/Ads     ( 4439): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("3AE64AB069F1295E3CB0DF0395543D38")) to get test ads on this device.
I/AdCheck ( 4439): APS: blockAdView: android.widget.FrameLayout{3567934 G.E...... ......ID 0,0-720,1208 #1020002 android:id/content}
I/cr_Ime  ( 4439): ImeThread is enabled.
W/cr_BindingManager( 4439): Cannot call determinedVisibility() - never saw a connection for the pid: 4439
I/AdCheck ( 4439): APS: blockAdView: com.google.android.gms.ads.internal.webview.ac{2b3a81 GFE.HV... ......I. 0,0-0,0}
I/AdCheck ( 4439): APS: blockAdView: com.google.android.gms.ads.internal.webview.y{b03b8b9 G.E...... ......I. 0,0-0,0}
I/cr_Ime  ( 4439): ImeThread is enabled.
W/cr_BindingManager( 4439): Cannot call determinedVisibility() - never saw a connection for the pid: 4439
[log] interstitialAd onAdLoaded Maps
I/SendBroadcastPermission( 4439): action:huawei.intent.action.APS_UPDATE_DATA_ACTION, mPermissionType:0
I/AdCheck ( 4439): APS: blockAdView: android.widget.FrameLayout{8ffbfe9 G.E...... ......I. 0,0-0,0 #1020002 android:id/content}
E/art     ( 4439): invalid stream - problem with parameter iterator in /data/data/com.google.android.gms/app_chimera/m/0000000b/dl-AdsFdrDynamite.integ_210402101000000.apk for method void com.google.android.gms.ads.nonagon.ad.event.p.a(java.lang.Object)

iOS 12.5.1 and 14.3 : the ads floating and stuck over my App UI

Screen Shot 2021-04-27 at 12 40 22 AM

and again , all this issues just appear after migrate to flutter 2 and all was good with flutter 1.66.2 with same plugin and dart 2.10.5

My current Flutter version is 2.0.5 and the issue still going

Get used to using Flutter It will take half a year to fix it :) from the time the issue is reported.

I only hope in the July release they don't introduce another new bug :D

TahaTesser commented 3 years ago

@mustafa-707 This issue is related to iOS and there is no crash

If you're experiencing an issue on Android, please file a new issue with all the details following the issue template

sooxt98 commented 3 years ago

This is my second time encounter this issue, this is much more horrible and its totally nightmare for my app 😭 Could we just raise the priority?

https://user-images.githubusercontent.com/13378059/116411480-57522b00-a868-11eb-8152-e5ddc15bd6ad.mov

Related issue, https://github.com/googleads/googleads-mobile-flutter/issues/115

3eif commented 3 years ago

I'm also having the same issue with google ads in Flutter 2.0. Could we add the found in release 2.0 label?

blasten commented 3 years ago

@zanderso, is there a plan to cherry pick the fix?

flutter2k20 commented 3 years ago

Thank you Flutter team for listening to the community! Glad to see the priority raised for this issue, much appreciated!

zanderso commented 3 years ago

@blasten You can request a cherry-pick by applying appropriate tags to this issue, however the fix has not yet landed.

kf6gpe commented 3 years ago

This has been rejected for 2.0 stable or cherrypicking. We'll discuss later branch cherrypicks in our Monday release meeting.

flar commented 3 years ago

The fix for this issue was added to the engine in https://github.com/flutter/engine/commit/72114dafe28c8700f1d5d629c6ae9d34172ba395 and rolled to the framework as part of https://github.com/flutter/flutter/commit/2f6a52d6e0e9681f989ee7d3a1a338a06ed566a2

flar commented 3 years ago

(Closing the issue since it is fixed, but cherrypicking comments and activity may still be ongoing...)

sooxt98 commented 3 years ago

Hi @flar thanks for the fix , I just noticed that the ads is passing thru appbar in android as well. Im not sure whether it is related to this issue.

https://user-images.githubusercontent.com/13378059/116949254-419f9400-acb4-11eb-8764-4e1e4a0f87dc.mp4

return Scaffold(
      extendBodyBehindAppBar: true,
      appBar: PreferredSize(
        preferredSize: Size(MediaQuery.of(context).size.width, 70),
        child: GestureDetector(
          behavior: HitTestBehavior.translucent,
          onTap: () {
            TokboardController.to.scrollToTop();
          },
          child: ClipRRect(
            child: BackdropFilter(
              filter: ImageFilter.blur(sigmaX: 15, sigmaY: 15),
              child: AppBar(
                centerTitle: true,
                backgroundColor: Colors.transparent,
                toolbarHeight: 70,
                elevation: 0,
                title: Padding(
                  padding: const EdgeInsets.all(8.0),
                  child: GlithEffect(
                    child: Image.asset(
                      'assets/icon/zappy.png',
                      height: 50,
                    ),
                  ),
                ),
              ),
            ),
          ),
        ),
      ),
);
flar commented 3 years ago

@sooxt98 it looks more like the BackdropFilter in the app bar isn't affecting the ads. This is a separate issue. It might be related to https://github.com/flutter/flutter/issues/80766 but it is sort of the opposite outcome. I would encourage you to file a separate issue so we can triage it properly.

bohdan1krokhmaliuk commented 3 years ago

@flar When can we expect this change in Flutter stable? Just checked right now - and platformview still have this problem on flutter 2.0.6

flar commented 3 years ago

According to the current cp labels on this issue, it is targeted for 2.2

blasten commented 3 years ago

@sooxt98 Hybrid composition of platform views doesn't support BackdropFilter. I also don't think it works on iOS either. The list of supported filters is: https://github.com/flutter/flutter/issues/58426

It's not trivial to implement, but durable.

neokree commented 3 years ago

@flar Sorry but when Flutter 2.2 would be deployed in stable? This regression is the only thing that is blocking me for migrating to Flutter 2, and obviously now all packages have already migrated against it. The problem is that the Google Play Store will require a minimum target API level 30 starting from November (August for new apps), which also requires all apps to be compliant with the new MANAGE_EXTERNAL_STORAGE permission (https://support.google.com/googleplay/android-developer/answer/10467955).

Since in the timeline this issue was presented later than the Flutter 2 migrations, the majority of plugins (like open_file) have first migrated to Flutter 2, and then fixed the legacyExternalStorage option, which is now banned with the new permission method.

This could mean that if the issue is not fixed in stable before November, it would be impossible for developers to release updates to their Android apps and iOS apps. Since the first would be suspended by Google by not respecting the new rules if we not upgrade to Flutter 2, and the latter by the Apple team which would find the clip in the app and block the review, if we upgrade to Flutter 2.

flar commented 3 years ago

I'm not directly involve in the cherry picking process. Here is a pointer to the documentation about it:

https://github.com/flutter/flutter/wiki/Flutter-Cherrypick-Process

flar commented 3 years ago

It was recently merged into a cherry-picking candidate. The events didn't show up here because the fix was referenced by commit hash which doesn't update the corresponding issue.

https://github.com/flutter/engine/pull/25954

christopherfujino commented 3 years ago

It was recently merged into a cherry-picking candidate. The events didn't show up here because the fix was referenced by commit hash which doesn't update the corresponding issue.

flutter/engine#25954

ahh, yeah, i should have also linked the issue on the PR description.

neokree commented 3 years ago

Sorry but when Flutter 2.2 would be deployed in stable? This regression is the only thing that is blocking me for migrating to Flutter 2, and obviously now all packages have already migrated against it. The problem is that the Google Play Store will require a minimum target API level 30 starting from November (August for new apps), which also requires all apps to be compliant with the new MANAGE_EXTERNAL_STORAGE permission (https://support.google.com/googleplay/android-developer/answer/10467955).

Since in the timeline this issue was presented later than the Flutter 2 migrations, the majority of plugins (like open_file) have first migrated to Flutter 2, and then fixed the legacyExternalStorage option, which is now banned with the new permission method.

This could mean that if the issue is not fixed in stable before November, it would be impossible for developers to release updates to their Android apps and iOS apps. Since the first would be suspended by Google by not respecting the new rules if we not upgrade to Flutter 2, and the latter by the Apple team which would find the clip in the app and block the review, if we upgrade to Flutter 2.

@kf6gpe Could we know why this issue was rejected on Flutter 2.0 stable hotfix? Also, this fix will be available on stable before the start of November 2021? As the cited post, we need it before that date because of Google Play store guidelines

kf6gpe commented 3 years ago

We've significantly raised the bar given how long the 2.0 release has been in the channel, and this doesn't make the cut for Flutter 2.0.

We do a stable release approximately quarterly; I can't commit to dates, except to say that I'm confident it'll be in a stable release prior to then.

github-actions[bot] commented 3 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.