{"id":26194160,"url":"https://github.com/dint-dev/web_browser","last_synced_at":"2025-04-15T03:14:57.701Z","repository":{"id":50084025,"uuid":"328529411","full_name":"dint-dev/web_browser","owner":"dint-dev","description":"Displays websites in Flutter. Contains navigation/sharing buttons, anti-phishing design, and more.","archived":false,"fork":false,"pushed_at":"2023-11-15T06:34:39.000Z","size":2448,"stargazers_count":21,"open_issues_count":8,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-15T03:14:53.091Z","etag":null,"topics":["flutter"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dint-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-01-11T02:39:01.000Z","updated_at":"2025-01-04T01:24:59.000Z","dependencies_parsed_at":"2024-01-23T17:25:06.848Z","dependency_job_id":"67943254-515e-423d-b6f6-3fea27bba382","html_url":"https://github.com/dint-dev/web_browser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dint-dev%2Fweb_browser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dint-dev%2Fweb_browser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dint-dev%2Fweb_browser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dint-dev%2Fweb_browser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dint-dev","download_url":"https://codeload.github.com/dint-dev/web_browser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248997079,"owners_count":21195799,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flutter"],"created_at":"2025-03-12T01:55:25.644Z","updated_at":"2025-04-15T03:14:57.677Z","avatar_url":"https://github.com/dint-dev.png","language":"Dart","readme":"[![Pub Package](https://img.shields.io/pub/v/web_browser.svg)](https://pub.dartlang.org/packages/web_browser)\n[![Github Actions CI](https://github.com/dint-dev/web_browser/workflows/Dart%20CI/badge.svg)](https://github.com/dint-dev/web_browser/actions?query=workflow%3A%22Dart+CI%22)\n\n# Overview\nThe package gives you [Browser](https://pub.dev/documentation/web_browser/latest/web_browser/Browser-class.html),\na Flutter widget for displaying web pages.\n\nThe package is built on top of [webview_flutter](https://pub.dev/packages/webview_flutter) and it\nadds navigation widgets that:\n  * Display the domain.\n  * Allow user to tap \"back\", \"forward\", \"refresh\", or share the URL using a native dialog of each\n    platform.\n  * Display website loading error messages in a visually pleasant and easy-to-understand way.\n\n_Browser_ has been tested in Android, iOS, and browsers. By adding relevant \"webview_flutter\"\nplugin dependencies to your \"pubspec.yaml\", you can use this package in Windows, Mac OS X, and\nLinux too.\n\nLicensed under the [Apache License 2.0](LICENSE).\n\n## Links\n* [Github project](https://github.com/dint-dev/web_browser)\n* [Issue tracker](https://github.com/dint-dev/web_browser/issues)\n* [API Reference](https://pub.dev/documentation/web_browser/latest/index.html)\n\n# Setting up\n## 1.Setup\nIn _pubspec.yaml_:\n```yaml\ndependencies:\n  web_browser: ^0.7.4\n```\n\n## 2.Display web browser\n```dart\nimport 'package:flutter/material.dart';\nimport 'package:web_browser/web_browser.dart';\n\nvoid main() {\n  runApp(const MaterialApp(\n    home: Scaffold(\n      body: SafeArea(\n        child: Browser(\n          initialUriString: 'https://flutter.dev/',\n        ),\n      ),\n    ),\n  ));\n}\n```\n\n# Manual\n## Default designs\nThe package contains two designs, Cupertino ([web_browser.cupertino](https://pub.dev/documentation/web_browser/latest/web_browser.cupertino/web_browser.cupertino-library.html))\nand Material ([web_browser.material](https://pub.dev/documentation/web_browser/latest/web_browser.cupertino/web_browser.material-library.html)).\nBy default, the package chooses a Cupertino or Material design based on whether the app is _CupertinoApp_ or _MaterialApp_.\nYou can override the defaults by using relevant parameters of\n[Browser()](https://pub.dev/documentation/web_browser/latest/web_browser/Browser/Browser.html)\nconstructor.\n\nThe Cupertino and Material navigation bars look like this:\n\n![](screenshots/cupertino.png)\n\n![](screenshots/material.png)\n\n## Localization\nUse [BrowserLocalizations](https://pub.dev/documentation/web_browser/latest/web_browser/BrowserLocalizations-class.html)\nto localize the widgets.\n\n```dart\nvoid main() {\n  runApp(MaterialApp(\n    localizations: [\n      ...browserLocalizationsList,\n      // ...\n    ],\n    // ...\n  ));\n}\n\nfinal browserLocalizationsList = [\n  // Spanish localization\n  BrowserLocalizations.forLocale(\n    locale: Locale('es'),\n    load: (locale) async =\u003e BrowserLocalizations(\n      couldNotReach: 'No se pudo acceder al sitio web.',\n      // ...\n    ),\n  ),\n];\n```\n\n## Setting various parameters\nYou can give various parameters to [Browser](https://pub.dev/documentation/web_browser/latest/web_browser/Browser-class.html):\n```dart\nimport 'package:flutter/material.dart';\nimport 'package:web_browser/web_browser.dart';\n\nvoid main() {\n  runApp(const MaterialApp(\n    home: Scaffold(\n      body: SafeArea(\n        child: Browser(\n          initialUriString: 'https://flutter.dev/',\n          controller: BrowserController(\n            // \"User-Agent\" HTTP header.\n            userAgent: 'Your user agent',\n            \n            // Can user zoom into the content? Default is true.\n            isZoomingEnabled: false,\n          )\n        ),\n      ),\n    ),\n  ));\n}\n```\n\n## Cache clearing\nFor end-users privacy, it is good to clear:\n  * Cookies\n  * Caches\n  * Local storage\n\nYou can enable this by setting:\n```dart\nimport 'package:web_browser/web_browser.dart';\n\nvoid main() {\n  // Clear when the app is started\n  BrowserController.resetGlobalStateAtStart = true;\n  \n  // Clear every now and then.\n  BrowserController.globalStateExpiration = const Duration(days: 1);\n  \n  // ...\n}\n```\n\n## Accessing WebViewController\nTo access [WebViewController](https://pub.dev/documentation/webview_flutter/latest/webview_flutter/WebViewController-class.html)\nby using [browserController.webViewController](https://pub.dev/documentation/web_browser/latest/web_browser/BrowserController/webViewController.html).","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdint-dev%2Fweb_browser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdint-dev%2Fweb_browser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdint-dev%2Fweb_browser/lists"}