{"id":19044314,"url":"https://github.com/ronjb/selectable","last_synced_at":"2025-06-15T10:34:07.681Z","repository":{"id":44330939,"uuid":"407255491","full_name":"ronjb/selectable","owner":"ronjb","description":"A Flutter widget that enables text selection over all the text widgets it contains","archived":false,"fork":false,"pushed_at":"2025-03-10T19:23:25.000Z","size":6921,"stargazers_count":17,"open_issues_count":10,"forks_count":18,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-15T17:57:52.007Z","etag":null,"topics":["flutter","selection","widget"],"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/ronjb.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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-09-16T17:26:26.000Z","updated_at":"2025-03-10T19:22:04.000Z","dependencies_parsed_at":"2025-02-20T01:25:27.938Z","dependency_job_id":"e3d40de5-04c5-4514-a63c-4aa677047abe","html_url":"https://github.com/ronjb/selectable","commit_stats":{"total_commits":37,"total_committers":2,"mean_commits":18.5,"dds":"0.027027027027026973","last_synced_commit":"5a16d8b3393828cbaa23c325f39f15acc716b422"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ronjb/selectable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronjb%2Fselectable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronjb%2Fselectable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronjb%2Fselectable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronjb%2Fselectable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ronjb","download_url":"https://codeload.github.com/ronjb/selectable/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronjb%2Fselectable/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259960484,"owners_count":22938074,"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","selection","widget"],"created_at":"2024-11-08T22:45:45.608Z","updated_at":"2025-06-15T10:34:07.658Z","avatar_url":"https://github.com/ronjb.png","language":"Dart","readme":"# selectable\n\n[![Pub](https://img.shields.io/pub/v/selectable.svg)](https://pub.dev/packages/selectable)\n\nA Flutter widget that enables text selection over all the text widgets it contains.\n\nTry it out at: [https://ronjb.github.io/selectable](https://ronjb.github.io/selectable)\n\n## ⭐️ **IMPORTANT** ⭐️\n\nThis library was written over a year before [`SelectableRegion`](https://api.flutter.dev/flutter/widgets/SelectableRegion-class.html) and related classes were added to Flutter. I will continue to maintain this library because I still use it in a few of my projects, but now that Flutter natively supports selection, I'd recommend using their implementation if it meets your needs.\n\n## Getting Started\n\nAdd this to your app's `pubspec.yaml` file:\n\n```yaml\ndependencies:\n  selectable: ^0.3.1\n```\n\n## Usage\n\nThen in the dart file, import the package with:\n\n```dart\nimport 'package:selectable/selectable.dart';\n```\n\nAnd use `Selectable` where appropriate. For example:\n\n```dart\nScaffold(\n  body: SingleChildScrollView(\n    child: Selectable(\n      child: Column(\n        children: [\n          Text('... a lot of text ...'),\n          // ... more widgets of any type that might contain text ...\n        ],\n      )\n    )\n  )\n)\n```\n\n**Important Note**: As shown in the example above, if a scrollable widget (such as `SingleChildScrollView`, `ListView`, `CustomScrollView`, etc.) is used to wrap the text widgets you want to enable selection for, the `Selectable` widget must be a descendant of the scrollable widget, and an ancestor of the text widgets.\n\n`Selectable` by default supports long-pressing on a word to select it, then using the selection handles to adjust the selection. To also enable double-tapping on a word to select it, pass in `selectWordOnDoubleTap: true` like this:\n\n```dart\nSelectable(\n  selectWordOnDoubleTap: true,\n  child: child,\n)\n```\n\n## Wrap widgets that shouldn't be selectable in `IgnoreSelectable`\n\nFor example:\n\n```dart\nIgnoreSelectable(\n  child: Text(\n    'This text is wrapped in an IgnoreSelectable widget, so it is not selectable.',\n    style: textStyle2,\n  ),\n),\n\n```\n\n## Customizable Popup Selection Menu\n\n`Selectable` provides a default popup selection menu with the menu items Copy, Define, and WebSearch, but it can easily be customized. For example, to continue to show the default Copy menu item, and to add a custom menu item with the title \"Foo! :)\", which shows the selected text in an AlertDialog, do this:\n\n```dart\nSelectable(\n  child: child,\n  popupMenuItems: [\n    SelectableMenuItem(type: SelectableMenuItemType.copy),\n    SelectableMenuItem(\n      title: 'Foo! :)',\n      isEnabled: (controller) =\u003e controller!.isTextSelected;\n      handler: (controller) {\n        showDialog\u003cvoid\u003e(\n          context: context,\n          barrierDismissible: true,\n          builder: (builder) {\n            return AlertDialog(\n              contentPadding: EdgeInsets.zero,\n              content: Container(\n                padding: const EdgeInsets.all(16),\n                child: Text(controller!.getSelection()!.text!),\n              ),\n              shape: RoundedRectangleBorder(\n                  borderRadius: BorderRadius.circular(8)),\n            );\n          },\n        );\n        return true;\n      },\n    ),\n  ],\n)\n```\n\n## Add an Issue for Questions or Problems\n\nLook at the code in the example app included with this package for more usage details and example code, and feel free to add an issue to ask questions or report problems you find while using this package: [https://github.com/ronjb/selectable/issues](https://github.com/ronjb/selectable/issues)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fronjb%2Fselectable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fronjb%2Fselectable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fronjb%2Fselectable/lists"}