パッケージ、リポジトリ、アプリカテゴリを検索

linkfy_text のカバー
パッケージ詳細v1.1.6

linkfy_text

URL、メールアドレス、ハッシュタグを含むテキストを、Twitterのようにリンク化する軽量なFlutterパッケージです。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
2100
いいね数
194
Pub ポイント
140

パッケージをインストール

flutter pub add linkfy_text

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

LinkfyText は、テキスト内の URL、メールアドレス、ハッシュタグを自動的に検出し、クリック可能なリンクに変換する軽量な Flutter パッケージです。Twitter のリンク動作を模倣しており、手動でのリンク形式設定が不要で、ユーザー体験を向上させます。Android、iOS、Web、macOS、Windows、Linux など複数のプラットフォームをサポートし、デバイス間で一貫した機能を提供します。ソーシャルメディアアプリ、チャットインターフェース、または動的なテキストリンクが必要なあらゆるアプリに最適です。

用途

  • ソーシャルメディアフィード
  • チャットアプリケーション
  • ユーザーが生成したコンテンツの表示
  • メールアドレスおよびURLの抽出
  • ハッシュタグナビゲーション

主な機能

  • 自動URL検出
  • メールリンク化
  • ハッシュタグをクリック可能なタグに変換
  • クロスプラットフォーム対応
  • 軽量で高速

適している対象

  • 豊富なテキストコンテンツを持つアプリ
  • ユーザー入力付きのインタラクティブなUI
  • コンテンツが豊富なインターフェース
  • リアルタイムメッセージングアプリ
  • ミニマリストデザインと動的テキスト

注意事項

  • 複雑なテーマに対応するためのカスタムスタイルが必要になる場合があります
  • 基本的なリンクタイプに限定(メンションやカスタムパターンは対応していません)
  • 非常に長いテキストに対するパフォーマンスへの影響
  • ネストされたリンクの組み込み処理なし
  • 検出に外部の正規表現パターンに依存しています

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

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

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

このパッケージを使用しているプロジェクト