Skip to content
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

Issue Launching Webview Hidden #297

Closed
MilloshFey opened this issue Jan 14, 2019 · 1 comment
Closed

Issue Launching Webview Hidden #297

MilloshFey opened this issue Jan 14, 2019 · 1 comment

Comments

@MilloshFey
Copy link

MilloshFey commented Jan 14, 2019

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
error
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')),
                ),
              ),
          ],
        ));
  }
}
@pgfepale
Copy link

Hello,

Still having the same issue. Please share solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants