{"id":13551514,"url":"https://github.com/davigmacode/flutter_chips_choice","last_synced_at":"2025-04-03T02:11:53.964Z","repository":{"id":45950717,"uuid":"234231595","full_name":"davigmacode/flutter_chips_choice","owner":"davigmacode","description":"Lite version of smart_select package, zero dependencies, an easy way to provide a single or multiple choice chips.","archived":false,"fork":false,"pushed_at":"2023-09-13T06:04:13.000Z","size":57870,"stargazers_count":114,"open_issues_count":3,"forks_count":41,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T08:12:05.393Z","etag":null,"topics":["chips","choice","choices","flutter","package"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/chips_choice","language":"Dart","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/davigmacode.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}},"created_at":"2020-01-16T04:00:57.000Z","updated_at":"2025-01-13T15:42:24.000Z","dependencies_parsed_at":"2022-09-20T22:54:42.944Z","dependency_job_id":"83e472e5-a1e6-4dd8-a12c-630a301e8fb9","html_url":"https://github.com/davigmacode/flutter_chips_choice","commit_stats":{"total_commits":62,"total_committers":3,"mean_commits":"20.666666666666668","dds":"0.032258064516129004","last_synced_commit":"49db19d07127b0be29e354e76535df176ce7bf4a"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davigmacode%2Fflutter_chips_choice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davigmacode%2Fflutter_chips_choice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davigmacode%2Fflutter_chips_choice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davigmacode%2Fflutter_chips_choice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davigmacode","download_url":"https://codeload.github.com/davigmacode/flutter_chips_choice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246922248,"owners_count":20855345,"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":["chips","choice","choices","flutter","package"],"created_at":"2024-08-01T12:01:49.695Z","updated_at":"2025-04-03T02:11:53.940Z","avatar_url":"https://github.com/davigmacode.png","language":"Dart","funding_links":["https://www.buymeacoffee.com/davigmacode"],"categories":["Dart"],"sub_categories":[],"readme":"![Pub Version](https://img.shields.io/pub/v/chips_choice) ![GitHub](https://img.shields.io/github/license/davigmacode/flutter_chips_choice)\n\n\u003ca href=\"https://www.buymeacoffee.com/davigmacode\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" width=\"195\" height=\"55\"\u003e\u003c/a\u003e\n\n\u003e [!IMPORTANT]\n\u003e\n\u003e Hi everyone,\n\u003e\n\u003e I'm sorry to announce that I'm no longer maintaining the [chips_choice](https://pub.dev/packages/chips_choice) package. It's been a great project, but it's become too difficult to maintain.\n\u003e\n\u003e In its place, I've released a new package called [choice](https://pub.dev/packages/choice). The combination to [smart_select](https://pub.dev/packages/smart_select) and [chips_choice](https://pub.dev/packages/chips_choice) with cleaner, more flexible, and composable API for creating inline or prompted choice widgets with single or multiple selection.\n\u003e\n\u003e I hope you'll check out [choice](https://pub.dev/packages/choice). I think you'll find it to be a great replacement for [chips_choice](https://pub.dev/packages/chips_choice).\n\u003e\n\u003e Thanks for your understanding.\n\nLite version of [smart_select](https://pub.dev/packages/smart_select) package, zero dependencies, an easy way to provide a single or multiple choice chips.\n\n## What's New in Version 3.x.x\n\n* Changed default chip to [flexi_chip](https://pub.dev/packages/flexi_chip)\n* C2Chip is alias to `FlexiChip` now\n* C2ChoiceStyle changed to C2ChipStyle and alias to `FlexiChipStyle`\n* Removed `ChipsChoice.choiceActiveStyle` and `C2Choice.activeStyle` since the C2ChipStyle can be an event driven properties\n* Removed `C2ChoiceStyle.useCheckmark`, changed to `ChipsChoice.choiceCheckmark`\n* Removed `ChipsChoice.choiceAvatarBuilder`\n* Added `ChipsChoice.choiceLeadingBuilder`\n* Added `ChipsChoice.choiceTrailingBuilder`\n* Added `C2Choice.delete`\n* Added `C2Choice.avatarImage`\n* Added `C2Choice.avatarText`\n* Fixed issue #26, add leading and trailing widget\n* Improved performance\n* More flexibility on styling\n\n## Demo\n\n### Preview\n\n[![Preview](https://github.com/davigmacode/flutter_chips_choice/raw/master/media/preview.gif)](https://davigmacode.github.io/flutter_chips_choice)\n\n[Demo](https://davigmacode.github.io/flutter_chips_choice)\n\n\n## Features\n\n* Select single or multiple choice\n* Display in scrollable or wrapped list\n* Build choice items from any `List`\n* Customizable choice widget\n\n## Usage\n\nFor a complete usage, please see the [example](https://pub.dev/packages/chips_choice#-example-tab-).\n\nTo read more about classes and other references used by `chips_choice`, see the [API Reference](https://pub.dev/documentation/chips_choice/latest/).\n\n### Single Choice\n\n```dart\n// available configuration for single choice\nChipsChoice\u003cT\u003e.single({\n\n  // The current value of the single choice widget.\n  @required T value,\n\n  // Called when single choice value changed\n  @required C2Changed\u003cT\u003e onChanged,\n\n  // choice item list\n  @required List\u003cC2Choice\u003cT\u003e\u003e choiceItems,\n\n  // Async loader of choice items\n  C2ChoiceLoader\u003cT\u003e choiceLoader,\n\n  // other available configuration\n  // explained below\n  ...,\n  ...,\n\n})\n```\nSimple usage\n```dart\nint tag = 1;\nList\u003cString\u003e options = [\n  'News', 'Entertainment', 'Politics',\n  'Automotive', 'Sports', 'Education',\n  'Fashion', 'Travel', 'Food', 'Tech',\n  'Science',\n];\n\n@override\nWidget build(BuildContext context) {\n  return ChipsChoice\u003cint\u003e.single(\n    value: tag,\n    onChanged: (val) =\u003e setState(() =\u003e tag = val),\n    choiceItems: C2Choice.listFrom\u003cint, String\u003e(\n      source: options,\n      value: (i, v) =\u003e i,\n      label: (i, v) =\u003e v,\n    ),\n  );\n}\n```\n\n### Multiple Choice\n```dart\n// available configuration for multiple choice\nChipsChoice\u003cT\u003e.multiple({\n\n  // The current value of the multiple choice widget.\n  @required List\u003cT\u003e value,\n\n  // Called when multiple choice value changed\n  @required C2Changed\u003cList\u003cT\u003e\u003e onChanged,\n\n  // choice item list\n  @required List\u003cC2Choice\u003cT\u003e\u003e choiceItems,\n\n  // Async loader of choice items\n  C2ChoiceLoader\u003cT\u003e choiceLoader,\n\n  // other available configuration\n  // explained below\n  ...,\n  ...,\n\n})\n```\nSimple usage\n```dart\nList\u003cString\u003e tags = [];\nList\u003cString\u003e options = [\n  'News', 'Entertainment', 'Politics',\n  'Automotive', 'Sports', 'Education',\n  'Fashion', 'Travel', 'Food', 'Tech',\n  'Science',\n];\n\n@override\nWidget build(BuildContext context) {\n  return ChipsChoice\u003cString\u003e.multiple(\n    value: tags,\n    onChanged: (val) =\u003e setState(() =\u003e tags = val),\n    choiceItems: C2Choice.listFrom\u003cString, String\u003e(\n      source: options,\n      value: (i, v) =\u003e v,\n      label: (i, v) =\u003e v,\n    ),\n  );\n}\n```\n\n### Style Configuration\n\nSee the [API References](https://pub.dev/documentation/flexi_chip/latest/flexi_chip/FlexiChipStyle-class.html), to find out all  of the parameters.\n\n```dart\n// available configuration for single and multiple choice\nChipsChoice\u003cT\u003e.[single|multiple]({\n\n  // other available configuration\n  // explained below\n  ...,\n  ...,\n\n  // Choice item style\n  C2ChipStyle choiceStyle,\n\n  // other available configuration\n  // explained below\n  ...,\n  ...,\n\n})\n```\n\n### Custom Builder\n\n```dart\n// available configuration for single and multiple choice\nChipsChoice\u003cT\u003e.[single|multiple]({\n\n  // other available configuration\n  // explained below\n  ...,\n  ...,\n\n  // Builder for custom choice item label\n  C2Builder\u003cT\u003e choiceLabelBuilder,\n\n  // Builder for custom widget to display prior to the chip's [label].\n  C2Builder\u003cT\u003e? choiceLeadingBuilder;\n\n  // Builder for custom widget to display next to the chip's [label].\n  C2Builder\u003cT\u003e? choiceTrailingBuilder;\n\n  // Builder for custom choice item\n  C2Builder\u003cT\u003e choiceBuilder,\n\n  // Builder for spinner widget\n  WidgetBuilder spinnerBuilder,\n\n  // Builder for placeholder widget\n  WidgetBuilder placeholderBuilder,\n\n  // Builder for error widget\n  WidgetBuilder errorBuilder,\n\n  // other available configuration\n  // explained below\n  ...,\n  ...,\n\n})\n```\n\n### Container Configuration\n\n```dart\n// available configuration for single and multiple choice\nChipsChoice\u003cT\u003e.[single|multiple]({\n\n  // other available configuration\n  // explained below\n  ...,\n  ...,\n\n  // Whether the chips is wrapped or scrollable\n  bool wrapped,\n\n  // Container padding\n  EdgeInsetsGeometry padding,\n\n  // The direction to use as the main axis.\n  Axis direction,\n\n  // Determines the order to lay children out vertically and how to interpret start and end in the vertical direction.\n  VerticalDirection verticalDirection,\n\n  // Determines the order to lay children out horizontally and how to interpret start and end in the horizontal direction.\n  TextDirection textDirection,\n\n  // if [wrapped] is [false], How the scroll view should respond to user input.\n  ScrollPhysics scrollPhysics,\n\n  // if [wrapped] is [false], How much space should be occupied in the main axis.\n  MainAxisSize mainAxisSize,\n\n  // if [wrapped] is [false], How the children should be placed along the main axis.\n  MainAxisAlignment mainAxisAlignment,\n\n  // if [wrapped] is [false], How the children should be placed along the cross axis.\n  CrossAxisAlignment crossAxisAlignment,\n\n  // if [wrapped] is [true], how the children within a run should be aligned relative to each other in the cross axis.\n  WrapCrossAlignment wrapCrossAlignment,\n\n  // if [wrapped] is [true], determines how wrap will align the objects\n  WrapAlignment alignment,\n\n  // if [wrapped] is [true], how the runs themselves should be placed in the cross axis.\n  WrapAlignment runAlignment,\n\n  // if [wrapped] is [true], how much space to place between children in a run in the main axis.\n  double spacing,\n\n  // if [wrapped] is [true], how much space to place between the runs themselves in the cross axis.\n  double runSpacing,\n\n  // Clip behavior\n  Clip clipBehavior,\n\n  // String to display when choice items is empty\n  String placeholder,\n\n  // placeholder text style\n  TextStyle placeholderStyle,\n\n  // placeholder text align\n  TextAlign placeholderAlign,\n\n  // error text style\n  TextStyle errorStyle,\n\n  // error text align\n  TextAlign errorAlign,\n\n  // spinner size\n  double spinnerSize,\n\n  // spinner color\n  Color spinnerColor,\n\n  // spinner thickness\n  double spinnerThickness,\n\n  // other available configuration\n  // explained below\n  ...,\n  ...,\n\n})\n```\n\n### Build Choice List\n\n`choiceItems` property is `List\u003cC2Choice\u003cT\u003e\u003e`, it can be input directly as in the example below, more info about `C2Choice` can be found on the [API Reference](https://pub.dev/documentation/chips_choice/latest/chips_choice/C2Choice-class.html)\n\n```dart\nChipsChoice\u003cT\u003e.[single|multiple](\n  ...,\n  ...,\n  choiceItems: \u003cC2Choice\u003cT\u003e\u003e[\n    C2Choice\u003cT\u003e(value: 1, label: 'Entertainment'),\n    C2Choice\u003cT\u003e(value: 2, label: 'Education'),\n    C2Choice\u003cT\u003e(value: 3, label: 'Fashion'),\n  ],\n);\n```\n\n`choiceItems` also can be created from any list using helper provided by this package, like the example below\n\n```dart\nList\u003cMap\u003cString, String\u003e\u003e days = [\n  { 'value': 'mon', 'title': 'Monday' },\n  { 'value': 'tue', 'title': 'Tuesday' },\n  { 'value': 'wed', 'title': 'Wednesday' },\n  { 'value': 'thu', 'title': 'Thursday' },\n  { 'value': 'fri', 'title': 'Friday' },\n  { 'value': 'sat', 'title': 'Saturday' },\n  { 'value': 'sun', 'title': 'Sunday' },\n];\n\nChipsChoice\u003cT\u003e.[single|multiple](\n  ...,\n  ...,\n  choiceItems: C2Choice.listFrom\u003cT, Map\u003cString, String\u003e\u003e(\n    source: days,\n    value: (index, item) =\u003e item['value'],\n    label: (index, item) =\u003e item['title'],\n  ),\n);\n```\nUse `choiceLoader` to easily load choice items from async function\n```dart\nimport 'package:dio/dio.dart';\n\nString value;\n\nFuture\u003cList\u003cC2Choice\u003cString\u003e\u003e\u003e getChoices() async {\n  String url = \"https://randomuser.me/api/?inc=gender,name,nat,picture,email\u0026results=25\";\n  Response res = await Dio().get(url);\n  return C2Choice.listFrom\u003cString, dynamic\u003e(\n    source: res.data['results'],\n    value: (index, item) =\u003e item['email'],\n    label: (index, item) =\u003e item['name']['first'] + ' ' + item['name']['last'],\n    meta: (index, item) =\u003e item,\n  )..insert(0, C2Choice\u003cString\u003e(value: 'all', label: 'All'));\n}\n\n@override\nWidget build(BuildContext context) {\n  return ChipsChoice\u003cString\u003e.single(\n    value: value,\n    onChanged: (val) =\u003e setState(() =\u003e value = val),\n    choiceItems: null,\n    choiceLoader: getChoices,\n  );\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavigmacode%2Fflutter_chips_choice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavigmacode%2Fflutter_chips_choice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavigmacode%2Fflutter_chips_choice/lists"}