Skip to main content

search_anchor_picker 0.2.3 copy "search_anchor_picker: ^0.2.3" to clipboard
search_anchor_picker: ^0.2.3 copied to clipboard

A searchable Flutter picker with multi or single selection, nested sub-pickers, and async save callbacks that roll back on failure.

example/example.dart

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

void main() => runApp(const ExampleApp());

/// Minimal SearchAnchorPicker usage for pub.dev.
class ExampleApp extends StatefulWidget {
  /// Creates the example app.
  const ExampleApp({super.key});

  @override
  State<ExampleApp> createState() => _ExampleAppState();
}

class _ExampleAppState extends State<ExampleApp> {
  final _selected = <int>{};
  final _config = PickerConfig<int>(
    itemsLoader: (_, _) async => [1, 2, 3],
    idOf: (id) => id,
    labelOf: (id) => 'Item $id',
  );

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: SearchAnchorPicker<int>(
            config: _config,
            initialSelectedIds: _selected.toList(),
            onClose: (result) {
              setState(() {
                _selected
                  ..addAll(result.added)
                  ..removeAll(result.removed);
              });
            },
          ),
        ),
      ),
    );
  }
}
1
likes
160
points
608
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A searchable Flutter picker with multi or single selection, nested sub-pickers, and async save callbacks that roll back on failure.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter

More

Packages that depend on search_anchor_picker