this is auto generated from API :)
Go to file
iamstanlee 8c09498aaa bump version 2021-09-02 18:32:07 -07:00
example bump version 2021-09-02 18:24:57 -07:00
lib refactor: enforce lint rules 2021-09-02 18:24:27 -07:00
test refactor: enforce lint rules 2021-09-02 18:24:27 -07:00
.gitignore initial commit 2021-06-03 13:00:21 -07:00
.metadata initial commit 2021-06-03 13:00:21 -07:00
CHANGELOG.md bump version 2021-09-02 18:32:07 -07:00
LICENSE initial commit 2021-06-03 13:00:21 -07:00
README.md refactor: enforce lint rules 2021-09-02 18:24:27 -07:00
analysis_options.yaml refactor: enforce lint rules 2021-09-02 18:24:27 -07:00
ezgif.com-gif-maker.gif refactor: example app, docs: added gif 2021-06-04 06:24:35 -07:00
pubspec.lock refactor: enforce lint rules 2021-09-02 18:24:27 -07:00
pubspec.yaml bump version 2021-09-02 18:24:57 -07:00

README.md

linkfy_text

A lightweight flutter package that linkifies a text containing urls, emails and hashtag like twitter does.

pub package

gif

Usage

To use this package, add linkfy_text as a dependency in your pubspec.yaml file.

Example:

// first import the package
import 'package:linkfy_text/linkify_text.dart';

Container(
    child: LinkifyText(
    "This text contains a url: https://flutter.dev",
    linkStyle: TextStyle(color: Colors.blue, fontSize: 16),
    onTap: (link) {
        /// do stuff with `link`
        },
    );
)

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

Container(
    child: LinkifyText(
    "This text contains a url: https://flutter.dev and #flutter",
    linkStyle: TextStyle(color: Colors.blue, fontSize: 16),
    Links: [Link.url, Link.hashtag]
    onTap: (link) {
        /// do stuff with `link` like
        /// if(link.type == Link.url) launchUrl(link.value);
        },
    );
)

API Reference

LinkfyText

Parameter Type Description
textStyle TextStyle style applied to the text
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]
onTap Function(Link) function called when a link is pressed
Parameter Type Description
type Link the link type either url, email or hashtag
value String value this link holds

Contributions

Feel free to contribute to this project.

If you find a bug or want a feature, but don't know how to fix/implement it, please fill an issue.
If you fixed a bug or implemented a feature, please send a pull request.

TODO

  • LinkifyTextField widget