updated readme

This commit is contained in:
iamstanlee 2021-06-03 21:35:39 -07:00
parent d62fe10784
commit e71d8c3383
1 changed files with 16 additions and 17 deletions

View File

@ -7,26 +7,25 @@ A lightweight flutter package to linkify texts containing urls, emails and hasht
```dart ```dart
// first import the package // first import the package
import 'package:linkfy_text/linkify_text.dart'; import 'package:linkfy_text/linkify_text.dart';
LinkifyText(
"This text contains a url: https://flutter.dev",
LinkifyText( linkStyle: TextStyle(color: Colors.blue, fontSize: 16),
"This text contains a url: https://flutter.dev", onTap: (link) {
linkStyle: TextStyle(color: Colors.blue, fontSize: 16), // onTap is called when a link is pressed
onTap: (link) { print("${link.value}");
print("${link.value}"); },
}, );
);
``` ```
Be default, The above snippet would linkify all urls in the string, you can choose whatxw type of link to linkify by passing the `linkTypes` parameter Be default, The above snippet would linkify all urls in the string, you can choose whatxw type of link to linkify by passing the `linkTypes` parameter
```dart ```dart
LinkifyText( LinkifyText(
"This text contains an #hashtag", "This text contains an #hashtag",
linkStyle: TextStyle(color: Colors.blue, fontSize: 16), linkStyle: TextStyle(color: Colors.blue, fontSize: 16),
linkTypes: [LinkType.hashtag] linkTypes: [LinkType.hashtag]
onTap: (link) { onTap: (link) {
print("${link.value}"); print("${link.value}");
}, },
); );
``` ```