flutter_tags icon indicating copy to clipboard operation
flutter_tags copied to clipboard

Add support for null-safety

Open ripetrescu opened this issue 4 years ago • 2 comments

ripetrescu avatar May 20 '21 08:05 ripetrescu

I've been waiting for ages. You're probably better off creating it yourself like this:

...
Wrap(
   children: widget.list.asMap().map(
      (index, ingredient) => MapEntry(index, _buildChip(index, ingredient))
    ).values.toList(),
    spacing: 6,
    runSpacing: 3,
),
...

Widget _buildChip(int index, String ingredient){
    return Chip(
      label: Text(ingredient, style: regularTextStyle.copyWith(color: Colors.white)),
      backgroundColor: themeOrangeColor,
      deleteIcon: Icon(FontAwesomeIcons.timesCircle, size: 20),
      labelPadding: EdgeInsets.fromLTRB(5,2,1,2),
      elevation: 5,
      onDeleted: (){
        setState(() {
          widget.list.removeAt(index);
        });
      },
    );
  }

This way you don't need to import any packages and it's not that many lines of code.

SeriousMonk avatar Jul 09 '21 21:07 SeriousMonk

Yep, delete the framework and implement it by yourself.

app-arianamini avatar Jan 28 '23 22:01 app-arianamini