{"id":13548697,"url":"https://github.com/yungzhu/flutter_link_preview","last_synced_at":"2025-10-31T22:30:34.156Z","repository":{"id":43061397,"uuid":"263907945","full_name":"yungzhu/flutter_link_preview","owner":"yungzhu","description":"This is a Flutter URL preview plugin for Flutter that previews the content of a URL","archived":false,"fork":false,"pushed_at":"2022-08-24T08:43:40.000Z","size":1175,"stargazers_count":69,"open_issues_count":19,"forks_count":63,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-29T09:38:02.264Z","etag":null,"topics":["dart","flutter","gif","linkpreview"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yungzhu.png","metadata":{"files":{"readme":"README-ZH.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}},"created_at":"2020-05-14T12:24:18.000Z","updated_at":"2024-04-02T17:40:36.000Z","dependencies_parsed_at":"2022-09-10T06:50:55.010Z","dependency_job_id":null,"html_url":"https://github.com/yungzhu/flutter_link_preview","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/yungzhu%2Fflutter_link_preview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yungzhu%2Fflutter_link_preview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yungzhu%2Fflutter_link_preview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yungzhu%2Fflutter_link_preview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yungzhu","download_url":"https://codeload.github.com/yungzhu/flutter_link_preview/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238829559,"owners_count":19537720,"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":["dart","flutter","gif","linkpreview"],"created_at":"2024-08-01T12:01:13.330Z","updated_at":"2025-02-17T05:30:52.760Z","avatar_url":"https://github.com/yungzhu.png","language":"Dart","funding_links":[],"categories":["Dart"],"sub_categories":[],"readme":"# flutter_link_preview\n\n这是一个网址预览插件，可以预览网址的内容。\n\n文档语言: [English](README.md) | [中文简体](README-ZH.md)\n\n![Demo](images/web1.png)\n\n## 特色功能\n\n-   采用多进程解析网页，避免阻塞主进程\n-   支持内容缓存及过期机制，能更快地返回结果\n-   更好的容错能力，多种方式查找 icon,title,descriptions,image\n-   更好的支持中文编码，没有乱码\n-   对大文件进行优化，有更好的抓取性能\n-   支持携带 cookies 进行二次跳转验证\n-   支持 gif，视频 等内容抓取\n-   支持自定义渲染\n\n## 开始入门\n\n```dart\nFlutterLinkPreview(\n    url: \"https://github.com\",\n    titleStyle: TextStyle(\n        color: Colors.blue,\n        fontWeight: FontWeight.bold,\n    ),\n)\n```\n\n结果:\n\n![Result Image](images/web2.png)\n\n## 自定义渲染\n\n```dart\nWidget _buildCustomLinkPreview(BuildContext context) {\n  return FlutterLinkPreview(\n    key: ValueKey(\"${_controller.value.text}211\"),\n    url: _controller.value.text,\n    builder: (info) {\n      if (info == null) return const SizedBox();\n      if (info is WebImageInfo) {\n        return CachedNetworkImage(\n          imageUrl: info.image,\n          fit: BoxFit.contain,\n        );\n      }\n\n      final WebInfo webInfo = info;\n      if (!WebAnalyzer.isNotEmpty(webInfo.title)) return const SizedBox();\n      return Container(\n        decoration: BoxDecoration(\n          borderRadius: BorderRadius.circular(10),\n          color: const Color(0xFFF0F1F2),\n        ),\n        padding: const EdgeInsets.all(10),\n        child: Column(\n          crossAxisAlignment: CrossAxisAlignment.start,\n          children: \u003cWidget\u003e[\n            Row(\n              children: \u003cWidget\u003e[\n                CachedNetworkImage(\n                  imageUrl: webInfo.icon ?? \"\",\n                  imageBuilder: (context, imageProvider) {\n                    return Image(\n                      image: imageProvider,\n                      fit: BoxFit.contain,\n                      width: 30,\n                      height: 30,\n                      errorBuilder: (context, error, stackTrace) {\n                        return const Icon(Icons.link);\n                      },\n                    );\n                  },\n                ),\n                const SizedBox(width: 8),\n                Expanded(\n                  child: Text(\n                    webInfo.title,\n                    overflow: TextOverflow.ellipsis,\n                  ),\n                ),\n              ],\n            ),\n            if (WebAnalyzer.isNotEmpty(webInfo.description)) ...[\n              const SizedBox(height: 8),\n              Text(\n                webInfo.description,\n                maxLines: 5,\n                overflow: TextOverflow.ellipsis,\n              ),\n            ],\n            if (WebAnalyzer.isNotEmpty(webInfo.image)) ...[\n              const SizedBox(height: 8),\n              CachedNetworkImage(\n                imageUrl: webInfo.image,\n                fit: BoxFit.contain,\n              ),\n            ]\n          ],\n        ),\n      );\n    },\n  );\n}\n```\n\n![Result Image](images/web3.png)\n\n## 示例代码\n\n[点击这里查看详细示例](example/lib/main.dart).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyungzhu%2Fflutter_link_preview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyungzhu%2Fflutter_link_preview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyungzhu%2Fflutter_link_preview/lists"}