पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

flutter_linkify कवर
पैकेज विवरणv6.0.0

flutter_linkify

फ्लटर में टेक्स्ट में URL और ईमेल को क्लिक करने योग्य इनलाइन लिंक में बदलें।

AndroidiOSWebmacOSWindowsLinux
30-दिन डाउनलोड
2.8 लाख
लाइक
775
Pub अंक
150

पैकेज इंस्टॉल करें

flutter pub add flutter_linkify

पैकेज अवलोकन

सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।

flutter_linkify एक Flutter पैकेज है जो सामान्य पाठ में URLs और ईमेल पते का स्वचालित रूप से पता लगाता है और उन्हें क्लिक करने योग्य लिंक में बदल देता है। इसके द्वारा आंतरिक हाइपरलिंक को सक्षम करके टेक्स्ट रेंडरिंग में सुधार किया जाता है, जिसमें हाथ से फॉर्मेटिंग की आवश्यकता नहीं होती है। यह पैकेज Android, iOS, Web, macOS, Windows और Linux जैसे कई प्लेटफॉर्म का समर्थन करता है, जिससे यह क्रॉस-प्लेटफॉर्म एप्लिकेशन के लिए आदर्श बन जाता है। यह Flutter के Text विजेट के साथ बिना किसी दिक्कत के एकीकृत होता है और कस्टमाइज़ करने योग्य लिंक स्टाइल और व्यवहार प्रदान करता है।

उपयोग

  • URL के साथ रॉ टेक्स्ट को इंटरैक्टिव लिंक में बदलना
  • ईमेल को mailto: लिंक के रूप में प्रदर्शित करें
  • चैट या कमेंट सेक्शन में उपयोगकर्ता अनुभव को बढ़ाना
  • स्वचालित लिंकिंग के साथ समृद्ध टेक्स्ट सामग्री बनाना
  • क्लिक करने योग्य संदर्भ के साथ दस्तावेज़ या सहायता स्क्रीन बनाना

मुख्य विशेषताएँ

  • URL और ईमेल का स्वचालित निर्धारण
  • बहुपлатफॉर्म समर्थन
  • कस्टमाइज़ किए गए लिंक स्टाइल
  • Flutter के Text विजेट के साथ एकीकरण
  • कॉन्फ़िगरेबल लिंक व्यवहार और कॉलबैक
  • http और https प्रोटोकॉल दोनों का समर्थन करता है

इनके लिए उपयुक्त

  • क्लिक करने योग्य लिंक के साथ धन्यवाद टेक्स्ट की आवश्यकता वाले ऐप्स
  • चैट या संदेश इंटरफ़ेस
  • दस्तावेज़ या ज्ञान भंडार ऐप
  • उपयोगकर्ता-उत्पादित पाठ के साथ सामग्री-भारित एप्लिकेशन
  • आसान हाइपरलिंक एकीकरण की तलाश में विकासकर्ता

विचार योग्य बातें

  • सुसंगत दिखावट के लिए अतिरिक्त स्टाइलिंग की आवश्यकता हो सकती है
  • बड़े टेक्स्ट ब्लॉक्स के साथ संभावित प्रदर्शन प्रभाव
  • URL और ईमेल पैटर्न (कस्टम रेगेक्स नहीं) तक सीमित
  • लिंक टैप इवेंट्स का सावधानीपूर्वक हैंडल करने की आवश्यकता है
  • लिंक के अतिरिक्त जटिल रिच टेक्स्ट प्रारूपण के लिए उपयुक्त नहीं

मूल README

संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।

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: example@gmail.com",
);
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

श्रेणियाँ

निर्भरताएँ

निर्भरता सूची 1 आइटम

सोर्स रिपॉज़िटरी

इस पैकेज का उपयोग करने वाले प्रोजेक्ट