Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tags container decoration and padding #76

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [0.4.9+2] - 2021-03-25.
* `[Updated]` - Add tags container decoration.
* `[Updated]` - Add tags container padding.

## [0.4.9+1] - 2020-11-11.

* `[Fixed]` - Issue #66.
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ Tags(
|`textDirection`|*Text direction of the ItemTags*|TextDirection.ltr|
|`itemBuilder`|*tag generator*||
|`textField`|*add textField*|TagsTextFiled()|
|`containerDecoration`|*add tags container decoration*|null|
|`containerPadding`|*add tags container padding*|null|

### ItemTags() parameters
* `index` - *required*
Expand Down
39 changes: 25 additions & 14 deletions lib/src/tags.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class Tags extends StatefulWidget {
this.textDirection = TextDirection.ltr,
this.itemBuilder,
this.textField,
this.containerDecoration,
this.containerPadding,
Key key})
: assert(itemCount >= 0),
assert(alignment != null),
Expand Down Expand Up @@ -78,6 +80,12 @@ class Tags extends StatefulWidget {
/// custom TextField
final TagsTextField textField;

/// Tags container decoration
final BoxDecoration containerDecoration;

/// Tags container padding
final EdgeInsetsGeometry containerPadding;

@override
TagsState createState() => TagsState();
}
Expand Down Expand Up @@ -128,20 +136,23 @@ class TagsState extends State<Tags> {
),
);
else
child = CustomWrap(
key: _containerKey,
alignment: widget.alignment,
runAlignment: widget.runAlignment,
spacing: widget.spacing,
runSpacing: widget.runSpacing,
column: widget.columns,
symmetry: widget.symmetry,
textDirection: widget.textDirection,
direction: widget.direction,
verticalDirection: widget.verticalDirection,
crossAxisAlignment: WrapCrossAlignment.end,
children: _buildItems(),
);
child = Container(
decoration: widget.containerDecoration,
padding: widget.containerPadding,
child: CustomWrap(
key: _containerKey,
alignment: widget.alignment,
runAlignment: widget.runAlignment,
spacing: widget.spacing,
runSpacing: widget.runSpacing,
column: widget.columns,
symmetry: widget.symmetry,
textDirection: widget.textDirection,
direction: widget.direction,
verticalDirection: widget.verticalDirection,
crossAxisAlignment: WrapCrossAlignment.end,
children: _buildItems(),
));

return DataListInherited(
list: _list,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_tags
description: Creating selectable and input tags (TextField) has never been easier.
version: 0.4.9+1
version: 0.4.9+2
author: Antonino Di Natale <[email protected]>
homepage: https://github.com/Dn-a/flutter_tags

Expand Down