content: 
  import 'package:flutter/material.dart';
  
  class CustomSearchDelegate extends SearchDelegate {
  
    List<String> searchTerms = [
      //Example
      'Game',
      "Iphone",
      //...
    ];
  
  
  // clear the search text
    @override
    List<Widget>? buildActions(BuildContext context) {
      return [
        IconButton(
          onPressed: () {
            query = '';
          },
          icon: const Icon(Icons.clear),
        ),
      ];
    }
  
  // biron omadan
    @override
    Widget? buildLeading(BuildContext context) {
      return IconButton(
        onPressed: () {
          close(context, null);
        },
        icon: const Icon(Icons.arrow_back),
      );
    }
  
  // third overwrite to show query result
    @override
    Widget buildResults(BuildContext context) {
      List<String> matchQuery = [];
      for (var item in searchTerms) {
        if (item.toLowerCase().contains(query.toLowerCase())) {
          matchQuery.add(item);
        }
      }
      return ListView.builder(
        itemCount: matchQuery.length,
        itemBuilder: (context, index) {
          var result = matchQuery[index];
          return ListTile(
            title: Text(result),
          );
        },
      );
    }
  
  //runtime show result
    @override
    Widget buildSuggestions(BuildContext context) {
      List<String> matchQuery = [];
      for (var item in searchTerms) {
        if (item.toLowerCase().contains(query.toLowerCase())) {
          matchQuery.add(item);
        }
      }
      return ListView.builder(
        itemCount: matchQuery.length,
        itemBuilder: (context, index) {
          var result = matchQuery[index];
          return ListTile(
            title: Text(result),
          );
        },
      );
    }
  }
  