flutter_colorful_search 1.0.2

SDKflutter
Platformandroidioswindowslinuxmacosweb

A lightweight Flutter widget to highlight matching text segments within a string using customizable colorful styles — perfect for search and autocomplete UIs.

flutter_colorful_search

A lightweight and customizable Flutter widget to highlight matching substrings within a text — ideal for building search suggestions, autocomplete UIs, and keyword highlighting in lists.


✨ Features

  • 🔍 Case-insensitive text matching
  • 🎨 Customizable highlight and normal text styles
  • 💡 Simple, lightweight, and dependency-free
  • 🧩 Easily pluggable in ListViews, search bars, and suggestion widgets

ParameterTypeDescription
listItemStringThe full string to be displayed.
searchTextStringThe string to be highlighted if found in listItem.
normalTextStyleTextStyle?Optional. Style for non-matching text.
highlightTextStyleTextStyle?Optional. Style for the matching/highlighted portion of the text.
maxLinesint?Optional. The maximum number of lines to display (defaults to 2). Text that exceeds this limit will be truncated with an ellipsis (...).

📦 Installation

Add this to your pubspec.yaml file:

dependencies:
  flutter_colorful_search: ^1.0.2

🧩 Getting Started

Simply import the package in your Dart file:

import 'package:flutter_colorful_search/flutter_colorful_search.dart';

✅ Usage Example

Go to example section to get full code.

 ListTile(
    tileColor: Colors.black,
    title: FlutterColorfulSearch(
      listItem:  filteredItems[index], // Actual string to display
      searchText: searchTerm, // Text to highlight
      normalTextStyle: TextStyle(color: Colors.white,fontSize: 18),
      highlightTextStyle: TextStyle(color: Colors.red,fontSize: 18),
      maxLines: 2,
    ),
  ),
                    

🔍 Search Example

flutter_colorful_search

📝 License

This project is licensed under the MIT License.

MIT License

Copyright (c) 2025 Raihan Sikdar

Permission is hereby granted, free of charge, to any person obtaining a copy...