Skip to content

Commit

Permalink
Include footer items in auto-suggest and cleanup construction.
Browse files Browse the repository at this point in the history
  • Loading branch information
ignatz committed Jan 30, 2024
1 parent aa6df52 commit 577383f
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -493,21 +493,14 @@ class _MyHomePageState extends State<MyHomePage> with WindowListener {
controller: searchController,
unfocusedColor: Colors.transparent,
// also need to include sub items from [PaneItemExpander] items
items: <PaneItem>[
...paneItems
.whereType<PaneItemExpander>()
.expand<PaneItem>((item) {
return [
item,
...item.items.whereType<PaneItem>(),
];
}),
...paneItems
.where(
(item) => item is PaneItem && item is! PaneItemExpander,
)
.cast<PaneItem>(),
].map((item) {
items: paneItems.followedBy(footerItems).expand<PaneItem>((item) {
if (item is PaneItemExpander) {
return item.items.whereType<PaneItem>();
} else if (item is PaneItem) {
return [item];
}
return [];
}).map((item) {
assert(item.title is Text);
final text = (item.title as Text).data!;
return AutoSuggestBoxItem(
Expand Down

0 comments on commit 577383f

Please sign in to comment.