Skip to content

Commit 83a446f

Browse files
PanteCopilot
andauthored
Add multi select (#628)
* Add basic layout for multi-select * First working prototype * Add tests * Improve FMultiSelectTag * Add docs * Prepare Forui for review * Update macos-latest goldens * Update windows-latest goldens * Update forui_hooks/lib/src/select_controller_hook.dart Co-authored-by: Copilot <[email protected]> * Fix PR issues * Update windows-latest goldens * Refine FMultiSelect --------- Co-authored-by: Pante <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 5227cb2 commit 83a446f

File tree

304 files changed

+4776
-432
lines changed

Some content is hidden

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

304 files changed

+4776
-432
lines changed

docs/app/docs/form/multi-select/page.mdx

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

docs/app/docs/form/select/page.mdx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ It is a form-field and can therefore be used in a form.
1414
</LinkBadgeGroup>
1515

1616
<Callout type="info">
17+
For multi selections, consider using a [multi select](/docs/form/multi-select).
18+
1719
For touch devices, a [select tile group](/docs/tile/select-tile-group) or
1820
[select menu tile](/docs/tile/select-menu-tile) is generally recommended over this.
1921
</Callout>
@@ -75,16 +77,15 @@ FSelect<String>(
7577
description: const Text('Select your country of residence'),
7678
hint: 'Choose a country',
7779
format: (value) => value.toUpperCase(),
78-
divider: FItemDivider.none,
7980
onChange: (value) => print('Selected country: $value'),
8081
onSaved: (value) => print('Saved country: $value'),
81-
style: FSelectStyle.inherit(...),
8282
autovalidateMode: AutovalidateMode.onUserInteraction,
8383
builder: (context, styles, child) => child!,
8484
prefixBuilder: (context, styles, _) => Icon(FIcons.globe),
8585
suffixBuilder: (context, styles, _) => Icon(FIcons.arrowDown),
8686
popoverConstraints: const FAutoWidthPortalConstraints(maxHeight: 400),
8787
clearable: true,
88+
contentDivider: FItemDivider.none,
8889
contentScrollHandles: true,
8990
initialValue: 'ca',
9091
children: [
@@ -148,13 +149,13 @@ FSelect<User>.search(
148149
description: const Text('Search and select a user'),
149150
builder: (context, styles, child) => child!,
150151
format: (user) => '${user.firstName} ${user.lastName}',
151-
divider: FItemDivider.none,
152152
hint: 'Search users...',
153153
popoverConstraints: const FAutoWidthPortalConstraints(maxHeight: 400),
154154
clearable: true,
155155
autoHide: false,
156156
onChange: (value) => print('Selected country: $value'),
157157
initialValue: 'value',
158+
contentDivider: FItemDivider.none,
158159
contentScrollHandles: false,
159160
contentPhysics: const BouncingScrollPhysics(),
160161
emptyBuilder: (context, style, _) => Text('No results'),
@@ -191,13 +192,13 @@ FSelect<User>.searchFromMap(
191192
description: const Text('Search and select a user'),
192193
builder: (context, styles, child) => child!,
193194
format: (user) => '${user.firstName} ${user.lastName}',
194-
divider: FItemDivider.none,
195195
hint: 'Search users...',
196196
popoverConstraints: const FAutoWidthPortalConstraints(maxHeight: 400),
197197
clearable: true,
198198
autoHide: false,
199199
onChange: (value) => print('Selected country: $value'),
200200
initialValue: 'value',
201+
contentDivider: FItemDivider.none,
201202
contentScrollHandles: false,
202203
contentPhysics: const BouncingScrollPhysics(),
203204
emptyBuilder: (context, style, _) => Text('No results'),
@@ -359,7 +360,7 @@ FSelect<User>.searchFromMap(
359360
@override
360361
Widget build(BuildContext context) => FSelect<String>(
361362
hint: 'Select a level',
362-
divider: FItemDivider.full,
363+
contentDivider: FItemDivider.none,
363364
format: (s) => s,
364365
children: [
365366
FSelectSection.fromMap(
@@ -639,7 +640,7 @@ FSelect<User>.searchFromMap(
639640
child: const Text('Submit'),
640641
onPress: () {
641642
if (_formKey.currentState!.validate()) {
642-
// Form is valid, do something with department.e
643+
// Form is valid, do something with department.
643644
}
644645
},
645646
),

forui/CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## 0.15.0
2+
3+
### `FMultiSelect` (new)
4+
* Add `FMultiSelect`.
5+
* Add `FMultiSelectController`.
6+
* Add `FMultiSelectStyle`.
7+
* Add `FMultiSelectTag`.
8+
9+
10+
### Others
11+
* Rename `FSelect.divider` to `FSelect.contentDivider`.
12+
* Change `FMultiValueNotifier` to be non-abstract.
13+
14+
115
### 0.14.1
216
* Fix `FToaster`sometimes crashing due to an incorrect update of a late final variable.
317

forui/bin/commands/style/style.dart

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

forui/example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@
470470
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
471471
CLANG_ENABLE_MODULES = YES;
472472
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
473-
DEVELOPMENT_TEAM = F6D9JYCK3Z;
473+
DEVELOPMENT_TEAM = TKQ634K5JU;
474474
ENABLE_BITCODE = NO;
475475
INFOPLIST_FILE = Runner/Info.plist;
476476
LD_RUNPATH_SEARCH_PATHS = (
@@ -653,7 +653,7 @@
653653
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
654654
CLANG_ENABLE_MODULES = YES;
655655
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
656-
DEVELOPMENT_TEAM = F6D9JYCK3Z;
656+
DEVELOPMENT_TEAM = TKQ634K5JU;
657657
ENABLE_BITCODE = NO;
658658
INFOPLIST_FILE = Runner/Info.plist;
659659
LD_RUNPATH_SEARCH_PATHS = (
@@ -676,7 +676,7 @@
676676
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
677677
CLANG_ENABLE_MODULES = YES;
678678
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
679-
DEVELOPMENT_TEAM = F6D9JYCK3Z;
679+
DEVELOPMENT_TEAM = TKQ634K5JU;
680680
ENABLE_BITCODE = NO;
681681
INFOPLIST_FILE = Runner/Info.plist;
682682
LD_RUNPATH_SEARCH_PATHS = (

forui/example/lib/sandbox.dart

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,6 @@ class _SandboxState extends State<Sandbox> with SingleTickerProviderStateMixin {
2727

2828
@override
2929
Widget build(BuildContext context) {
30-
return Center(
31-
child: FSelect<String>(
32-
divider: FItemDivider.full,
33-
format: (s) => s,
34-
children: [
35-
FSelectSection.fromMap(
36-
label: const Text('Group 1'),
37-
divider: FItemDivider.indented,
38-
items: {
39-
for (final item in ['1A', '1B']) item: item,
40-
},
41-
),
42-
FSelectSection.fromMap(
43-
label: const Text('Group 2'),
44-
items: {
45-
for (final item in ['2A', '2B']) item: item,
46-
},
47-
),
48-
FSelectItem('Item 3', 'Item 3'),
49-
FSelectItem('Item 4', 'Item 4'),
50-
],
51-
),
52-
);
30+
return Center(child: FMultiSelect<String>.fromMap(const {'1': '1', '2': '2', '3': '3', '4': '4'}));
5331
}
5432
}

forui/example/macos/Runner/DebugProfile.entitlements

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
<true/>
77
<key>com.apple.security.cs.allow-jit</key>
88
<true/>
9+
<key>com.apple.security.network.client</key>
10+
<true/>
911
<key>com.apple.security.network.server</key>
1012
<true/>
1113
</dict>

forui/lib/l10n/f_af.arb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@
2121
"selectScrollDownSemanticsLabel": "Rol af",
2222
"paginationPreviousSemanticsLabel": "Vorige",
2323
"paginationNextSemanticsLabel": "Volgende",
24-
"popoverSemanticsLabel": "Opspringer"
24+
"popoverSemanticsLabel": "Opspringer",
25+
"multiSelectHint": "Kies items"
2526
}

forui/lib/l10n/f_am.arb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@
2121
"selectScrollDownSemanticsLabel": "ወደ ታች ሸብልል",
2222
"paginationPreviousSemanticsLabel": "ቀዳሚ",
2323
"paginationNextSemanticsLabel": "ቀጣይ",
24-
"popoverSemanticsLabel": "ፖፖቨር"
24+
"popoverSemanticsLabel": "ፖፖቨር",
25+
"multiSelectHint": "ንጥሎች ይምረጡ"
2526
}

forui/lib/l10n/f_ar.arb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@
2020
"selectScrollDownSemanticsLabel": "التمرير لأسفل",
2121
"paginationPrevious": "السابق",
2222
"paginationNext": "التالي",
23-
"popoverSemanticsLabel": "منبثقة"
23+
"popoverSemanticsLabel": "منبثقة",
24+
"multiSelectHint": "حدد العناصر"
2425
}

0 commit comments

Comments
 (0)