Search packages, repositories and app categories

linkfy_text cover
Package detailsv1.1.6

linkfy_text

A lightweight flutter package to linkify texts containing urls, emails and hashtags like twitter does.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
2.1K
Likes
194
Pub points
140

Install package

flutter pub add linkfy_text

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

LinkfyText is a lightweight Flutter package that automatically detects and converts URLs, emails, and hashtags within text into clickable links, mimicking Twitter's linking behavior. It enhances user experience by making text interactions intuitive without requiring manual link formatting. The package supports multiple platforms including Android, iOS, Web, macOS, Windows, and Linux, ensuring consistent functionality across devices. Ideal for social media apps, chat interfaces, or any app needing dynamic text linking.

Use cases

  • Social media feeds
  • Chat applications
  • User-generated content display
  • Email and URL extraction
  • Hashtag navigation

Key features

  • Automatic URL detection
  • Email linkification
  • Hashtag to clickable tags
  • Cross-platform support
  • Lightweight and fast

Suitable for

  • Apps with rich text content
  • Interactive UIs with user input
  • Content-heavy interfaces
  • Real-time messaging apps
  • Minimalist design with dynamic text

Considerations

  • May require custom styling for complex themes
  • Limited to basic link types (no mentions or custom patterns)
  • Performance impact on very long texts
  • No built-in handling for nested links
  • Depends on external regex patterns for detection

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

linkfy_text

Lightweight flutter package that detects linkable patterns(urls, emails, hashtags, etc) in a text and makes them clickable. It also allows you to customize the style of the linkified text and the link itself. It also allows you to choose what type of link to linkify in a text.¬

pub package CI coverage Status

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),
    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),
    LinkTypes: [LinkType.url, LinkType.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
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
LinkType
Parameter Type Description
type Link the link type either url, email or hashtag, @mention
value String value the 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

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package