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

Overview

linkfy_text

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

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

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][issue].
If you fixed a bug or implemented a feature, please send a [pull request][pr].

You might also like...

Receive sharing photos, videos, text, URLs, or any other file types from another app.

Receive sharing photos, videos, text, URLs, or any other file types from another app.

Receive Sharing Files To Flutter App Through Other Apps Receive sharing photos, videos, text, URLs, or any other file types from another app. Visit :

Dec 25, 2022

Link-extractor - A Simple utility for extracting media urls from different websites

Link Extractor A Simple utility for extracting media urls from differennt social

Feb 5, 2022

A flutter boilerplate project containing bloc, pedantic, hive, easy_translations and more!

A flutter boilerplate project containing bloc, pedantic, hive, easy_translations and more!

Flutter Production Boilerplate A flutter project containing bloc, flutter_lints, hive, easy_translations and more! This repository is the starting poi

Dec 26, 2022

Doctor Consultation App in Flutter containing splash screen on boarding screen Routing state management Dash board Bottom navigation Decorated Drawer and Doctors Screen in the last.

Doctor Consultation App in Flutter containing splash screen on boarding screen  Routing  state management Dash board Bottom navigation Decorated Drawer and Doctors Screen in the last.

Online doctor Consultation App UI in Flutter Doctor Consultation App UI in Flutter Visit Website Features State Management Navigation Bar Responsive D

Jan 1, 2023

A Flutter repo with a ready-to-go architecture containing flavors, bloc, device settings, json serialization and connectivity

A Flutter repo with a ready-to-go architecture containing flavors, bloc, device settings, json serialization and connectivity

Flutter Ready to Go A Flutter repo with a ready-to-go architecture containing flavors, bloc, device settings, json serialization and connectivity. Why

Nov 11, 2022

Flutter widget library containing buttons for authenticating with popular social networks: Apple, Google, Facebook, Twitter and Microsoft.

Flutter widget library containing buttons for authenticating with popular social networks: Apple, Google, Facebook, Twitter and Microsoft.

Flutter Auth Buttons This library is now in maintenance mode I'm no longer actively using Flutter and don't have the time to keep this library maintai

Nov 3, 2022

A flutter project containing riverpod, flutter_lints, hive, easy_translations and more!

 A flutter project containing riverpod, flutter_lints, hive, easy_translations and more!

Flutter Production Boilerplate Riverpod A flutter project containing riverpod, flutter_lints, hive, easy_translations and more! This repository is the

Dec 27, 2022

Flutter project containing all my flutter UI challenges

Flutter project containing all my flutter UI challenges

My Flutter Challenges A new Flutter project containing all my flutter UI challenges. How to get the code? You just click on the title of each challeng

Jan 3, 2023

Repository containing source code for the tutorials made using with flutter

Repository containing source code for the tutorials made using with flutter

Flutter Tutorials Repository Containing Source code for tutorials found here: https://petercoding.com Note: Don't forgot to run pub get or just open p

Dec 9, 2022
Comments
  • cant handle email in this package

    cant handle email in this package

    tried a lot of times I can't able to use email type. I can use the email type with another package in the same project, but why the package is not not support in this package

    opened by abiheaven 3
  • Change url regex

    Change url regex

    Previous Regex Exp: (?:(?:https?|ftp):\/\/)?[\w/\-?=%.]+\.[\w/\-?=%.]+

    image

    New Regex Exp: ((https?:\/\/(?:www\.|(?!www))|ftp?:\/\/)[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})

    image

    From this now it's working on the complete link

    opened by lkrjangid1 2
Owner
Stanley Akpama
fullstackoverflow developer
Stanley Akpama
Low-level link (text, URLs, emails) parsing library in Dart

linkify Low-level link (text, URLs, emails) parsing library in Dart. Required Dart >=2.12 (has null-safety support). Flutter library. Pub - API Docs -

Charles C 60 Nov 4, 2022
camilo velandia 69 Dec 30, 2022
Flutter plugin which helps you to find links in String using NSDataDetector and Linkify

Flutter's Native Linkify native_linkify is a Flutter plugin. Use it to find links in plain-text. The plugin uses NSDataDetector for iOS and macOS; Lin

Ilia Beregovskii 3 Nov 29, 2022
Allows send emails from flutter using native platform functionality.

flutter_email_sender Allows send emails from flutter using native platform functionality. In android it opens default mail app via intent. In iOS MFMa

Tautvydas Šidlauskas 107 Jan 3, 2023
A routing package that lets you navigate through guarded page stacks and URLs using the Router and Navigator's Pages API, aka "Navigator 2.0".

A Flutter package to help you handle your application routing and synchronize it with browser URL. Beamer uses the power of Router and implements all

Sandro Lovnički 485 Jan 7, 2023
A CLI tool and Dart package that can scrape file and directory URLs from h5ai instances.

h5ai scraper A CLI tool and Dart package that can scrape file and directory URLs from h5ai instances. Usage This tool requires the Dart SDK. It can be

null 1 Jan 4, 2023
A Video and Audio player that can play from local assets, local files and network URLs with the powerful controls

Video/Audio Player in Flutter with Powerful controls How can we play videos in Flutter? There is a library directly from the Flutter team simply calle

Harsh Mistry 12 Jan 31, 2022
A package containing different kinds of services and utilities.

TODO: Put a short description of the package here that helps potential users know whether this package might be useful for them. Features TODO: List w

Daniel 0 Nov 26, 2021
A Flutter package containing widgets created by GroovinChip.

A Flutter package containing widgets and utilities created and edited by GroovinChip. This package currently contains the following widgets: ModalDraw

Reuben Turner 93 Oct 17, 2022
Easy to use text widget for Flutter apps, which converts inlined urls into working, clickable links

LinkText Easy to use text widget for Flutter apps, which converts inlined URLs into clickable links. Allows custom styling. Usage LinkText widget does

Aleksander Woźniak 20 Nov 4, 2022