搜索插件、代码仓与 APP 分类

插件详情v0.17.3

flutter_web_browser

一个 Flutter 插件项目,用于使用 Chrome 自定义标签页和 SFSafariViewController 打开网页。

AndroidiOS
近 30 天下载
1.4万
喜欢数
95
Pub 分数
130

安装插件

flutter pub add flutter_web_browser

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个 Flutter 插件,可使用平台特定的浏览器组件打开网页:Android 上的 Chrome 自定义标签页和 iOS 上的 SFSafariViewController。它提供无缝、原生般的浏览体验,无需离开应用。该包轻量且易于与现有 Flutter 项目集成。支持深度链接,并在导航过程中保持用户上下文。适用于需要安全、品牌化网页查看且开销最小的应用。

适合场景

  • 在应用内打开外部链接
  • 安全嵌入网页内容
  • 重定向用户到登录或付款页面
  • 显示帮助或服务条款
  • 通过原生浏览器UI提升用户参与度

主要特点

  • Android 上的 Chrome 自定义标签页
  • iOS 上的 SFSafariViewController
  • 安全的原生浏览体验
  • 最小化应用切换
  • 支持深度链接
  • 与 Flutter 的轻松集成

适合对象

  • 需要安全网页导航的应用程序
  • 希望实现原生浏览器行为的开发者
  • 包含外部内容链接的项目
  • 以移动设备为优先的应用程序
  • 以用户体验为中心的应用程序,注重流畅的过渡效果

使用建议

  • 需要 Android SDK 21+ 才能获得完整功能
  • SFSafariViewController 需要 iOS 9 或更高版本
  • 与完整 WebView 相比,自定义功能有限
  • 网页内容不支持离线使用
  • 取决于系统浏览器的可用性

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

flutter_web_browser

Pub

A flutter plugin to open a web page with Chrome Custom Tabs & SFSafariViewController.

This plugin is under development, APIs might change.

Getting Started

Installation

Install the library from pub:

dependencies:
  flutter_web_browser: "^0.17.3"
Import the library
import 'package:flutter_web_browser/flutter_web_browser.dart';
Open the web page
FlutterWebBrowser.openWebPage(
  url: "https://flutter.io/",
  customTabsOptions: const CustomTabsOptions(
    colorScheme: CustomTabsColorScheme.dark,
    toolbarColor: Colors.deepPurple,
    secondaryToolbarColor: Colors.green,
    navigationBarColor: Colors.amber,
    shareState: CustomTabsShareState.on,
    instantAppsEnabled: true,
    showTitle: true,
    urlBarHidingEnabled: true,
  ),
  safariVCOptions: const SafariViewControllerOptions(
    barCollapsingEnabled: true,
    preferredBarTintColor: Colors.green,
    preferredControlTintColor: Colors.amber,
    dismissButtonStyle: SafariViewControllerDismissButtonStyle.close,
    modalPresentationCapturesStatusBarAppearance: true,
  ),
);

License

This project is licensed under the terms of the MIT license.

所属分类

源码仓库

使用此插件的项目