Repository: flutter
Issue: [url_launcher]Add LinkSpan For RichText Widget
Labels: c: new feature,p: url_launcher,package,c: proposal,team-ecosystem,P3,triaged-ecosystem

## Use case

As of now you could add text links to a `RichText` with the help of a `TextSpan`, however this has some disadvantages.

1. A lot of boilerplate code needed.
2. Doesn't support a link preview in web browsers.
3. Doesn't support a link target to open the link on the same tab or a new tab in the browser without deeper knowledge of [url_launcher](https://pub.dev/packages/url_launcher)

```dart
import 'package:url_launcher/url_launcher.dart';

Text.rich(
  TextSpan(
    style: TextStyle(fontSize: 32),
    children: [
      TextSpan(text: 'Click here '),
      
      /// a lot of code for a simple link
      TextSpan(
        text: 'flutter.dev',
        style: TextStyle(
          decoration: TextDecoration.underline,
          color: Colors.blue,
        ),
        recognizer: TapGestureRecognizer()
          ..onTap = () async {
            final url = 'https://flutter.dev';

            if (await canLaunch(url)) {
              await launch(url);
            } else {
              throw 'Could not launch $url';
            }
          },
      ),
      TextSpan(text: '!'),
    ],
  ),
),
```

## Proposal
**Add a new `LinkSpan` for the RichText Widget** inside the [url_launcher package](https://pub.dev/packages/url_launcher)

**Features**

1.  Should be underlined, in blue color and support mouse cursor change on hover by default.
![hover](https://user-images.githubusercontent.com/44921899/136761330-19aee70f-c4a1-4765-a305-6a349f53e578.gif)

2. Should show a link preview on the bottom left corner of the browser on Flutter Web. Same as [Link Widget](https://github.com/flutter/plugins/blob/master/packages/url_launcher/url_launcher/lib/src/link.dart) is doing.
![hover](https://user-images.githubusercontent.com/44921899/136762108-9ea103d5-8d41-4a04-84f9-bce173479fb1.png)

3. Add `LinkTarget` self, blank, ... to open link on same tab or new tab for web apps and open an in-app WebView or external browser for mobile apps. Same as [Link Widget](https://github.com/flutter/plugins/blob/master/packages/url_launcher/url_launcher/lib/src/link.dart) is doing.

My proposal for a new `LinkSpan`.
```dart
LinkSpan(
  uri: Uri.parse('https://flutter.dev'),
  text: 'flutter.dev', // could be also optional: e.g. [uri] is displayed as default text
  
  /// ... [TextSpan] properties ...
  
  /// Optional: link text should be by default blue and underlined
  linkStyle: TextStyle(color: Colors.red),

  /// Optional: only if someone wants to have full control
  onTap: (followLink) { 
    followLink();
  }

  /// Optional: to open link in same tab or new tab (similar to [Link] widget)
  target: LinkTarget.defaultTarget, 
),
```

The `LinkSpan` should be usable in both widgets A. `Text.rich` and B. `SelectableText.rich`.

**A. Text.rich**

```dart
Text.rich(
  TextSpan(
    children: [
      TextSpan(text: 'Click here'),
      
      /// Added new link text
      LinkSpan(
        uri: Uri.parse('https://flutter.dev'),
        text: 'flutter.dev',
      ),
      TextSpan(text: '!'),
    ],
  ),
),
```

**B. SelectableText.rich**

```dart
SelectableText.rich(
  TextSpan(
    children: [
      TextSpan(text: 'Click here'),
      
       /// Added new link text
      LinkSpan(
        uri: Uri.parse('https://flutter.dev'),
        text: 'flutter.dev',
      ),
      TextSpan(text: '!'),
    ],
  ),
),
```