Repository navigation
Open
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectd: api docsIssues with https://api.flutter.dev/Issues with https://api.flutter.dev/engineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.found in release: 3.7Found to occur in 3.7Found to occur in 3.7found in release: 3.9Found to occur in 3.9Found to occur in 3.9has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyWeb applications specificallyteam-webOwned by Web platform teamOwned by Web platform teamtriaged-webTriaged by Web platform teamTriaged by Web platform team
Description
It appears that stacking widget on top of a WebViewWidget does not work in the web version.
I have also tested this on Android, and there stacking widgets on top of WebViewWidget does appear to work.
I also tried using another WebView package web_browser, but the same behaviour occurs.
Steps to Reproduce
- Install
webview_flutter_web (0.2.2+1)webview_flutter - Execute
flutter runon the code sample using Chrome (see "Code sample" section below) - Click "Webview with icon test" button
- Interact with widgets (back button, visibility icon)
Expected results:
Interactivity with the widgets, such as returning when using the back button, or switching the visibility symbol to a visibility_off symbol.
Actual results:
No interactivity. The back button sometimes show the "hover over" effect.
Code sample
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
// import 'package:web_browser/web_browser.dart';
void main() {
runApp(const MainApp());
}
class MainApp extends StatelessWidget {
const MainApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Builder(
builder: (context) => Scaffold(
body: Center(
child: Card(
child: ListTile(
title: const Text(
'Webview with icon test',
),
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
return const WebViewPage();
},
),
);
}),
),
),
),
),
);
}
}
class WebViewPage extends StatefulWidget {
const WebViewPage({Key? key}) : super(key: key);
@override
State<WebViewPage> createState() => _WebViewPageState();
}
class _WebViewPageState extends State<WebViewPage> {
late final WebViewController _controller;
@override
void initState() {
super.initState();
_controller = WebViewController()
..loadRequest(
Uri.parse('http://flutter.dev'),
);
}
bool visibilityIsPressed = false;
@override
Widget build(BuildContext context) {
final ColorScheme colors = Theme.of(context).colorScheme;
return Scaffold(
extendBodyBehindAppBar: true,
appBar: AppBar(
iconTheme: IconThemeData(
color: colors.primary,
),
backgroundColor: Colors.transparent,
),
body: Stack(
children: [
WebViewWidget(controller: _controller),
// Browser(initialUriString: 'https://flutter.dev/',), //Another package with the same issue
SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
IconButton(
iconSize: 30,
icon: (visibilityIsPressed)
? const Icon(Icons.visibility_off_outlined)
: const Icon(Icons.visibility_outlined),
onPressed: () {
setState(() {
visibilityIsPressed = !visibilityIsPressed;
});
},
),
],
),
),
),
],
),
);
}
}
Logs
The verbose log is too long to attach in the text so it is attached as a separate file.
run_verbose.txt
Analyzing flutter_application_1...
No issues found! (ran in 1.0s)
[✓] Flutter (Channel stable, 3.7.6, on Ubuntu 22.10 5.14.0-1034-oem, locale en_US.UTF-8)
• Flutter version 3.7.6 on channel stable at /home/william/snap/flutter/common/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 12cb4eb7a0 (3 weeks ago), 2023-03-01 10:29:26 -0800
• Engine revision ada363ee93
• Dart version 2.19.3
• DevTools version 2.20.1
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
• Android SDK at /home/william/Android/Sdk
• Platform android-33-ext4, build-tools 33.0.2
• Java binary at: /snap/android-studio/125/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• CHROME_EXECUTABLE = /snap/bin/chromium
[✓] Linux toolchain - develop for Linux desktop
• clang version 10.0.0-4ubuntu1
• cmake version 3.16.3
• ninja version 1.10.0
• pkg-config version 0.29.1
[run_verbose.txt](https://github.com/flutter/flutter/files/11054321/run_verbose.txt)
[✓] Android Studio (version 2021.3)
• Android Studio at /snap/android-studio/125/android-studio
• 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
• VS Code at /snap/code/current
• Flutter extension version 3.60.0
[✓] Connected device (2 available)
• Linux (desktop) • linux • linux-x64 • Ubuntu 22.10 5.14.0-1034-oem
• Chrome (web) • chrome • web-javascript • Chromium 111.0.5563.64 snap
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Reacted by Shubham Gupta
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projectd: api docsIssues with https://api.flutter.dev/Issues with https://api.flutter.dev/engineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.found in release: 3.7Found to occur in 3.7Found to occur in 3.7found in release: 3.9Found to occur in 3.9Found to occur in 3.9has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyWeb applications specificallyteam-webOwned by Web platform teamOwned by Web platform teamtriaged-webTriaged by Web platform teamTriaged by Web platform team
Activity
darshankawar commentedon Mar 24, 2023
@willov
Thanks for the report. You mentioned
webview_flutter_weband in code sample you usedwebview_flutter, so could you clarify this ?We know that
webview_flutter_webis web implementation of the plugin, but would be helpful to know if this is related towebview_flutteritself or with _web version of the plugin.willov commentedon Mar 24, 2023
I was under the impression that
webview_flutter_webwas needed to run webviews in a web application.But you are correct that it was not included in the code sample. Furthermore, removing
webview_flutter_webfrom the pubspec.yml and runningflutter pub cleanstill allows the application to run. So, I assume that thatwebview_flutter_webwas indeed not used. Sorry for the mixup!Still, it is not possible to interact with the stacked widgets in the web application (when using the
webview_flutterpackage).I have uploaded the full small example to this repository: https://github.com/willov/flutter_webview_issue_example
darshankawar commentedon Mar 27, 2023
Thanks for the update. I verified this behavior on web and on mobile and confirmed that the reported behavior occurs on web, ie, tapping on stacked widgets like back button or eye icon don't perform any action, as they are placed over the webview.
Whereas, the same interactions occur on mobile platform (Android). I don't see an existing issue for web platform for same behavior, so labeling as such.
stable, master flutter doctor -v
stuartmorgan-g commentedon Mar 28, 2023
@ditman Is this a duplicate?
ditman commentedon Mar 28, 2023
@willov, @stuartmorgan, @darshankawar: I think this is solved by wrapping the widgets that are stacked on top of the HtmlElementView in a
PointerInterceptorwidget frompackage:pointer_interceptor(which will noop in mobile). Take a look at the package here:(In the future we want to promote the package to the framework, and automate its usage in several places, but for now it's a separate thing).
@willov let me know if this solves your issue!
4 remaining items
willov commentedon Mar 30, 2023
@ditman wrapping the widgets in the pointer_interceptor package does indeed solve the issue in the web application. Perhaps obviously, I had to include a leading icon with an onPressed action to get the back button to be intractable.
Perhaps mentioning this pointer_interceptor package on the webview_flutter page would be a good idea?
Either way, big thanks for pointing out the solution!
yjbanov commentedon Mar 30, 2023
For now making it a documentation issue, but we should consider moving pointer interceptor into the framework, so that:
khaled-0 commentedon Jan 20, 2026
Meanwhile another thing is happening in MacOS 26
Flutter 3.38.7
The WebView itself is not interactive when I wrap it in a
Card.outlinedUpon further investigation it seems adding border on foreground makes it not clickable anymore
ditman commentedon Jan 20, 2026
@khaled-0 I think the issue you're describing got fixed here:
If not, please create a new issue, do not revive such an old issue please!
khaled-0 commentedon Jan 21, 2026
nope, I just tried the master branch and the issue persist.
I'll go ahead and open a separate bug report #181257