title: flutter bloc: change color on each item when tap
body: <p>I am trying to use flutter bloc so i create this bloc:</p>
  <pre><code>class CategoriesBloc extends Bloc&lt;CategoriesEvent, CategoriesState&gt; {
    CategoriesBloc() : super(CategoriesInitial());
    List&lt;CategoriesItem&gt; _catItems = [
      CategoriesItem(id: 1, title: &quot;Sugar&quot;, prefixIcon: Icons.access_alarms),
      CategoriesItem(id: 2, title: &quot;Calories&quot;, prefixIcon: Icons.access_alarms),
      CategoriesItem(id: 3, title: &quot;Salt&quot;, prefixIcon: Icons.access_alarms),
      CategoriesItem(id: 4, title: &quot;Fibre&quot;, prefixIcon: Icons.access_alarms),
      CategoriesItem(id: 5, title: &quot;Fat&quot;, prefixIcon: Icons.access_alarms)
    ];
  
    List&lt;CategoriesItem&gt; get items =&gt; _catItems;
  
    @override
    Stream&lt;CategoriesState&gt; mapEventToState(
      CategoriesEvent event,
    ) async* {
      if (event is TopCategoriesEvent) {
        yield* _makeCatList(items);
      }
    }
  }
  
  Stream&lt;CategoriesState&gt; _makeCatList(List&lt;CategoriesItem&gt; items) async* {
    yield CategoriesStarted(items);
  }
  
  class CategoriesItem {
    final int id;
    final String title;
    final IconData prefixIcon;
    final IconData suffixIcon;
    bool selected;
  
    CategoriesItem(
        {this.id,
        this.title,
        this.prefixIcon,
        this.suffixIcon,
        this.selected = false});
  }
  </code></pre>
  <p>Now in main page i am using like this:</p>
  <pre><code>Container(
                height: 80,
                color: Colors.green[500],
                child: BlocBuilder&lt;CategoriesBloc, CategoriesState&gt;(
                    builder: (context, state) {
                  if (state is CategoriesInitial) {
                    return Center(
                      child: CircularProgressIndicator(),
                    );
                  } else if (state is CategoriesStarted) {
                    return _makeCatItems(state.catItems);
                  }
                  return Container();
                }),
  </code></pre>
  <p>and this is my _makeCatItems method:</p>
  <pre><code> Widget _makeCatItems(List&lt;CategoriesItem&gt; catItems) {
      print(catItems.length);
      return Container(
        margin: EdgeInsets.only(top: 8.0),
        child: ListView(
          scrollDirection: Axis.horizontal,
          shrinkWrap: true,
          children: catItems
              .map(
                (item) =&gt; Row(
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: &lt;Widget&gt;[
                    InkWell(
                      onTap: () {},
                      child: Container(
                          width: 100,
                          height: 40,
                          alignment: Alignment.center,
                          decoration: BoxDecoration(
                            borderRadius: BorderRadius.circular(8.0),
                            color: Colors.green[300],// change to white when tapped
                          ),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceAround,
                            children: &lt;Widget&gt;[
                              Icon(
                                item.prefixIcon,
                                color: Colors.white,
                              ),
                              Text(
                                item.title,
                                style: TextStyle(color: Colors.white),
                              )
                            ],
                          )),
                    ),
                    SizedBox(
                      width: 16.0,
                    )
                  ],
                ),
              )
              .toList(),
        ),
      );
    }
  </code></pre>
  <p>How could i change background item color when user clicked on each item in bloc way?</p>