Created
May 19, 2021 03:21
-
-
Save csells/695bc8b89d013195eba83d8261cd0874 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/gestures.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:url_launcher/url_launcher.dart' as urlLauncher; | |
void main() => runApp(App()); | |
class App extends StatelessWidget { | |
static const title = 'Flutter App'; | |
@override | |
Widget build(BuildContext context) => MaterialApp( | |
title: title, | |
home: HomePage(), | |
); | |
} | |
class HomePage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) => Scaffold( | |
appBar: AppBar(title: Text(App.title)), | |
body: Center( | |
child: RichText( | |
text: TextSpan( | |
style: TextStyle(fontSize: 48), | |
children: [ | |
TextSpan( | |
text: 'This is not a link, ', | |
style: TextStyle(color: Colors.black), | |
), | |
TextSpan( | |
text: 'but this is', | |
style: TextStyle(color: Colors.blue), | |
recognizer: TapGestureRecognizer() | |
..onTap = () { | |
urlLauncher.launch('https://flutter.dev'); | |
}, | |
), | |
], | |
), | |
), | |
), | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment