import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:url_launcher/url_launcher.dart'; void main() { runApp(new MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( home: new Scaffold( appBar: new AppBar( title: new Text('UrlLauchner'), ), body: new Center( child: new RichText( text: new TextSpan( children: [ new TextSpan( text: 'This is no Link, ', style: new TextStyle(color: Colors.black), ), new TextSpan( text: 'but this is', style: new TextStyle(color: Colors.blue), recognizer: new TapGestureRecognizer() ..onTap = () { launch('https://docs.flutter.io/flutter/services/UrlLauncher-class.html'); }, ), ], ), ), ), ), ); } }
How to create a hyperlink in Flutter widget
12 min read