flutter_webview_plugin
flutter_webview_plugin copied to clipboard
Issue Launching Webview Hidden
I'm trying to launch a hidden webview and show it by pressing a button. It works fine on IOS and android emulator, but not in the actual android device (i tryed tree different phones). The webview is active, but it only appear at the very top of the screen. I can navigate, press buttons and everything in the blank screen.
I'm putting a screenshot
and here is the code:
import 'package:flutter/material.dart';
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
void main() {
runApp(new MaterialApp(
home: MyApp()));
}
class MyApp extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _HomeState();
}
}
class _HomeState extends State<MyApp> {
int _currentIndex = 0;
final flutterWebviewPlugin = new FlutterWebviewPlugin();
void createWebview() {
flutterWebviewPlugin.launch(
"https://pub.dartlang.org/packages/flutter_webview_plugin",
rect: new Rect.fromLTWH(0.0, 0.0, MediaQuery.of(context).size.width,MediaQuery.of(context).size.height - 60),
hidden: true,
);
}
void onTabTapped(int index) {
print("$index");
if (index == 0) {
createWebview();
}
if (index == 1) {
flutterWebviewPlugin.show();
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
bottomNavigationBar: BottomNavigationBar(
fixedColor: Colors.red,
onTap: onTabTapped,
currentIndex: _currentIndex,
items: [
BottomNavigationBarItem(
icon: Padding(
padding: EdgeInsets.only(left: 3.0),
child: Icon(Icons.create, size: 22)),
title: new FittedBox(
child: Padding(
padding: EdgeInsets.only(left: 3.0),
child: Text('Create WebView')),
),
),
BottomNavigationBarItem(
icon: Icon(Icons.home,size: 22),
title: new FittedBox(
child: Padding(
padding: EdgeInsets.only(top: 1.4),
child: Text('Show WebView')),
),
),
],
));
}
}
Hello,
Still having the same issue. Please share solution.