Search in List View In Flutter

Search in List View In Flutter :

Search in List View In Flutter : Today we Learn about how to create search In list view in flutter.using flutter you can design a beautiful and attractive ui of search in list view in flutter

simply for the search type any word o the search box if any matching word or character found then it display it. in this flutter tutorial i set the icon color blue with slide able search.if any matching character found then you can see it as a red color.

the final result and the code for design search in list view in flutter is given know more study continuously this flutter tutorial

i hope the demo of the search in list view in flutter is very helpful for the beginner

Screenshot 1:

Search in List View In Flutter

Screenshot 2:

Search in List View In Flutter


import 'package:flutter/material.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:pull_to_reveal/pull_to_reveal.dart';

typedef Widget BuildHighlight(String term);

class SearchableListTile {
  SearchableListTile({this.buildHighlight, this.buildNolight, this.text})
      : assert(text != null);

  final BuildHighlight buildHighlight;
  final Function buildNolight;
  final String text;

class SearchableSlideableList extends StatefulWidget {

  final List<SearchableListTile> list;

  _SearchableSlideableListState createState() =>

class _SearchableSlideableListState extends State<SearchableSlideableList> {
  String _filter;
  TextEditingController searchController;

  Widget build(BuildContext context) {
    return Center(
      child: PullToRevealTopItemList(
          dividerBuilder: (BuildContext context) {
            return Container(
              alignment: Alignment.topLeft,
              padding: EdgeInsets.all(10),
              child: Text('Items', style: Theme.of(context).textTheme.headline),
          itemCount: widget.list.length,
          revealableHeight: 50,
          itemBuilder: (context, index) {
            SearchableListTile slt = widget.list[index];
            if (_filter != null && _filter.isNotEmpty) {
              if (slt.text.contains(_filter)) {
                return slt.buildHighlight(_filter);
              } else {
                return Container();

            return Slidable(
              key: ValueKey(index),
              actionPane: SlidableDrawerActionPane(),
              actions: <Widget>[
                  caption: 'Archive',
                  icon: Icons.archive,
                  caption: 'Share',
                  color: Colors.indigo,
                  icon: Icons.share,
              secondaryActions: <Widget>[
                  caption: 'More',
                  color: Colors.grey.shade200,
                  icon: Icons.more_horiz,
                  caption: 'Delete',
                  icon: Icons.delete,
              dismissal: SlidableDismissal(
                child: SlidableDrawerDismissal(),
              child: slt.buildNolight(),
          revealableBuilder: (BuildContext context, RevealableToggler opener,
              RevealableToggler closer, BoxConstraints constraints) {
            return Row(
              key: Key('scrollable-row'),
              children: <Widget>[
                SizedBox(width: 10),
                  child: TextFormField(
                    controller: searchController,
                    decoration: InputDecoration(
                      hintText: 'Search',
                      suffixIcon: Icon(,
                          color: Theme.of(context).backgroundColor),
                  icon: Icon(Icons.cancel),
                  onPressed: () {
                    // Handles closing the `Revealable`
                    closer(completer: RevealableCompleter.snap);
                    // Removes any filtering effects
                    searchController.text = '';
                    setState(() {
                      _filter = null;

  void dispose() {

  void initState() {
    searchController = TextEditingController();

  void _onSearch() {
    setState(() {
      _filter = searchController.text;


import 'package:flutter/material.dart';
import 'package:substring_highlight/substring_highlight.dart';

import 'searchable_slideable_list.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Searchable Slidable List Demo',
      theme: ThemeData(
      home: MyHomePage(),

class MyHomePage extends StatelessWidget {
  Widget build(BuildContext context) {
    List<SearchableListTile> list = s) {
      return SearchableListTile(
          buildHighlight: (String term) {
            return Container(
                padding: EdgeInsets.all(10),
                child: SubstringHighlight(term: term, text: "($s)"));
          buildNolight: () {
            return Container(padding: EdgeInsets.all(10), child: Text('$s'));
          text: s);

    return Scaffold(
      appBar: AppBar(
        title: Text('Flutter Searchable Slidable List Demo'),
      body: SearchableSlideableList(list: list),

const List<String> names = [

The flutter tutorial  is a website that bring you the latest and amazing resources of code. All the languages codes are included in this website. The languages like flutter, android, java,kotlin etc.with the help of this languages any user can develop the beautiful application

For more information about Flutter. visit