Skip to content

Second screen below WebviewScaffold #224

@jordansilva

Description

@jordansilva

Using WebviewScaffold with appBar and bottomNavigationBar bugs the Navigation.push.

I'm using the WebviewScaffold as my primary route "/", with two IconButtons inside a Row, in the bottomNavigationBar. Also, using the AppBar inside the WebviewScaffold.
Opening the second page replaces only the AppBar and the BottomNavigationBar, the WebView is still there.

Maybe I'm doing something wrong with the Navigator, I don't know. :/

MaterialApp(
      title: 'Flutter Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      routes: {
        "/": (_) => WebView(),
      },
    );

... 

class _WebViewState extends State<WebView> {
  
  @override
  Widget build(BuildContext context) {
    return new WebviewScaffold(
      url: "https://www.google.com",
      appBar: AppBar(title: Text("First WebPage")),
      bottomNavigationBar: bottomNavigation(context),
    );
  }

  @override
  void dispose() {
    _flutterWebView.dispose();
    super.dispose();
  }

  /// Buttons
  Row bottomNavigation(context) {
    return Row(
      children: <Widget>[
        IconButton(
            icon: Icon(Icons.list),
            onPressed: () {
              openList(context);
            }),
        IconButton(icon: Icon(Icons.phone_android), onPressed: openNativeScreen)
      ],
      mainAxisAlignment: MainAxisAlignment.center,
    );
  }

  ///Actions
  void openList(BuildContext context) {
    Navigator.push(context, new NavigationRoute(builder: (context) => new ListScreen()));
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions