ianldgs / material_search

https://pub.dartlang.org/packages/material_search
MIT License
75 stars 39 forks source link

update for MaterialSearchResult #34

Open ahmdrz opened 6 years ago

ahmdrz commented 6 years ago

Hi, I think this code down here is more customized.

ahmdrz commented 6 years ago
_buildMaterialSearchPage(BuildContext context) {
    return new MaterialPageRoute<String>(
        settings: new RouteSettings(
          name: 'material_search',
          isInitialRoute: false,
        ),
        builder: (BuildContext context) {
          return new Material(
            child: new MaterialSearch<String>(
              placeholder: 'Search',
              results: list
                  .map(
                    (String s) => new MaterialSearchResult<String>(
                          widget: ListTile(
                            subtitle: Text("Hello from subtitle"),
                            leading: Icon(Icons.dehaze),
                            title: Text("Hello"),
                          ),
                          value: s,
                        ),
                  )
                  .toList(),
              filter: (dynamic value, String criteria) {
                ...
              },
              onSelect: (dynamic value) {
                ...
              },
              onSubmit: (dynamic value) {},
            ),
          );
        });
  }

Here is an example how to use that.

ianldgs commented 6 years ago

Will check this later today, but loved the idea!

ahmdrz commented 6 years ago

Heeelloo ? :)))