Dynamic Text Highlighting (DTH) package for Dart & Flutter.

Overview

Dynamic Text Highlighting (DTH)

This package is used to highlight, in a completely dynamic way, keywords, or phrases, wherever they are present in a specified text.

demo

Getting Started

DynamicTextHighlighting is also the name of the package widget. It returns a RichText widget and it accepts four basic parameters:

  • text: the whole text
  • highlights: the words to be highlighted
  • color: the highlight color
  • style: the default text style
  • caseSensitive: the case sensitive option

In addition to these parameters, there are others related to RichText widget:

  • TextAlign textAlign
  • TextDirection textDirection
  • bool softWrap
  • TextOverflow overflow
  • double textScaleFactor
  • int maxLines
  • Locale locale
  • StrutStyle strutStyle
  • TextWidthBasis textWidthBasis
  • TextHeightBehavior textHeightBehavior

Example

Widget buildDTH(String text, List<String> highlights) {
  return DynamicTextHighlighting(
    text: text,
    highlights: highlights,
    color: Colors.yellow,
    style: TextStyle(
      fontSize: 18.0,
      fontStyle: FontStyle.italic,
    ),
    caseSensitive: false,
  );
}

It is a stateless widget, so for any changes just call setState(() {...}).

void applyChanges(List<String> newHighlights) {
  setState(() {
    highlights = newHighlights;
  });
}
You might also like...

A flutter widget that show the camera stream and allow ML vision recognition on it, it allow you to detect barcodes, labels, text, faces...

A flutter widget that show the camera stream and allow ML vision recognition on it, it allow you to detect barcodes, labels, text, faces...

Flutter Camera Ml Vision A Flutter package for iOS and Android to show a preview of the camera and detect things with Firebase ML Vision. Installation

Jan 2, 2023

Sytôdy, a Flutter "speech to text" todo app POC

 Sytôdy, a Flutter

Sytôdy, a Flutter "speech to text" todo app POC ⚠️ iOS10(Swift) & Android Usage Install flutter cd sytody flutter run 📺 Video demo How it works TL;DR

Jan 19, 2022

Android app that recognizes text on photos.

Text Reconition app Text recognition app built with flutter This is a simple flutter app built for recognizing text from images. The app takes a image

Oct 31, 2022

Provide easy and flexible way to show SnackBar. Simple text, undo, and error style are supported.

Provide easy and flexible way to show SnackBar. Simple text, undo, and error style are supported.

snack_bar_presenter Provide easy and flexible way to show SnackBar. Simple text, undo, and error style are supported. . . . Usage import 'package:exam

Nov 30, 2020

A package that lets you include a cool, nice looking and validated Password TextFormField in your app to enhance user experience. The package is fully & easily modifiable.

A package that lets you include a cool, nice looking and validated Password TextFormField in your app to enhance user experience. The package is fully & easily modifiable.

A package that lets you include a cool, nice looking and validated Password TextFormField in your app to enhance user experience. The package is fully

Jan 1, 2023

A Dart/Flutter package to register/query/remove URI Schemes without hassle.

protocol_registry Register/query/remove URI Schemes without hassle. Available for Windows and Linux. Installation flutter pub add protocol_registry Us

Oct 25, 2022

This Dart package will utilize the plugin, google_mobile_ads, so to quickly and easily implement ads into a Flutter app.

This Dart package will utilize the plugin, google_mobile_ads, so to quickly and easily implement ads into a Flutter app.

Ads to your App in a Snap! This Dart package will utilize the plugin, google_mobile_ads, so to quickly and easily implement ads into a Flutter app

Sep 11, 2022

Dart/Flutter package for using Elastic App Search through a simple API returning easy to handle objects

Dart/Flutter package for using Elastic App Search through a simple API returning easy to handle objects

Dart/Flutter package for using Elastic App Search through a simple API returning easy to handle objects This package is a ready-to-use API for Elastic

