Skip to content

Commit c1c935e

Browse files
authored
Add autocomplete (#640)
* Tweak tabs & multiselect * WIP autocomplete * Working prototype * Add typeahead support * Tab to complete * Overhaul typeahead controller * Further simplify implementation * Add amazing stuff * Add typeahead controller tests * Example * Update localization * Add autocomplete tests * Add autocomplete controller hook * Add autocomplete docs * Fix failing tests * Fix link checking * Commit from GitHub Actions (Forui Hooks Presubmit) * Prepare Forui for review * Update windows-latest goldens * Fix failing build * Update localizations --------- Co-authored-by: Pante <[email protected]>
1 parent 55dbe4f commit c1c935e

File tree

295 files changed

+4572
-302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

295 files changed

+4572
-302
lines changed

docs/app/docs/form/autocomplete/page.mdx

Lines changed: 448 additions & 0 deletions
Large diffs are not rendered by default.

docs/app/docs/overlay/popover-menu/page.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ FPopoverMenu(
7777
offset: Offset.zero,
7878
groupId: 'popover-menu-group',
7979
hideOnTapOutside: FHidePopoverRegion.excludeTarget,
80+
onTapHide: () {},
8081
traversalEdgeBehavior: TraversalEdgeBehavior.closedLoop,
8182
menuBuilder: (context, controller, menu) => [FItemGroup(children: [])],
8283
menu: [

docs/app/docs/overlay/popover/page.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ FPopover(
9393
offset: Offset.zero,
9494
groupId: 'popover-group',
9595
hideOnTapOutside: FHidePopoverRegion.excludeTarget,
96+
onTapHide: () {},
9697
popoverBuilder: (context, controller) => const Placeholder(),
9798
builder: (context, controller, child) => const Placeholder(),
9899
child: const Placeholder(),

forui/CHANGELOG.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 0.15.0
1+
## 0.15.0 (Next)
22

33
### Consistent Controllers
44
We've done a pass over the controllers in Forui to make them more consistent and easier to use.
@@ -16,6 +16,14 @@ We've done a pass over the controllers in Forui to make them more consistent and
1616
* **Breaking** Remove `FAccordionController.validate(...)`.
1717

1818

19+
## `FAutocomplete` (new)
20+
* Add `FAutocomplete`.
21+
* Add `FAutocompleteController`.
22+
* Add `FAutocompleteStyle`.
23+
* Add `FAutocompleteSection`.
24+
* Add `FAutocompleteItem`.
25+
26+
1927
### `FMultiSelect` (new)
2028
* Add `FMultiSelect`.
2129
* Add `FMultiSelectController`.
@@ -24,15 +32,19 @@ We've done a pass over the controllers in Forui to make them more consistent and
2432

2533

2634
### Others
35+
* Add `FTypeaheadController`.
36+
* Add `FPopover.onTapHide`.
37+
* Add `FPopoverMenu.onTapHide`.
38+
2739
* Rename `FSelect.divider` to `FSelect.contentDivider`.
2840
* Change `FMultiValueNotifier` to be non-abstract.
29-
* Change `FTappableStyle.mouseCursor` to `MouseCursor.defer`. See https://ux.stackexchange.com/questions/105024/why-dont-button-html-elements-have-a-css-cursor-pointer-by-default
41+
* **Breaking** Change `FTappableStyle.mouseCursor` to `MouseCursor.defer`. See https://ux.stackexchange.com/questions/105024/why-dont-button-html-elements-have-a-css-cursor-pointer-by-default
3042
for our rationale behind this change.
3143

3244
* Fix `FTabs` throwing an assertion error if `FTabController` is provided with a `initialIndex` > 0.
3345

3446

35-
### 0.14.1
47+
## 0.14.1
3648
* Fix `FToaster`sometimes crashing due to an incorrect update of a late final variable.
3749

3850

forui/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,14 @@ Forui provides the following widgets:
6868
- Resizable
6969
- Scaffold
7070
- Form
71+
- Autocomplete
7172
- Button
7273
- Checkbox
7374
- Date Field
7475
- Label
7576
- Picker
7677
- Radio
78+
- Multi-select
7779
- Select
7880
- Select Group
7981
- Slider

forui/bin/commands/style/style.dart

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

forui/example/lib/sandbox.dart

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import 'package:flutter/material.dart';
22
import 'package:forui/forui.dart';
33

4+
const features = ['Keyboard navigation', 'Typeahead suggestions', 'Tab to complete'];
5+
46
class Sandbox extends StatefulWidget {
57
const Sandbox({super.key});
68

@@ -28,28 +30,7 @@ class _SandboxState extends State<Sandbox> with SingleTickerProviderStateMixin {
2830
@override
2931
Widget build(BuildContext context) {
3032
return Center(
31-
child: FTabs(
32-
controller: c,
33-
initialIndex: 0,
34-
children: [
35-
FTabEntry(
36-
label: const Text('Account'),
37-
child: FCard(
38-
title: const Text('Account'),
39-
subtitle: const Text('Make changes to your account here. Click save when you are done.'),
40-
child: Container(color: Colors.blue, height: 100),
41-
),
42-
),
43-
FTabEntry(
44-
label: const Text('Password'),
45-
child: FCard(
46-
title: const Text('Password'),
47-
subtitle: const Text('Change your password here. After saving, you will be logged out.'),
48-
child: Container(color: Colors.red, height: 100),
49-
),
50-
),
51-
],
52-
),
33+
child: FAutocomplete(label: Text('Autocomplete'), hint: 'What can it do?', items: features),
5334
);
5435
}
5536
}

forui/lib/forui.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export 'localizations.dart';
77
export 'theme.dart';
88

99
export 'widgets/accordion.dart';
10+
export 'widgets/autocomplete.dart';
1011
export 'widgets/alert.dart';
1112
export 'widgets/avatar.dart';
1213
export 'widgets/badge.dart';

forui/lib/foundation.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export 'src/foundation/notifiers.dart';
1111
export 'src/foundation/rendering.dart' hide Alignments, DefaultData, RenderBoxes;
1212
export 'src/foundation/tappable.dart' hide AnimatedTappable, AnimatedTappableState;
1313
export 'src/foundation/time.dart';
14+
export 'src/foundation/typeahead_controller.dart';
1415
export 'src/foundation/portal/portal.dart';
1516
export 'src/foundation/portal/portal_constraints.dart' hide FixedConstraints;
1617
export 'src/foundation/portal/portal_shift.dart';

forui/lib/l10n/f_af.arb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@
2222
"paginationPreviousSemanticsLabel": "Vorige",
2323
"paginationNextSemanticsLabel": "Volgende",
2424
"popoverSemanticsLabel": "Opspringer",
25-
"multiSelectHint": "Kies items"
25+
"multiSelectHint": "Kies items",
26+
"autocompleteNoResults": "Geen resultate gevind nie."
2627
}

0 commit comments

Comments
 (0)