title: Flutter - return onTap from custom widget and perform animation
body: <p>I have a custom Widget named RowItem that is a statefull widget. When a user click the widget it animates. However I also want to return the onTap event to the parent widget, but I don't know how to do that...</p>
  
  <p>This is my RowItem widget:</p>
  
  <pre><code>class _RowItemState extends State&lt;RowItem&gt; {
    bool isSelected = false;
    double underlineWith = 0;
  
    @override
    Widget build(context) {
      // Pass the text down to another widget
      return new GestureDetector(
        onTap: () {
          isSelected = !isSelected;
          if (isSelected) {
            setState(() {
              underlineWith = 18.0;
            });
          } else {
            setState(() {
              underlineWith = 0;
            });
          }
        },
        child: new Column(
          children: &lt;Widget&gt;[
            new Padding(
                padding: EdgeInsetsDirectional.fromSTEB(8.0, 0.0, 8.0, 0.0),
                child: new Container(
                  child: new Text(
                    widget.text,
                    textAlign: TextAlign.center,
                    overflow: TextOverflow.ellipsis,
                    softWrap: true,
                    style: TextStyle(
                        fontSize: 12.0,
                        fontWeight: FontWeight.bold,
                        color: Color(0x99222222)),
                  ),
                )),
            new Padding(
              padding: EdgeInsetsDirectional.fromSTEB(0.0, 5.0, 0.0, 10.0),
              child: new AnimatedContainer(
                height: 2,
                width: underlineWith,
                color: widget.underlineColor,
                duration: Duration(milliseconds: 150),
              ),
            ),
          ],
        ),
      );
    }
  }
  </code></pre>
  
  <p>if I want to return the onTap event I can do this:</p>
  
  <pre><code>return new GestureDetector(
    onTap: widget.onTap
  }
  </code></pre>
  
  <p>But how can I do both, animate and return onTap event?</p>
  
  <p>I want to run code when <strong>RowItem</strong> is tapped:</p>
  
  <pre><code>new GridView.builder(
                                    physics: const NeverScrollableScrollPhysics(),
                                    shrinkWrap: true,
                                    itemCount: _subCategories.length,
                                    gridDelegate:
                                    new SliverGridDelegateWithFixedCrossAxisCount(
                                        childAspectRatio: 3.2,
                                        crossAxisCount: 3),
                                    itemBuilder: (BuildContext context, int index) {
                                      return new RowItem(
                                        text: _subCategories[index],
                                        underlineColor: Color(0xff73A6AD),
                                        onTap: () {
                                          setState(() {
                                            //do something;
                                          });
                                        },
                                      );
                                    }
  )
  </code></pre>