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

Launching with rect causes an exception #63

Open
volgin opened this issue Apr 14, 2018 · 5 comments
Open

Launching with rect causes an exception #63

volgin opened this issue Apr 14, 2018 · 5 comments
Labels

Comments

@volgin
Copy link

volgin commented Apr 14, 2018

This code works:
flutterWebviewPlugin.launch("https://google.com");

This code, however,

flutterWebviewPlugin.launch("https://google.com",
        rect: new Rect.fromLTRB(0.0, 0.0, 0.0, 0.0));

causes an exception. I tried with different rect settings, tried putting this code in different places - in initState(), in build(), in main.dart - with the same results:

E/flutter (27126): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter (27126): PlatformException(error, The specified child already has a parent. You must call removeView() on the child's parent first., null)
E/flutter (27126): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:547:7)
E/flutter (27126): #1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:279:18)
E/flutter (27126): <asynchronous suspension>
E/flutter (27126): #2      FlutterWebviewPlugin.launch (package:flutter_webview_plugin/src/base.dart:103:20)
E/flutter (27126): <asynchronous suspension>
E/flutter (27126): #3      _AboutViewState.build (package:rebelation/screens/about_view/about_view.dart:48:33)
E/flutter (27126): #4      StatefulElement.build (package:flutter/src/widgets/framework.dart:3713:27)
E/flutter (27126): #5      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3625:15)
E/flutter (27126): #6      Element.rebuild (package:flutter/src/widgets/framework.dart:3478:5)
E/flutter (27126): #7      StatefulElement.update (package:flutter/src/widgets/framework.dart:3782:5)
E/flutter (27126): #8      Element.updateChild (package:flutter/src/widgets/framework.dart:2682:15)
E/flutter (27126): #9      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3636:16)
E/flutter (27126): #10     Element.rebuild (package:flutter/src/widgets/framework.dart:3478:5)
E/flutter (27126): #11     StatelessElement.update (package:flutter/src/widgets/framework.dart:3685:5)
E/flutter (27126): #12     Element.updateChild (package:flutter/src/widgets/framework.dart:2682:15)
E/flutter (27126): #13     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4644:14)
E/flutter (27126): #14     Element.updateChild (package:flutter/src/widgets/framework.dart:2682:15)
E/flutter (27126): #15     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4644:14)
E/flutter (27126): #16     Element.updateChild (package:flutter/src/widgets/framework.dart:2682:15)
E/flutter (27126): #17     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4644:14)
E/flutter (27126): #18     Element.updateChild (package:flutter/src/widgets/framework.dart:2682:15)
E/flutter (27126): #19     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4644:14)
E/flutter (27126): #20     Element.updateChild (package:flutter/src/widgets/framework.dart:2682:15)
E/flutter (27126): #21     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3636:16)
E/flutter (27126): #22     Element.rebuild (package:flutter/src/widgets/framework.dart:3478:5)
E/flutter (27126): #23     StatefulElement.update (package:flutter/src/widgets/framework.dart:3782:5)
E/flutter (27126): #24     Element.updateChild (package:flutter/src/widgets/framework.dart:2682:15)
E/flutter (27126): #25     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3636:16)
E/flutter (27126): #26     Element.rebuild (package:flutter/src/widgets/framework.dart:3478:5)
E/flutter (27126): #27     StatelessElement.update (package:flutter/src/widgets/framework.dart:3685:5)
E/flutter (27126): #28     Element.updateChild (package:flutter/src/widgets/framework.dart:2682:15)
E/flutter (27126): #29     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3636:16)
E/flutter (27126): #30     Element.rebuild (package:flutter/src/widgets/framework.dart:3478:5)
E/flutter (27126): #31     StatefulElement.update (package:flutter/src/widgets/framework.dart:3782:5)
E/flutter (27126): #32     Element.updateChild (package:flutter/src/widgets/framework.dart:2682:15)
E/flutter (27126): #33     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4644:14)
E/flutter (27126): #34     Element.updateChild (package:flutter/src/widgets/framework.dart:2682:15)
E/flutter (27126): #35     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3636:16)
E/flutter (27126): #36     Element.rebuild (package:flutter/src/widgets/framework.dart:3478:5)
E/flutter (27126): #37     ProxyElement.update (package:flutter/src/widgets/framework.dart:3892:5)
E/flutter (27126): #38     Element.updateChild (package:flutter/src/widgets/framework.dart:2682:15)
E/flutter (27126): #39     SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4644:14)
E/flutter (27126): #40     Element.updateChild (package:flutter/src/widgets/framework.dart:2682:15)
E/flutter (27126): #41     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3636:16)
E/flutter (27126): #42     Element.rebuild (package:flutter/src/widgets/framework.dart:3478:5)
E/flutter (27126): #43     StatefulElement.update (package:flutter/src/widgets/framework.dart:3782:5)
E/flutter (27126): #44     Element.
@jimsimon
Copy link

I remember running into a similar issue. I ultimately put all of the creation logic in initState without using the rect property. Then I used flutterWebviewPlugin.resize(rect) inside build. This had the added benefit of also properly handling screen orientation changes.

@lejard-h lejard-h added the bug label Apr 25, 2018
@lejard-h
Copy link
Collaborator

did you solve your problem using flutterWebviewPlugin.resize or by updating flutter and the plugin ?

@atreeon
Copy link

atreeon commented May 25, 2018

Hi, I updated to 0.1.6 and the error was still showing. I launched the webview inside initState and then called resize in my build and the 'The specified child already has a parent' error went away.

@fantasy525
Copy link

same issue

@Nazacheres
Copy link

Same issue, blocker for whole application development. :(

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

No branches or pull requests

6 participants