From b54f225ec95eaedff6af6388988a23097d05d1bd Mon Sep 17 00:00:00 2001 From: Jakub Mirota Date: Fri, 12 Jul 2019 11:01:37 +0200 Subject: [PATCH 1/2] Introduces inactive tag selection flag Introduces inactive tag selection flag. --- lib/selectable_tags.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/selectable_tags.dart b/lib/selectable_tags.dart index c926b84..4cfb78d 100644 --- a/lib/selectable_tags.dart +++ b/lib/selectable_tags.dart @@ -33,6 +33,7 @@ class SelectableTags extends StatefulWidget { this.onPressed, this.popupMenuBuilder, this.popupMenuOnSelected, + this.inactiveTagSelectable = true, Key key}) : assert(tags != null), super(key: key); @@ -108,6 +109,9 @@ class SelectableTags extends StatefulWidget { /// (int id, Tag tag) final PopupMenuOnSelected popupMenuOnSelected; + /// Defines if only active tags can be selected + final bool inactiveTagSelectable; + @override _SelectableTagsState createState() => _SelectableTagsState(); } @@ -315,7 +319,7 @@ class _SelectableTagsState extends State { softWrap: false, style: _textStyle(tag), ), - onPressed: () { + onPressed: (!widget.inactiveTagSelectable && tag.active == false) ? null : () { if (widget.singleItem) _singleItem(); setState(() { From 09dbea0abf99b5fcbd2528facdbde57292d0b4da Mon Sep 17 00:00:00 2001 From: Jakub Mirota Date: Fri, 12 Jul 2019 11:01:52 +0200 Subject: [PATCH 2/2] Fixes code issues --- lib/selectable_tags.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/selectable_tags.dart b/lib/selectable_tags.dart index 4cfb78d..cba8083 100644 --- a/lib/selectable_tags.dart +++ b/lib/selectable_tags.dart @@ -33,7 +33,7 @@ class SelectableTags extends StatefulWidget { this.onPressed, this.popupMenuBuilder, this.popupMenuOnSelected, - this.inactiveTagSelectable = true, + this.inactiveTagSelectable = true, Key key}) : assert(tags != null), super(key: key); @@ -109,7 +109,7 @@ class SelectableTags extends StatefulWidget { /// (int id, Tag tag) final PopupMenuOnSelected popupMenuOnSelected; - /// Defines if only active tags can be selected + /// Defines if inactive tags can be selected final bool inactiveTagSelectable; @override