首页 > 解决方案 > 在 Bubblebottombar 颤振上创建 webview 链接

问题描述

感谢您的帮助,我正在尝试在我的应用程序菜单中创建一个链接,该链接将通过 webview 打开我的 YouTube 频道,有人能告诉我这怎么可能吗?非常感谢

dasboardactivity.dart

 Widget build(BuildContext context) {
return Scaffold(
  body: Container(
    child: Center(
      child: getView(currentPage),
    ),
  ),
  bottomNavigationBar: BubbleBottomBar(
    opacity: .2,
    currentIndex: currentPage,
    backgroundColor: appStore.appBarColor,
    elevation: 8,
    onTap: changePage,
    hasNotch: false,
    hasInk: true,
    inkColor: appStore.appColorPrimaryLightColor,
    items: <BubbleBottomBarItem>[
      tab("home-run.png", keyString(context, "title_bookStore")),
      tab(
          "librarysolid.png",
          isLoginIn
              ? keyString(context, "title_myLibrary")
              : keyString(context, "lbl_categories")),
      tab("search.png", keyString(context, "title_search")),
      tab("user.png", keyString(context, "title_account")),
    ],
  ),
);

}

标签: flutter

解决方案


你可以用flutter webview包解决

Widget build(BuildContext context) {
    return Directionality(
      textDirection: TextDirection.ltr,
      child: Stack(
        children: <Widget>[
          WebView(
            initialUrl: this.url,
            javascriptMode: JavascriptMode.unrestricted,
            onPageFinished: (finish) {
              setState(() {
                isLoading = false;
              });
            },
          ),
          isLoading
              ? Center(
                  child: CircularProgressIndicator(),
                )
              : Stack(),
        ],
      ),
    );
  }

您可以使用 Stack 将其放置在您需要的任何位置


推荐阅读