smart_text_search 0.0.1 copy "smart_text_search: ^0.0.1" to clipboard
smart_text_search: ^0.0.1 copied to clipboard

A powerful search plugin with efficient and accurate capabilities like 'Google Search' and 'Elasticsearch'. Operates on cached local data for fast and secure searching. Features advanced typo toleranc [...]

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:smart_text_search/smart_text_search/sort_by_similarity.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final TextEditingController _searchTextController = TextEditingController();

  final List<String> items = [
    'Apple',
    'Banana',
    'Orange',
    'Strawberry',
    'Grapes',
    'Watermelon',
    'Mango',
    'Pineapple',
    'Kiwi',
    'Peach',
    'Pear',
    'Cherry',
    'Blueberry',
    'Raspberry',
    'Lemon',
    'Lime',
    'Avocado',
    'Coconut',
    'Pomegranate',
    'Blackberry',
    'Cantaloupe',
    'Mandarin',
    'Papaya',
    'Apricot',
    'Guava',
    'Passion Fruit',
    'Plum',
    'Fig',
    'Lychee',
    'Cranberry',
    'Dragon Fruit',
    'Kiwifruit',
    'Star Fruit',
    'Persimmon',
    'Nectarine',
    'Tangerine',
    'Grapefruit',
    'Jackfruit',
    'Mulberry',
    'Pawpaw',
    'Quince',
    'Clementine',
    'Honeydew',
    'Blackcurrant',
    'Elderberry',
    'Date',
    'Rambutan',
    'Soursop',
    'Carambola',
    'Cactus Fruit'
  ];

  List<String> listToView = [];

  @override
  void initState() {
    super.initState();
    listToView = items;
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: ListView(
          children: [
            TextField(
              controller: _searchTextController,
            ),
            IconButton(
              onPressed: _onSearch, 
              icon: const Icon(Icons.search),
            ),
            ...listToView.map<Widget>(
              (e) => ListTile(
                title: Text(e),
              ),
            ),
          ],
        ),
      ),
    );
  }

  _onSearch(){
    List<String> searchResults = orderBySimilarity(
      _searchTextController.text, 
      items, 
      (index, item) => item
    );
    setState(() {
      listToView = searchResults;
    });
  }
}
5
likes
140
pub points
65%
popularity

Publisher

verified publishersolapps.com.br

A powerful search plugin with efficient and accurate capabilities like 'Google Search' and 'Elasticsearch'. Operates on cached local data for fast and secure searching. Features advanced typo tolerance and word similarity recognition for enhanced results.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on smart_text_search