Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

linkfy_text

a lightweight flutter package to linkify texts containing urls, emails and hashtags.

ezgif.com-gif-maker

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 linktypes parameter

container(
    child: linkifytext(
    "this text contains a url: https://flutter.dev and #flutter",
    linkstyle: textstyle(color: colors.blue, fontsize: 16),
    linktypes: [linktype.url, linktype.hashtag]
    ontap: (link) {
        /// do stuff with `link` like
        /// if(link.type == linktype.url) launchurl(link.value);
        },
    );
)
parameters default description
textstyle null style applied to the text
linkstyle null style applied to the linkified text, defaults to the textstyle
linktypes linktype.url a list of linktypes used to override the links to be linkified in the text either a hashtag, email or url.
ontap null callback function with a link paramater called when a link is pressed

Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.