Nov 16, 2022
Comments
  • Show all results when there is no search phrase

    Show all results when there is no search phrase

    Hi,

    I use this widget to show searching results but when searchbox is empty, I would like to show all data, not an empty list. Now I need to wrap my list item with this widget only when searching phrase is not empty.

    Can you do something to solve it?

    ps. Thanks for case sensitive option

    opened by mateusz0matti 1
  • combination with SelectableText.rich ?

    combination with SelectableText.rich ?

    Thanks for this great package it works very good!

    Would you please be so kind and tell me if there is any possibillity to combine this feature with a selectable Text in flutter? -> SelectableText.rich i did not figure a way out yet. If you have any clues on how to combine these to make all the text selectable, please let me know.

    Thanks again!

    opened by HolyMacarony 0
  • colors array attribute

    colors array attribute

    current pars: highlights: the words to be highlighted color: the highlight color

    can you update it to? highlights: const ['this', 'demo', 'will'], colors: [Colors.yellow,Colors.lightblue,Colors.lightgreen],

    Thanks a lot for your amazing work

    opened by JanRegent 0
  • No accent sensitive option

    No accent sensitive option

    Hi, There is no option to highlight a word with a accent if you search it without accent. For example for letter a there are a lot of variations like àáâã and it would be useful if you search a word without accent to be higlighted either way. I am working on a solution and i will send it.

    opened by craciunoctavian 1
Owner
null
A Translator App Which is Build using Flutter, Speech To Text, Google ML Kit, Google Translator and Text To Speech.

AI Translator This is a Translator App Which is Build using Flutter, Speech To Text, Google ML Kit, Google Translator and Text To Speech. Download App

null 4 Jul 16, 2022
LinkWell is a Text widget that highlight all the links in the text which then navigates the user to the URL when tapped

LinkWell LinkWell is Text Plugin that detects URLs and Emails in a String and when tapped opens in user browsers, linkwell GitHub ScreenShots Basic Us

Samuel Ezedi 31 Sep 27, 2022
Flutter 2.0 (Null safety) Basic, Dynamic & Silver style Staggered Grid views made using flutter staggered grid view package. 🦺

Staggered Grid View Developement Stack Getting Started This project is a starting point for a Flutter application. A few resources to get you started

Nakshatra Singh 9 Oct 28, 2022
An android app built using flutter that displays and forecast the specific city Weather and Climate for dynamic time event by collecting the data from API that is provided for free by OPENWEATHER site.

clima_weather_reporter A new Flutter application. Getting Started This project is a starting point for a Flutter application. A few resources to get y

dev_allauddin 3 Feb 3, 2022
An architecture for dynamic UI without client deployment

Server Driven UI Demo Server Driven UI(SDUI)는 서버에서 클라이언트의 UI 컴포넌트를 관리하는 방식. 클라이언트 배포없이 API 응답을 변경하는 것만으로 UI 변경이 가능한 동시에 하위 호환성을 확보할 수 있다. Rust, GraphQ

Simon Park 15 Oct 17, 2022
A flutter package which contains a collection of Splash Screen example for your app to display logo and different text style.

splash_screen_view They say, first impression is the last! Yep, truly for any amazingly crafted application, it's easier to start impressing your audi

Sandip Kalola (SK) 17 Nov 25, 2022
display a Dart string in Flutter using simple rich text characters

simple_rich_text Easily format Flutter text with simple format characters. Motivation: lowest-possible development friction to add color and formattin

Peter Alvin 16 Dec 5, 2022
Friendly-Chat - Simple text messaging app coded in Dart using the Flutter framework

Friendly Chat A mobile application coded in the Dart programming language using

Vladislav Kostic 3 May 15, 2022
Flutter sample app using MLKit Vision API for text recognition

Flutter ML Kit Vision This a sample Flutter app integrated with the ML Kit Vision API for recognition of email addresses from an image. NOTE: The ML K

Souvik Biswas 21 Oct 12, 2022
Flutter plugin that detects the charset (encoding) of text bytes

flutter_charset_detector Automatically detect and decode the charset (character encoding) of text bytes. The example app; details This plugin uses nat

Aaron Madlon-Kay 11 Jun 8, 2022