search_select 1.0.12 copy "search_select: ^1.0.12" to clipboard
search_select: ^1.0.12 copied to clipboard

A Flutter dropdown for search select and multi-select functionality widget.

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      darkTheme: ThemeData.dark(),
      home: Scaffold(
        appBar: AppBar(title: const Text('Search Select Example')),
        body: Padding(
          padding: const EdgeInsets.all(8.0),
          child: SingleChildScrollView(
            child: Column(
              children: [
                SizedBox(
                  width: 400,
                  child: SearchSelect<String>(
                    itemsStyleType: ItemsStyleType.chip,
                    items: [
                      "item 01",
                      "item 02",
                      "item 03",
                      "item 04",
                      "item 05",
                      "item 06",
                      "item 07",
                      "item 08",
                    ],
                    label: 'Multiple selection',
                    allowMultiple: false,
                    selectedItems: [],
                    validator: (v) {
                      if (v.isEmpty) return 'Please select at least one item';
                      return null;
                    },
                    searchAsync: (q) async {
                      await Future.delayed(const Duration(seconds: 1));
                      return [
                        "item 01",
                        "item 02",
                        "item 03",
                        "item 04",
                        "item 05",
                        "item 06",
                        "item 07",
                        "item 08",
                      ].where((element) => element.contains(q)).toList();
                    },
                    loading: false,
                    onChange: (values) {
                      // change your variable list here
                    },
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
4
likes
160
points
66
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter dropdown for search select and multi-select functionality widget.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on search_select