-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
iOS platform view is flashing on top of SliverPersistentHeader #86787
Comments
Hi @ilayda-simsek
Check flutter doctor -v[✓] Flutter (Channel stable, 2.2.3, on macOS 12.0 21A5284e darwin-x64, locale
en-GB)
• Flutter version 2.2.3 at /Users/tahatesser/Code/flutter_stable
• Framework revision f4abaa0735 (3 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/tahatesser/Code/SDK
• Platform android-30, build-tools 30.0.3
• ANDROID_HOME = /Users/tahatesser/Code/SDK
• Java binary at: /Users/tahatesser/Library/Application
Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.2)
• Android Studio at /Users/tahatesser/Library/Application
Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/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.8+10-b944.6916264)
[✓] VS Code (version 1.58.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.24.0
[✓] Connected device (4 available)
• Taha’s iPhone (mobile) • 00008020-001059882212002E • ios
• iOS 14.6
• iPhone 12 Pro (mobile) • 77C62AB9-8B71-43CF-BCAB-85B0A5B52F85 • ios
• com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
• macOS (desktop) • macos • darwin-x64
• macOS 12.0 21A5284e darwin-x64
• Chrome (web) • chrome •
web-javascript • Google Chrome 92.0.4515.107
• No issues found! [✓] Flutter (Channel beta, 2.3.0-24.1.pre, on macOS 12.0 21A5284e darwin-x64,
locale en-GB)
• Flutter version 2.3.0-24.1.pre at /Users/tahatesser/Code/flutter_beta
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 615957513e (4 weeks ago), 2021-06-25 09:24:44 -0700
• Engine revision 9d517f475b
• Dart version 2.14.0 (build 2.14.0-188.5.beta)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/tahatesser/Code/SDK
• Platform android-30, build-tools 30.0.3
• ANDROID_HOME = /Users/tahatesser/Code/SDK
• Java binary at: /Users/tahatesser/Library/Application
Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.2)
• Android Studio at /Users/tahatesser/Library/Application
Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/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.8+10-b944.6916264)
[✓] Android Studio (version 4.2)
• Android Studio at /Users/tahatesser/Library/Application
Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/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.8+10-b944.6916264)
[✓] VS Code (version 1.58.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.24.0
[✓] Connected device (4 available)
• Taha’s iPhone (mobile) • 00008020-001059882212002E • ios
• iOS 14.6
• iPhone 12 Pro (mobile) • 77C62AB9-8B71-43CF-BCAB-85B0A5B52F85 • ios
• com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
• macOS (desktop) • macos • darwin-x64
• macOS 12.0 21A5284e darwin-x64
• Chrome (web) • chrome •
web-javascript • Google Chrome 92.0.4515.107
• No issues found! [✓] Flutter (Channel dev, 2.4.0-4.0.pre, on macOS 12.0 21A5284e darwin-x64,
locale en-GB)
• Flutter version 2.4.0-4.0.pre at /Users/tahatesser/Code/flutter_dev
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision cc00e7e6bc (11 days ago), 2021-07-11 18:21:02 -0400
• Engine revision ed25e8f01e
• Dart version 2.14.0 (build 2.14.0-301.0.dev)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/tahatesser/Code/SDK
• Platform android-30, build-tools 30.0.3
• ANDROID_HOME = /Users/tahatesser/Code/SDK
• Java binary at: /Users/tahatesser/Library/Application
Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.2)
• Android Studio at /Users/tahatesser/Library/Application
Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/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.8+10-b944.6916264)
[✓] Android Studio (version 4.2)
• Android Studio at /Users/tahatesser/Library/Application
Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/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.8+10-b944.6916264)
[✓] VS Code (version 1.58.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.24.0
[✓] Connected device (4 available)
• Taha’s iPhone (mobile) • 00008020-001059882212002E • ios
• iOS 14.6 18F72
• iPhone 12 Pro (mobile) • 77C62AB9-8B71-43CF-BCAB-85B0A5B52F85 • ios
• com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
• macOS (desktop) • macos • darwin-x64
• macOS 12.0 21A5284e darwin-x64
• Chrome (web) • chrome •
web-javascript • Google Chrome 92.0.4515.107
• No issues found!
✅ : No Issue ❌: Issue reproduced |
@Piinks Can you give any insight as to whether this is a framework/scrolling or engine issue so we can make sure the right team investigates? |
Thanks @jmagman, looking now to see where this may be coming from |
I think this is an issue with the platform view. I have reduced the code sample down a fair bit, and it looks like the flicker of the platform view widget occurs when flinging very quickly. Here is a smaller coder repro: import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/rendering.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(home: HomeScreen());
}
}
class HomeScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: CustomScrollView(
slivers: [
SliverAppBar(
backgroundColor: Colors.black,
pinned: true,
title: Text('SliverAppBar'),
),
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return index.isEven
? Container(height: 120, child: PlatformViewWidget())
: Container(
height: 120,
child: Text('Text from Flutter'),
);
},
childCount: 16,
),
),
],
),
);
}
}
class PlatformViewWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
final Map<String, dynamic> creationParams = <String, dynamic>{};
if (Platform.isIOS) {
return UiKitView(
viewType: 'testView',
layoutDirection: TextDirection.ltr,
creationParams: creationParams,
creationParamsCodec: const StandardMessageCodec(),
);
}
return Container();
}
} |
I wasn't able to reproduce this with a import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/rendering.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(home: HomeScreen());
}
}
class HomeScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: CustomScrollView(
slivers: [
SliverAppBar(
backgroundColor: Colors.black,
pinned: true,
title: Text('SliverAppBar'),
),
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return index.isEven
? Container(height: 120, child: PlatformViewWidget())
: Container(
height: 120,
child: Text('Text from Flutter'),
);
},
childCount: 16,
),
),
],
),
);
}
}
class PlatformViewWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return AndroidView(
viewType: 'simple_view',
layoutDirection: TextDirection.ltr,
);
}
} |
As a workaround, if it is possible, we can use a widget other than SliverAppBar (AppBar maybe?) so that the SliverList doesn't go behind the app bar. |
@cyanglaz Unfortunately, as far as I know, SliverAppBar is the only widget that fits the requirements of our app. We need the app bar to be both floating and not pinned. Additionally, there are some cases where we add other widgets to the scroll view |
@ilayda-simsek Unfortunately, it seems to be an issue with the engine (PlatformView), so other widgets won't help as long as the scroll view has to go under it. I'm trying to find root cause in engine and will give an update when I find it. |
Update: the root cause seems to be the zPosition of overlay and platform views are not correct, so sometimes, the overlay (which should cover the platform view) is under the platform view for certain frames. I will work on a fix to ensure the overlays are always on top of the platform view, which should fix this issue. Edit: @ilayda-simsek fix is ready in the linked PR. Feel free to try it out. |
The engine fix has rolled into flutter master channel, please give it a try :) |
All looks good, thank you for the fix! @cyanglaz |
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 |
Steps to Reproduce
Expected results:
The platform view shouldn't be rendered on top of the pinned headers.
Actual results:
Platform view can be seen on top of the pinned SliverAppBar and the SliverPersistentHeader widgets as user scrolls up and down.
The behavior can be seen in the following video. In here, the SliverAppBar and the SliverPersistentHeader are pinned inside a CustomScrollView. The blue ones are iOS Platform Views. The platform view widget appears briefly on top of the SliverAppBar and the SliverPersistentHeader as user scrolls up and down.
Note: Tried on both stable and master channels. Problem was reproducible in both.
Logs
The text was updated successfully, but these errors were encountered: