• Stars
    star
    269
  • Rank 152,662 (Top 4 %)
  • Language
    C++
  • License
    MIT License
  • Created about 6 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Turns text URLs and emails into clickable inline links in text for Flutter

flutter_linkify pub package

Turns text URLs and emails into clickable inline links in text for Flutter.

Required Dart >=2.17 (has null-safety support).

Pub - API Docs - GitHub

Install

Install by adding this package to your pubspec.yaml:

dependencies:
  flutter_linkify: ^6.0.0

It is highly recommend that you also add a dependency on url_launcher to open links in the browser/OS.

Usage

Basic:

import 'package:flutter_linkify/flutter_linkify.dart';

Linkify(
  onOpen: (link) => print("Clicked ${link.url}!"),
  text: "Made by https://cretezy.com",
);

Styling

Add a style to non-links (yellow) or links (red), and open in browser using url_launcher:

import 'package:flutter_linkify/flutter_linkify.dart';
import 'package:url_launcher/url_launcher.dart';

Linkify(
  onOpen: (link) async {
    if (!await launchUrl(Uri.parse(link.url))) {
      throw Exception('Could not launch ${link.url}');
    }
  },
  text: "Made by https://cretezy.com",
  style: TextStyle(color: Colors.yellow),
  linkStyle: TextStyle(color: Colors.red),
);

All RichText options are available for use.

Linkify Options

By default, humanization (removal of http:// or https:// from the start of the URL) is enabled. You may disable it by passing options:

Linkify(
  text: "Made by https://cretezy.com",
  options: LinkifyOptions(humanize: false),
);

Selectable Text

Use the SelectableLinkify widget to create selectable text. All SelectableText options are available for use.

SelectableLinkify(
  text: "Made by https://cretezy.com\n\nMail: [email protected]",
);

Advance

In the onOpen callback, a LinkableElement is passed in. You can check if it is a UrlElement or EmailElement using is for custom handling.

You can enable parsing of only some link types using the linkifiers option. URL and email are enabled by default.

Full example can be found at example/lib/main.dart.

Example Screenshot

More Repositories

1

Noderize

Create a Node app in less than 30 seconds.
JavaScript
421
star
2

dSock

Distributed WebSocket broker
Go
220
star
3

Swap

Simple swap setup script for Linux.
Shell
205
star
4

lazyjj

TUI for Jujutsu/jj
Rust
141
star
5

redux_persist

Persist Redux State
Dart
130
star
6

redux-persist-expo-securestore

redux-persist storage for Expo's SecureStore
JavaScript
73
star
7

braintree-web-drop-in-react

React component for Braintree Web Drop-In (v3)
JavaScript
71
star
8

linkify

Low-level link (text, URLs, emails) parsing library in Dart
Dart
62
star
9

cloudflare-d1-backup

Dump Cloudflare D1 databases (without Workers)
TypeScript
48
star
10

i3-back

An i3/Sway utility to switch focus to your last focused window. Alt+Tab in i3
Rust
43
star
11

MasterPassX

A deterministic stateless password generator.
JavaScript
26
star
12

flutter-format-pre-commit

Format Flutter code with pre-commit
Shell
23
star
13

react-redux-router-firebase

Boilerplate for React & Redux, integrated with Firebase authentication
JavaScript
23
star
14

flutter_super_state

A simple super state management library for Flutter (with async support)
Dart
22
star
15

fddp

Facebook Downloaded Data Processor (process Facebook archive messages)
Go
18
star
16

flutter_fadein

Simple Flutter widget to fade-in your widgets once they are mounted
Dart
9
star
17

dart-format-pre-commit

Format Dart code with pre-commit
Shell
6
star
18

flutter_cursor

Custom cursor support for Flutter Web
Dart
5
star
19

go-http-gulp-boilerplate

Full featured boilerplate for a Go web project
Go
4
star
20

d1-api

Interact with the Cloudflare D1 API outside of Cloudflare Workers
TypeScript
4
star
21

imgix.dart

An Imgix library for Dart. Generate Imgix URLs with options easily
Dart
4
star
22

neo-tree-jj.nvim

A Neo-tree source for Jujustsu/jj
Lua
3
star
23

deno_body_parser

A generic HTTP body parser for Deno
TypeScript
3
star
24

BetaLister

List available beta apps on Android
TypeScript
2
star
25

http-signature-helpers

Helpers for "Signing HTTP Messages" draft spec
JavaScript
2
star
26

http_signature_helper.dart

Dart
2
star
27

auth_params.dart

Parse auth-param syntax from RFC7235 in Dart
Dart
2
star
28

flutter_super_state_example

Example for flutter_super_state
Dart
2
star
29

imgix_flutter.dart

An Imgix Flutter wrapper to embed Imgix URLs with options easily
C++
2
star
30

CTBUtilityModpack

A Minecraft client utility modpack using Fabric, supporting Minecraft snapshot versions
Shell
2
star
31

auth-param-parser

Parse auth-param syntax from RFC7235
JavaScript
2
star
32

Monokai

Charles' VSCode Monokai Theme
2
star
33

dSock-go

Go client for dSock
Go
1
star
34

proposal-named-parameters

Add named parameters and optional destructuring to JavaScript
1
star
35

dSock-node

dSock Node client
TypeScript
1
star