{"id":13465549,"url":"https://github.com/jaweii/Flutter_beautiful_popup","last_synced_at":"2025-03-25T16:32:30.731Z","repository":{"id":39521648,"uuid":"226038001","full_name":"jaweii/Flutter_beautiful_popup","owner":"jaweii","description":"A flutter package help you beautify your app popups. ","archived":false,"fork":false,"pushed_at":"2022-10-13T09:25:37.000Z","size":22127,"stargazers_count":674,"open_issues_count":6,"forks_count":90,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-07-31T15:01:34.241Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://jaweii.github.io/Flutter_beautiful_popup/example/build/web/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaweii.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}},"created_at":"2019-12-05T07:04:14.000Z","updated_at":"2024-07-31T08:08:07.000Z","dependencies_parsed_at":"2022-07-12T19:30:46.405Z","dependency_job_id":null,"html_url":"https://github.com/jaweii/Flutter_beautiful_popup","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaweii%2FFlutter_beautiful_popup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaweii%2FFlutter_beautiful_popup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaweii%2FFlutter_beautiful_popup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaweii%2FFlutter_beautiful_popup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaweii","download_url":"https://codeload.github.com/jaweii/Flutter_beautiful_popup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222088578,"owners_count":16928981,"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":[],"created_at":"2024-07-31T15:00:31.792Z","updated_at":"2025-03-25T16:32:30.717Z","avatar_url":"https://github.com/jaweii.png","language":"JavaScript","funding_links":[],"categories":["Components","JavaScript","组件","UI [🔝](#readme)","Uncategorized"],"sub_categories":["UI","Uncategorized"],"readme":"# flutter_beautiful_popup [中文](https://github.com/jaweii/Flutter_beautiful_popup/blob/master/README_CN.md)\n\nA flutter package to help you beautify your app popup, can be used in all platform.[Live Demo](https://jaweii.github.io/Flutter_beautiful_popup/example/build/web/#/).\n\n## Preview:\n\n\u003cimg src=\"https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/master/example/images/show.gif\" style=\"max-height: 600px;\"\u003e\n\n## Getting Started\n\nAdd dependency to you `pubspec.yaml`:\n\n```\ndependencies:\n    flutter_beautiful_popup: ^1.7.0\n```\n\nImport the dependency:\n\n```\nimport 'package:flutter_beautiful_popup/main.dart';\n```\n\nAnd then you can display a popup with certain template like this:\n\n```\nfinal popup = BeautifulPopup(\n  context: context,\n  template: TemplateGift,\n);\npopup.show(\n  title: 'String or Widget',\n  content: 'String or Widget',\n  actions: [\n    popup.button(\n      label: 'Close',\n      onPressed: Navigator.of(context).pop,\n    ),\n  ],\n  // bool barrierDismissible = false,\n  // Widget close,\n);\n```\n\nIf you wan to `recolor` the illustration of the template, you can call the `recolor` method, but this function takes a little time to caculate/offset the color cahnnel of the illustration:\n\n```\nfinal newColor = Colors.red.withOpacity(0.5);\nawait popup.recolor(newColor);\n```\n\nAll available templates you can find in [Live Demo](https://jaweii.github.io/Flutter_beautiful_popup/example/build/web/#/).\n\n## Customize your own BeautifulPopupTemplate\n\nYou can extend `BeautifulPopupTemplate` to customize your own template like this:\n\n```\nimport 'package:flutter/material.dart';\nimport 'package:flutter_beautiful_popup/main.dart';\n\nclass MyTemplate extends BeautifulPopupTemplate {\n  final BeautifulPopup options;\n  MyTemplate(this.options) : super(options);\n\n  @override\n  final illustrationKey = 'images/mytemplate.png';\n  @override\n  Color get primaryColor =\u003e options.primaryColor ?? Color(0xff000000); // The default primary color of the template is Colors.black.\n  @override\n  final maxWidth = 400; // In most situations, the value is the illustration size.\n  @override\n  final maxHeight = 600;\n  @override\n  final bodyMargin = 10;\n\n  // You need to adjust the layout to fit into your illustration.\n  @override\n  get layout {\n    return [\n      Positioned(\n        child: background,\n      ),\n      Positioned(\n        top: percentH(10),\n        child: title,\n      ),\n      Positioned(\n        top: percentH(40),\n        height: percentH(actions == null ? 32 : 42),\n        left: percentW(10),\n        right: percentW(10),\n        child: content,\n      ),\n      Positioned(\n        bottom: percentW(10),\n        left: percentW(10),\n        right: percentW(10),\n        child: actions ?? Container(),\n      ),\n    ];\n  }\n}\n```\n\nTo display a popup with your own template:\n\n```\nfinal popup = BeautifulPopup.customize(\n  context: context,\n  build: (options) =\u003e MyTemplate(options),\n);\npopup.show(\n  title: 'Example',\n  content: Container(\n    color: Colors.black12,\n    child: Text(\n        'This popup shows you how to customize your own BeautifulPopupTemplate.'),\n  ),\n  actions: [\n    popup.button(\n      label: 'Code',\n      onPressed: () {\n        js.context.callMethod('open', [\n          'https://github.com/jaweii/Flutter_beautiful_popup/blob/master/example/lib/MyTemplate.dart'\n        ]);\n      },\n    ),\n  ],\n);\n```\n\n## Contributor\n\n\u003ca href=\"https://github.com/jaweii/Flutter_beautiful_popup/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=jaweii/Flutter_beautiful_popup\" /\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaweii%2FFlutter_beautiful_popup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaweii%2FFlutter_beautiful_popup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaweii%2FFlutter_beautiful_popup/lists"}