{"id":19806646,"url":"https://github.com/timnew/text_field_suffix_button","last_synced_at":"2026-05-16T05:10:44.008Z","repository":{"id":56841213,"uuid":"363949571","full_name":"timnew/text_field_suffix_button","owner":"timnew","description":null,"archived":false,"fork":false,"pushed_at":"2021-05-03T15:01:59.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-11T06:24:19.603Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/timnew.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":"2021-05-03T14:04:25.000Z","updated_at":"2022-11-08T15:56:10.000Z","dependencies_parsed_at":"2022-08-29T12:50:54.304Z","dependency_job_id":null,"html_url":"https://github.com/timnew/text_field_suffix_button","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timnew%2Ftext_field_suffix_button","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timnew%2Ftext_field_suffix_button/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timnew%2Ftext_field_suffix_button/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timnew%2Ftext_field_suffix_button/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timnew","download_url":"https://codeload.github.com/timnew/text_field_suffix_button/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241150393,"owners_count":19918350,"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-11-12T09:08:06.051Z","updated_at":"2026-05-16T05:10:38.956Z","avatar_url":"https://github.com/timnew.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# text_field_suffix_button\n[![Star this Repo](https://img.shields.io/github/stars/timnew/text_field_suffix_button.svg?style=flat-square)](https://github.com/timnew/text_field_suffix_button)\n[![Pub Package](https://img.shields.io/pub/v/text_field_suffix_button.svg?style=flat-square)](https://pub.dev/packages/text_field_suffix_button)\n[![Build Status](https://img.shields.io/github/workflow/status/timnew/text_field_suffix_button/Run-Test)](https://github.com/timnew/text_field_suffix_button/actions?query=workflow%3ARun-Test)\n\nA simple widget that renders the a button as text input's suffix icon, which have a few behaviours:\n\n## Clear Button\n\n```dart\nWidget build(BuildContext context) {\n  final controller = TextEditingController();\n\n  return TextField(\n    decoration: InputDecoration(\n      suffixIcon: TextFieldSuffixButton(controller: controller),\n    ),\n    controller: controller,\n  );\n}\n```\n\nA `TextEditingController` that shared with the field is required to make the button function properly.\nWhen `controller.text` isn't empty, a button with `x` icon is show. When user clicked, it clear the text of the field.\n\n## Paste or Clear\n\n```dart\nWidget build(BuildContext context) {\n  final controller = TextEditingController();\n\n  return TextField(\n    decoration: InputDecoration(\n      suffixIcon: TextFieldSuffixButton(\n        controller: controller,\n        enablePaste: true,\n      ),\n    ),\n    controller: controller,\n  );\n}\n```\n\nWhen `enablePaste` set to `true`, widget render a paste button when text is empty, and a clear button when text is not empty.\nThe paste button allow user to paste the text from clipboard into the text field when clicked.\n\n## Show button only when focused\n\n```dart\nWidget build(BuildContext context) {\n  final controller = TextEditingController();\n  final focusNode = FocusNode();\n\n  return TextField(\n    decoration: InputDecoration(\n      suffixIcon: TextFieldSuffixButton(\n        controller: controller,\n        enablePaste: true,\n        focusNode: focusNode,\n      ),\n    ),\n    controller: controller,\n    focusNode: focusNode,\n  );\n}\n```\n\nAn optional `FocusNode` that shared with the text field can be given. Then the `focusNode` is given, the button hides itself by default, and only shows when the field is focused. It works with both clear button and paste button.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimnew%2Ftext_field_suffix_button","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimnew%2Ftext_field_suffix_button","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimnew%2Ftext_field_suffix_button/lists"}