title: Flutter: Enable text selection with clickable TextSpan inside RichText
body: <p>I have a requirement to enable text selection within RichText. Also i need to call some code when user click on specific TextSpan.</p>
  
  <p>I tired to run below code. But i notice that <code>onTap</code> is working only with <code>_nonSelectableRichText()</code>,  while it is not working with <code>_selectableRichText</code>.</p>
  
  <p>I don’t know if that is a bug or not… but I am asking if anyone has a solution that combines these two features?</p>
  
  <pre><code>import 'package:flutter/gestures.dart';
  import 'package:flutter/material.dart';
  
  class TestPage extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        body: Center(
          child: Builder(
            builder: (context) =&gt; Container(
              child: _nonSelectionRichText(context),
              //child: _selectionRichText(context),
            ),
          ),
        ),
      );
    }
  
    Widget _nonSelectableRichText(BuildContext context) {
      return RichText(
        text: TextSpan(
          children: [
            TextSpan(
                text: "Welcome to ",
                style: TextStyle(color: Colors.black, fontSize: 70)),
            TextSpan(
                text: "Flutter",
                style: TextStyle(color: Colors.black, fontSize: 70),
                recognizer: TapGestureRecognizer()
                  ..onTap = () {
                    print("Flutter"); // will work here
                  }),
          ],
        ),
      );
    }
  
    Widget _selectableRichText(BuildContext context) {
      return SelectableText.rich(
        TextSpan(
          children: [
            TextSpan(
                text: "Welcome to ",
                style: TextStyle(color: Colors.black, fontSize: 70)),
            TextSpan(
                text: "Flutter",
                style: TextStyle(color: Colors.black, fontSize: 70),
                recognizer: TapGestureRecognizer()
                  ..onTap = () {
                    print("Flutter"); // will not work here
                  }),
          ],
        ),
      );
    }
  }
  </code></pre>