Buscar pacotes, repositórios e categorias de apps

Capa de linkfy_text
Detalhes do pacotev1.1.6

linkfy_text

Um pacote leve do Flutter para linkificar textos contendo URLs, e-mails e hashtags, como o Twitter faz.

AndroidiOSWebmacOSWindowsLinux
Downloads em 30 dias
2,1 mil
Curtidas
194
Pontos Pub
140

Instalar pacote

flutter pub add linkfy_text

Visão geral do pacote

Orientação gerada a partir de informações públicas. Apenas para referência.

LinkfyText é um pacote leve para Flutter que detecta e converte automaticamente URLs, emails e hashtags dentro do texto em links clicáveis, imitando o comportamento de link do Twitter. Ele melhora a experiência do usuário ao tornar as interações com texto intuitivas, sem necessidade de formatação manual de links. O pacote suporta múltiplas plataformas, incluindo Android, iOS, Web, macOS, Windows e Linux, garantindo funcionalidade consistente entre dispositivos. Ideal para aplicativos de redes sociais, interfaces de chat ou qualquer app que precise de links dinâmicos no texto.

Casos de uso

  • feeds de redes sociais
  • Aplicativos de bate-papo
  • exibição de conteúdo gerado pelo usuário
  • Extração de e-mail e URL
  • Navegação por hashtag

Principais recursos

  • Detecção automática de URL
  • linkificação de e-mail
  • Hashtag para tags clicáveis
  • Suporte multiplataforma
  • Leve e rápido

Indicado para

  • Aplicativos com conteúdo de texto rico
  • UIs interativas com entrada do usuário
  • interfaces com conteúdo intenso
  • Aplicativos de mensagens em tempo real
  • Design minimalista com texto dinâmico

Considerações

  • Pode exigir estilização personalizada para temas complexos
  • Limitado a tipos básicos de link (sem menções ou padrões personalizados)
  • Impacto no desempenho em textos muito longos
  • Nenhuma manipulação embutida para links aninhados
  • Depende de padrões de expressão regular externos para detecção

README original

Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.

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

Categorias

Dependências

Lista de dependências 1 itens

Repositório-fonte

Projetos que usam este pacote