-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Closed
Closed
Copy link
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listc: crashStack traces logged to the consoleStack traces logged to the consolec: regressionIt was better in the past than it is nowIt was better in the past than it is nowfound in release: 3.3Found to occur in 3.3Found to occur in 3.3found in release: 3.4Found to occur in 3.4Found to occur in 3.4frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
Since the Flutter upgrade to 3.3.0 I am unable to use a WebView (neither flutter_webview nor third party packages like flutter_inappwebview) as it leads to an assertion error from TextureAndroidViewController.
I have a strong suspicion that it's caused by #101399.
This issue happens if parts of a Scaffold like the BottomNavigationBar have a varying height which is only known after a certain amount of time (asynchronously). This can be the case e. g. if menu items are loaded via an API.
Steps to Reproduce
- Paste the below code sample in a fresh Flutter 3.3.0 project
- Make sure to have a sufficient
minSdkVersion(I used23) - Execute
flutter runon the code sample with Flutter version of at least 3.0.0 - Wait 100 ms
- Realize that the WebView is not rendered and the terminal issues an error output
Expected results:
The WebView is rendered properly and the BottomNavigationBar is visible.
Actual results:
There is an error and neither the WebView nor the BottomNavigationBar is displayed.
Code sample
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const Scaffold(
body: WebView(
initialUrl: 'https://flutter.dev',
),
bottomNavigationBar: BottomNavigationExample(),
),
);
}
}
class BottomNavigationExample extends StatefulWidget {
const BottomNavigationExample({
Key? key,
}) : super(key: key);
@override
State<BottomNavigationExample> createState() =>
_BottomNavigationExampleState();
}
class _BottomNavigationExampleState extends State<BottomNavigationExample> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: Future.delayed(const Duration(milliseconds: 100)),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return Container();
}
return BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(icon: Icon(Icons.add), label: 'Test1'),
BottomNavigationBarItem(icon: Icon(Icons.add), label: 'Test2'),
],
);
},
);
}
}
Logs
I/flutter (19778): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter (19778): │ #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
I/flutter (19778): │ #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
I/flutter (19778): │ #2 TextureAndroidViewController._sendCreateMessage (package:flutter/src/services/platform_views.dart:1129:12)
I/flutter (19778): │ #3 AndroidViewController.create (package:flutter/src/services/platform_views.dart:792:11)
I/flutter (19778): │ #4 _PlatformViewLinkState.build.<anonymous closure> (package:flutter/src/widgets/platform_view.dart:876:22)
I/flutter (19778): │ #5 _PlatformViewPlaceholderBox.performLayout (package:flutter/src/widgets/platform_view.dart:1115:13)
I/flutter (19778): │ #6 RenderObject.layout (package:flutter/src/rendering/object.dart:2135:7)
I/flutter (19778): │ #7 RenderBox.layout (package:flutter/src/rendering/box.dart:2418:11)
I/flutter (19778): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter (19778): │ ⛔ [null] 'package:flutter/src/services/platform_views.dart': Failed assertion: line 1129 pos 12: '!size.isEmpty': trying to create TextureAndroidViewController without setting a valid size.
Analyzing test-app...
No issues found! (ran in 8.1s)
[✓] Flutter (Channel stable, 3.3.0, on macOS 12.5.1 21G83 darwin-x64, locale de-DE)
• Flutter version 3.3.0 on channel stable at /Users/marcgerken/dev/flutter-sdk/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ffccd96b62 (10 days ago), 2022-08-29 17:28:57 -0700
• Engine revision 5e9e0e0aa8
• Dart version 2.18.0
• DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/marcgerken/Library/Android/sdk/
• Platform android-33, build-tools 30.0.3
• ANDROID_HOME = /Users/marcgerken/Library/Android/sdk/
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 13F100
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.2)
• 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.12+0-b1504.28-7817840)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.1.1)
• 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.70.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listc: crashStack traces logged to the consoleStack traces logged to the consolec: regressionIt was better in the past than it is nowIt was better in the past than it is nowfound in release: 3.3Found to occur in 3.3Found to occur in 3.3found in release: 3.4Found to occur in 3.4Found to occur in 3.4frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version