{"id":13465560,"url":"https://github.com/Dn-a/flutter_tags","last_synced_at":"2025-03-25T16:32:43.132Z","repository":{"id":33719030,"uuid":"160939181","full_name":"Dn-a/flutter_tags","owner":"Dn-a","description":"With flutter tags you can create selectable or input tags that automatically adapt to the screen width","archived":false,"fork":false,"pushed_at":"2022-07-26T10:33:56.000Z","size":101289,"stargazers_count":506,"open_issues_count":39,"forks_count":126,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-07-31T15:01:36.496Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pub.dartlang.org/packages/flutter_tags","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/Dn-a.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":"2018-12-08T12:54:00.000Z","updated_at":"2024-07-31T08:07:22.000Z","dependencies_parsed_at":"2022-07-14T08:08:48.381Z","dependency_job_id":null,"html_url":"https://github.com/Dn-a/flutter_tags","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dn-a%2Fflutter_tags","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dn-a%2Fflutter_tags/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dn-a%2Fflutter_tags/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dn-a%2Fflutter_tags/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dn-a","download_url":"https://codeload.github.com/Dn-a/flutter_tags/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222088591,"owners_count":16928984,"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.923Z","updated_at":"2025-03-25T16:32:43.124Z","avatar_url":"https://github.com/Dn-a.png","language":"Dart","readme":"# flutter_tags\n[![pub package](https://img.shields.io/badge/pub-0.4.9+1-orange.svg)](https://pub.dartlang.org/packages/flutter_tags)\n[![Awesome Flutter](https://img.shields.io/badge/Awesome-Flutter-blue.svg?longCache=true\u0026style=flat-square)](https://github.com/Solido/awesome-flutter#ui)\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/dnag88)\n\nCreate beautiful tags quickly and easily.\n\n## Installing\nAdd this to your package's pubspec.yaml file:\n```dart\ndependencies:\n  flutter_tags: \"^0.4.9+1\"\n```\n\n\n## DEMO\n\n\u003cdiv align=\"center\"\u003e\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd style=\"text-align:center\"\u003e\n \u003cimg width = \"250px\" src=\"https://github.com/Dn-a/flutter_tags/raw/master/repo-file/img/example0.4.0_1.gif\" /\u003e\n \u003c/td\u003e\n \u003ctd style=\"text-align:center\"\u003e\n  \u003cimg width = \"250px\" src=\"https://github.com/Dn-a/flutter_tags/raw/master/repo-file/img/example0.4.0_2.gif\" /\u003e\n  \u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\n\n## Simple usage\n```dart\n\nimport 'package:flutter_tags/flutter_tags.dart';\n.\n.\n.\nList _items;\ndouble _fontSize = 14;\n\n@override\nvoid initState(){\n    super.initState();\n    // if you store data on a local database (sqflite), then you could do something like this\n    Model().getItems().then((items){\n            _items = items;\n        });\n}\n\n@override\nWidget build(BuildContext context) {\n    return Tags(\n      key:_tagStateKey,\n      textField: TagsTextField(\n        textStyle: TextStyle(fontSize: _fontSize),\n        constraintSuggestion: true, suggestions: [],\n        //width: double.infinity, padding: EdgeInsets.symmetric(horizontal: 10),\n        onSubmitted: (String str) {\n          // Add item to the data source.\n          setState(() {\n              // required\n            _items.add(str);\n          });\n        },\n      ),\n      itemCount: _items.length, // required\n      itemBuilder: (int index){          \n            final item = _items[index];\n    \n            return ItemTags(\n                  // Each ItemTags must contain a Key. Keys allow Flutter to\n                  // uniquely identify widgets.\n                  key: Key(index.toString()),\n                  index: index, // required\n                  title: item.title,\n                  active: item.active,\n                  customData: item.customData,\n                  textStyle: TextStyle( fontSize: _fontSize, ),\n                  combine: ItemTagsCombine.withTextBefore,\n                  image: ItemTagsImage(\n                    image: AssetImage(\"img.jpg\") // OR NetworkImage(\"https://...image.png\")\n                  ), // OR null,\n                  icon: ItemTagsIcon(\n                    icon: Icons.add,\n                  ), // OR null,\n                  removeButton: ItemTagsRemoveButton(\n                    onRemoved: (){\n                        // Remove the item from the data source.\n                        setState(() {\n                            // required\n                            _items.removeAt(index);\n                        });\n                        //required\n                        return true;\n                    },\n                  ), // OR null,\n                  onPressed: (item) =\u003e print(item),\n                  onLongPressed: (item) =\u003e print(item),\n            );\n    \n      },\n    );    \n}\n\nfinal GlobalKey\u003cTagsState\u003e _tagStateKey = GlobalKey\u003cTagsState\u003e();\n// Allows you to get a list of all the ItemTags\n_getAllItem(){\n    List\u003cItem\u003e lst = _tagStateKey.currentState?.getAllItem;\n    if(lst!=null)\n        lst.where((a) =\u003e a.active==true).forEach( ( a) =\u003e print(a.title));        \n}\n```\n## Wrapped widget example\nYou are free to wrap ItemTags () inside another widget\n```dart\nTags(  \n      itemCount: items.length, \n      itemBuilder: (int index){ \n          return Tooltip(\n          message: item.title,\n          child:ItemTags(\n            title:item.title,\n          )\n          );\n      },\n    );    \n```\n### Tags() parameters\n|PropName|Description|default value|\n|:-------|:----------|:------------|\n|`columns`|*Possibility to set number of columns when necessary*|null|\n|`itemCount`|*Tag number to display*|required|\n|`symmetry`|*Ability to view and scroll tags horizontally*|false|\n|`horizontalScroll`|*Offset drawer width*|0.4|\n|`heightHorizontalScroll`|*height for HorizontalScroll to set to display tags correctly*|60|\n|`spacing`|*Horizontal space between the tags*|6|\n|`runSpacing`|*Vertical space between the tags*|14|\n|`alignment`|*Horizontal WrapAlignment*|WrapAlignment.center|\n|`runAlignment`|*Vertical WrapAlignment*|WrapAlignment.center|\n|`direction`|*Direction of the ItemTags*|Axis.horizontal|\n|`verticalDirection`|*Iterate Item from the lower to the upper direction or vice versa*|VerticalDirection.down|\n|`textDirection`|*Text direction of  the ItemTags*|TextDirection.ltr|\n|`itemBuilder`|*tag generator*||\n|`textField`|*add textField*|TagsTextFiled()|\n\n### ItemTags() parameters\n* `index` - *required*\n* `title` - *required*\n* `textScaleFactor` - *custom textScaleFactor*\n* `active` - *bool value (default true)*\n* `pressEnabled` - *active onPress tag ( default true)*\n* `customData` - *Possibility to add any custom value in customData field, you can retrieve this later. A good example: store an id from Firestore document.*\n* `textStyle` - *textStyle()*\n* `alignment` - *MainAxisAlignment ( default MainAxisAlignment.center)*\n* `combine` - * ability to combine text, icons, images in different ways ( default  ItemTagsCombine.imageOrIconOrText)*\n* `icon` - *ItemTagsIcon()*\n* `image` - *ItemTagsImage()*\n* `removeButton` - *ItemTagsRemoveButton()*\n* `borderRadius` - *BorderRadius*\n* `border` - *custom border-side*\n* `padding` - *default EdgeInsets.symmetric(horizontal: 7, vertical: 5)*\n* `elevation` - *default 5*\n* `singleItem` - *default false*\n* `textOverflow` - *default TextOverflow.fade*\n* `textColor` - *default Colors.black*\n* `textActiveColor` - *default  Colors.white*\n* `color` - *default Colors.white*\n* `activeColor` - *default Colors.blueGrey*\n* `highlightColor` - \n* `splashColor` - \n* `colorShowDuplicate` - *default  Colors.red*\n* `onPressed` - *callback*\n* `onLongPressed` - *callback*\n* `onRemoved` - *callback*\n\n\n## Donate\nIt takes time to carry on this project. If you found it useful or learned something from the source code please consider the idea of donating 5, 20, 50 € or whatever you can to support the project.\n- [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/dnag88)\n\n## Issues\nIf you encounter problems, open an issue. Pull request are also welcome.\n","funding_links":["https://www.paypal.me/dnag88"],"categories":["Components","Dart","组件","UI [🔝](#readme)","Packages"],"sub_categories":["UI"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDn-a%2Fflutter_tags","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDn-a%2Fflutter_tags","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDn-a%2Fflutter_tags/lists"}