{"id":15038817,"url":"https://github.com/ponnamkarthik/fluttertoast","last_synced_at":"2025-05-14T11:09:05.549Z","repository":{"id":41472476,"uuid":"128602733","full_name":"ponnamkarthik/FlutterToast","owner":"ponnamkarthik","description":"Toast Plugin for Flutter","archived":false,"fork":false,"pushed_at":"2024-08-20T06:25:14.000Z","size":16973,"stargazers_count":1450,"open_issues_count":91,"forks_count":362,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-10-29T15:10:53.157Z","etag":null,"topics":["android","custom-toast","desktop","flutter","flutter-package","flutter-plugin","fluttertoast","ios","toast","toast-library","web"],"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/ponnamkarthik.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","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,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://www.buymeacoffee.com/karthikponnam"]}},"created_at":"2018-04-08T05:44:20.000Z","updated_at":"2024-10-27T04:49:42.000Z","dependencies_parsed_at":"2024-04-14T03:20:14.688Z","dependency_job_id":"92e2d58f-f540-48ac-8d3c-bb6f452edc80","html_url":"https://github.com/ponnamkarthik/FlutterToast","commit_stats":{"total_commits":256,"total_committers":64,"mean_commits":4.0,"dds":0.4140625,"last_synced_commit":"5852c9292fd97490b556d9e6d73a0ee7c7f8b784"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ponnamkarthik%2FFlutterToast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ponnamkarthik%2FFlutterToast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ponnamkarthik%2FFlutterToast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ponnamkarthik%2FFlutterToast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ponnamkarthik","download_url":"https://codeload.github.com/ponnamkarthik/FlutterToast/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247954328,"owners_count":21024198,"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":["android","custom-toast","desktop","flutter","flutter-package","flutter-plugin","fluttertoast","ios","toast","toast-library","web"],"created_at":"2024-09-24T20:40:19.408Z","updated_at":"2025-04-09T01:23:50.459Z","avatar_url":"https://github.com/ponnamkarthik.png","language":"Dart","funding_links":["https://www.buymeacoffee.com/karthikponnam"],"categories":[],"sub_categories":[],"readme":"# [fluttertoast](https://pub.dev/packages/fluttertoast)\n\nToast Library for Flutter\n\n![Build Checks](https://github.com/ponnamkarthik/FlutterToast/workflows/Build%20Checks/badge.svg)\n\nNow this toast library supports two kinds of toast messages one which requires `BuildContext` other with No `BuildContext`\n\n## Toast with no context\n\n\u003e Supported Platforms\n\u003e\n\u003e - Android\n\u003e - IOS\n\u003e - Web (Uses [Toastify-JS](https://github.com/apvarun/toastify-js))\n\nThis one has limited features and no control over UI\n\n## Toast Which requires BuildContext\n\n\u003e Supported Platforms\n\u003e\n\u003e - ALL\n\n1. Full Control of the Toast\n2. Toasts will be queued\n3. Remove a toast\n4. Clear the queue\n\n## How to Use\n\n```yaml\n# add this line to your dependencies\nfluttertoast: ^8.2.11\n```\n\n```dart\nimport 'package:fluttertoast/fluttertoast.dart';\n```\n\n## Toast with No Build Context (Android \u0026 iOS)\n\n```dart\nFluttertoast.showToast(\n        msg: \"This is Center Short Toast\",\n        toastLength: Toast.LENGTH_SHORT,\n        gravity: ToastGravity.CENTER,\n        timeInSecForIosWeb: 1,\n        backgroundColor: Colors.red,\n        textColor: Colors.white,\n        fontSize: 16.0\n    );\n```\n\n| property           | description                                                                                        | default                                     |\n| ------------------ | -------------------------------------------------------------------------------------------------- | ------------------------------------------- |\n| msg                | String (Not Null)(required)                                                                        | required                                    |\n| toastLength        | Toast.LENGTH_SHORT or Toast.LENGTH_LONG (optional)                                                 | Toast.LENGTH_SHORT                          |\n| gravity            | ToastGravity.TOP (or) ToastGravity.CENTER (or) ToastGravity.BOTTOM (Web Only supports top, bottom) | ToastGravity.BOTTOM                         |\n| timeInSecForIosWeb | int (for ios \u0026 web)                                                                                | 1 (sec)                                     |\n| backgroundColor    | Colors.red                                                                                         | null                                        |\n| textcolor          | Colors.white                                                                                       | null                                        |\n| fontSize           | 16.0 (float)                                                                                       | null                                        |\n| fontAsset          | Path to a font file in the Flutter app assets folder, e.g. 'assets/path/to/some-font.ttf' (String) | null                                        |\n| webShowClose       | false (bool)                                                                                       | false                                       |\n| webBgColor         | String (hex Color)                                                                                 | linear-gradient(to right, #00b09b, #96c93d) |\n| webPosition        | String (`left`, `center` or `right`)                                                               | right                                       |\n\n### To cancel all the toasts call\n\n```dart\nFluttertoast.cancel()\n```\n\n### Note Android\n\n\u003cimg src=\"https://raw.githubusercontent.com/ponnamkarthik/FlutterToast/master/screenshot/toast_deprecated_setview.png\" height=\"200px\" /\u003e\n\n\u003e Custom Toast will not work on android 11 and above, it will only use _msg_ and _toastLength_ remaining all properties are ignored\n\n### Custom Toast For Android\n\nCreate a file named `toast_custom.xml` in your project `app/res/layout` folder and do custom styling\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003cFrameLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"wrap_content\"\n    android:layout_gravity=\"center_horizontal\"\n    android:layout_marginStart=\"50dp\"\n    android:background=\"@drawable/corner\"\n    android:layout_marginEnd=\"50dp\"\u003e\n\n    \u003cTextView\n        android:id=\"@+id/text\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:background=\"#CC000000\"\n        android:paddingStart=\"16dp\"\n        android:paddingTop=\"10dp\"\n        android:paddingEnd=\"16dp\"\n        android:paddingBottom=\"10dp\"\n        android:textStyle=\"bold\"\n        android:textColor=\"#FFFFFF\"\n        tools:text=\"Toast should be short.\" /\u003e\n\u003c/FrameLayout\u003e\n```\n\n## Toast with BuildContext (All Platforms)\n\nUpdate your `MaterialApp` with `builder` like below for the use of Context globally check doc section Use NavigatorKey for Context(to access context globally)\n\n```dart\nMaterialApp(\n    builder: FToastBuilder(),\n    home: MyApp(),\n    navigatorKey: navigatorKey,\n),\n```\n\n```dart\nFToast fToast;\n\n@override\nvoid initState() {\n    super.initState();\n    fToast = FToast();\n    // if you want to use context from globally instead of content we need to pass navigatorKey.currentContext!\n    fToast.init(context);\n}\n\n_showToast() {\n    Widget toast = Container(\n        padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),\n        decoration: BoxDecoration(\n        borderRadius: BorderRadius.circular(25.0),\n        color: Colors.greenAccent,\n        ),\n        child: Row(\n        mainAxisSize: MainAxisSize.min,\n        children: [\n            Icon(Icons.check),\n            SizedBox(\n            width: 12.0,\n            ),\n            Text(\"This is a Custom Toast\"),\n        ],\n        ),\n    );\n\n\n    fToast.showToast(\n        child: toast,\n        gravity: ToastGravity.BOTTOM,\n        toastDuration: Duration(seconds: 2),\n    );\n\n    // Custom Toast Position\n    fToast.showToast(\n        child: toast,\n        toastDuration: Duration(seconds: 2),\n        positionedToastBuilder: (context, child) {\n          return Positioned(\n            child: child,\n            top: 16.0,\n            left: 16.0,\n          );\n        });\n}\n\n```\n\nNow Call `_showToast()`\n\nFor more details check `example` project\n\n| property               | description                 | default                     |\n| ---------------------- | --------------------------- | --------------------------- |\n| child                  | Widget (Not Null)(required) | required                    |\n| toastDuration          | Duration (optional)         |                             |\n| gravity                | ToastGravity.\\*             |                             |\n| positionedToastBuilder | PositionedToastBuilder      |                             |\n| fadeDuration           | Duration                    | Duration(milliseconds: 350) |\n| ignorePointer          | boolean                     | false                       |\n| isDismissible          | boolean                     | false                       |\n\n### Use NavigatorKey for Context(to access context globally)\n\nTo use NavigatorKey for Context first define the `GlobalKey\u003cNavigatorState\u003e` at top level in your `main.dart` file\n\n```dart\nGlobalKey\u003cNavigatorState\u003e navigatorKey = GlobalKey\u003cNavigatorState\u003e();\n```\n\nAt the time of initializing the `FToast` we need to use context from globally defined `GlobalKey\u003cNavigatorState\u003e`\n\n```dart\nFToast fToast = FToast();\nfToast.init(yourNavKey.currentContext!);\n```\n\n### To cancel all the toasts call\n\n```dart\n// To remove present shwoing toast\nfToast.removeCustomToast()\n\n// To clear the queue\nfToast.removeQueuedCustomToasts();\n```\n\n## Preview Images (No BuildContext)\n\n\u003cimg src=\"https://raw.githubusercontent.com/ponnamkarthik/FlutterToast/master/screenshot/1.png\" width=\"320px\" /\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/ponnamkarthik/FlutterToast/master/screenshot/2.png\" width=\"320px\" /\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/ponnamkarthik/FlutterToast/master/screenshot/3.png\" width=\"320px\" /\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/ponnamkarthik/FlutterToast/master/screenshot/4.png\" width=\"320px\" /\u003e\n\n## Preview Images (BuildContext)\n\n\u003cimg src=\"https://raw.githubusercontent.com/ponnamkarthik/FlutterToast/master/screenshot/11.jpg\" width=\"320px\" /\u003e\n\n## If you need any features suggest\n\n...\n\n## Buy Me a Coffee\n\n\u003ca href=\"https://www.buymeacoffee.com/karthikponnam\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/default-orange.png\" alt=\"Buy Me A Coffee\" height=\"41\" width=\"174\"\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fponnamkarthik%2Ffluttertoast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fponnamkarthik%2Ffluttertoast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fponnamkarthik%2Ffluttertoast/lists"}