updates docs
This commit is contained in:
parent
271aa6e1c3
commit
1121574876
39
README.md
39
README.md
|
@ -1,10 +1,15 @@
|
||||||
# linkfy_text
|
# linkfy_text
|
||||||
|
|
||||||
A lightweight flutter package that linkifies a text containing urls, emails and hashtag like twitter does.
|
A lightweight flutter package that linkifies a text containing urls, emails, mentions and hashtag like twitter does.
|
||||||
|
|
||||||
[](https://pub.dev/packages/linkfy_text)
|
[](https://pub.dev/packages/linkfy_text)
|
||||||
|
[](https://github.com/Iamstanlee/linkfy_text/actions?query=CI)
|
||||||
|
[](https://coveralls.io/github/Iamstanlee/linkfy_text?branch=main)
|
||||||
|
|
||||||

|
<p>
|
||||||
|
<img src="https://raw.githubusercontent.com/Iamstanlee/linkfy_text/main/screenshots/1.png" width="200px" height="auto" hspace="20"/>
|
||||||
|
<img src="https://raw.githubusercontent.com/Iamstanlee/linkfy_text/main/screenshots/2.png" width="200px" height="auto" hspace="20"/>
|
||||||
|
</p>
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
@ -19,7 +24,7 @@ import 'package:linkfy_text/linkify_text.dart';
|
||||||
Container(
|
Container(
|
||||||
child: LinkifyText(
|
child: LinkifyText(
|
||||||
"This text contains a url: https://flutter.dev",
|
"This text contains a url: https://flutter.dev",
|
||||||
linkStyle: TextStyle(color: Colors.blue, fontSize: 16),
|
linkStyle: TextStyle(color: Colors.blue),
|
||||||
onTap: (link) {
|
onTap: (link) {
|
||||||
/// do stuff with `link`
|
/// do stuff with `link`
|
||||||
},
|
},
|
||||||
|
@ -27,14 +32,14 @@ Container(
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
Be default, The above snippet would linkify all urls in the string, you can choose what type of link to linkify by passing the `Links` parameter
|
Be default, The above snippet would linkify all urls in the string, you can choose what type of link to linkify by passing the `LinkTypes` parameter
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
Container(
|
Container(
|
||||||
child: LinkifyText(
|
child: LinkifyText(
|
||||||
"This text contains a url: https://flutter.dev and #flutter",
|
"This text contains a url: https://flutter.dev and #flutter",
|
||||||
linkStyle: TextStyle(color: Colors.blue, fontSize: 16),
|
linkStyle: TextStyle(color: Colors.blue),
|
||||||
Links: [Link.url, Link.hashtag]
|
LinkTypes: [LinkType.url, LinkType.hashtag]
|
||||||
onTap: (link) {
|
onTap: (link) {
|
||||||
/// do stuff with `link` like
|
/// do stuff with `link` like
|
||||||
/// if(link.type == Link.url) launchUrl(link.value);
|
/// if(link.type == Link.url) launchUrl(link.value);
|
||||||
|
@ -47,19 +52,19 @@ Container(
|
||||||
|
|
||||||
#### LinkfyText
|
#### LinkfyText
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
| Parameter | Type | Description |
|
||||||
| :---------- | :--------------- | :--------------------------------------------------------------------------------------------------------------------------------- |
|
| :---------- | :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||||
| `textStyle` | `TextStyle` | style applied to the text |
|
| `textStyle` | `TextStyle` | style applied to the text |
|
||||||
| `linkStyle` | `TextStyle` | style applied to the linkified text. **defaults** to `textStyle` |
|
| `linkStyle` | `TextStyle` | style applied to the linkified text. **defaults** to `textStyle` |
|
||||||
| `Links` | `List<Link>` | a list of `Link` used to override the links to be linkified in a text either a url, hashtag or email. **defaults** to `[Link.url]` |
|
| `LinkTypes` | `List<LinkType>` | a list of `LinkType` used to override the links to be linkified in a text either a url, hashtag or email. **defaults** to `[LinkTypes.url]` |
|
||||||
| `onTap` | `Function(Link)` | function called when a link is pressed |
|
| `onTap` | `Function(Link)` | function called when a link is pressed |
|
||||||
|
|
||||||
#### Link
|
#### LinkType
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
| Parameter | Type | Description |
|
||||||
| :-------- | :------- | :----------------------------------------- |
|
| :-------- | :------- | :--------------------------------------------------- |
|
||||||
| `type` | `Link` | the link type either url, email or hashtag |
|
| `type` | `Link` | the link type either url, email or hashtag, @mention |
|
||||||
| `value` | `String` | value this link holds |
|
| `value` | `String` | value the link holds |
|
||||||
|
|
||||||
# Contributions
|
# Contributions
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue