Skip to content

Commit c27130b

Browse files
PanteCopilot
andauthored
Fix misc issues (#647)
* Change vertical padding such that loading and empty are same height as item for FSelect & FMultiSelect * Change popover naming * Add onTapHide to all dependent widgets * Ops * Adjust mouse cursors for all widgets * Refactors field builders for improved flexibility Updates the field builders for `FDateField`, `FMultiSelect`, `FSelect`, `FTextField`, and `FTimeField` to provide more context and flexibility. Replaces `ValueWidgetBuilder` with `FFieldBuilder` and `FFieldIconBuilder` to provide style and state information. Updates content builders for `FSelect` and `FMultiSelect` to receive the query text. Renames builder parameters and removes typedefs to simplify the API. * Refactor select item * Update failing tests & fix no results found not centered in selects * Adjust progress color * Refactor FAutocompleteItem * Refactor select * Fix datefield & timefiled cursors * Prepare samples for review * Prepare Forui for review * Update windows-latest goldens * Update forui/lib/src/widgets/select/single/select.dart Co-authored-by: Copilot <[email protected]> * Update forui/lib/src/widgets/select/single/select.dart Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Pante <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 1086a85 commit c27130b

File tree

111 files changed

+1902
-1632
lines changed

Some content is hidden

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

111 files changed

+1902
-1632
lines changed

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

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ FAutocomplete(
6161
onSaved: (value) => print('Saved country: $value'),
6262
autovalidateMode: AutovalidateMode.onUserInteraction,
6363
builder: (context, styles, child) => child!,
64-
prefixBuilder: (context, styles, _) => Icon(FIcons.globe),
65-
suffixBuilder: (context, styles, _) => Icon(FIcons.search),
64+
prefixBuilder: (context, style, states) => Icon(FIcons.globe),
65+
suffixBuilder: (context, style, states) => Icon(FIcons.search),
6666
popoverConstraints: const FAutoWidthPortalConstraints(maxHeight: 400),
6767
clearable: (value) => value.text.isNotEmpty,
6868
initialText: 'Canada',
@@ -82,12 +82,12 @@ FAutocomplete(
8282

8383
```dart copy
8484
FAutocomplete.builder(
85-
filter: (query) async {
85+
filter: (text) async {
8686
const countries = ['United States', 'Canada', 'Japan'];
8787
return countries.where((country) => country.toLowerCase().contains(query.toLowerCase()));
8888
},
89-
contentBuilder: (context, query, suggestions) => [
90-
for (final suggestion in suggestions) FAutocompleteItem(suggestion)
89+
contentBuilder: (context, text, suggestions) => [
90+
for (final suggestion in suggestions) FAutocompleteItem(value: suggestion)
9191
],
9292
controller: FAutocompleteController(vsync: this),
9393
style: (style) => style,
@@ -98,8 +98,8 @@ FAutocomplete.builder(
9898
onSaved: (value) => print('Saved country: $value'),
9999
autovalidateMode: AutovalidateMode.onUserInteraction,
100100
builder: (context, styles, child) => child!,
101-
prefixBuilder: (context, styles, _) => Icon(FIcons.globe),
102-
suffixBuilder: (context, styles, _) => Icon(FIcons.search),
101+
prefixBuilder: (context, style, states) => Icon(FIcons.globe),
102+
suffixBuilder: (context, style, states) => Icon(FIcons.search),
103103
popoverConstraints: const FAutoWidthPortalConstraints(maxHeight: 300),
104104
clearable: (value) => value.text.isNotEmpty,
105105
);
@@ -125,26 +125,26 @@ FAutocomplete.builder(
125125
},
126126
contentBuilder: (context, query, suggestions) => [
127127
for (final suggestion in suggestions)
128-
switch (value) {
128+
switch (suggestion) {
129129
'Bug' => FAutocompleteItem(
130-
'Bug',
130+
value: 'Bug',
131131
prefix: const Icon(FIcons.bug),
132132
title: const Text('Bug'),
133133
subtitle: const Text('An unexpected problem or behavior'),
134134
),
135135
'Feature' => FAutocompleteItem(
136-
'Feature',
136+
value: 'Feature',
137137
prefix: const Icon(FIcons.filePlus2),
138138
title: const Text('Feature'),
139139
subtitle: const Text('A new feature or enhancement'),
140140
),
141141
'Question' => FAutocompleteItem(
142-
'Question',
142+
value: 'Question',
143143
prefix: const Icon(FIcons.messageCircleQuestionMark),
144144
title: const Text('Question'),
145145
subtitle: const Text('A question or clarification'),
146146
),
147-
_ => FAutocompleteItem(value),
147+
_ => FAutocompleteItem(suggestion),
148148
}
149149
],
150150
);
@@ -244,20 +244,20 @@ FAutocomplete.builder(
244244
return items.where((item) => item.toLowerCase().contains(query.toLowerCase()));
245245
},
246246
contentBuilder: (context, query, suggestions) => <FAutocompleteItemMixin>[
247-
FAutocompleteSection.custom(
247+
FAutocompleteSection.rich(
248248
label: const Text('Level 1'),
249249
divider: FItemDivider.indented,
250250
children: [
251-
if (suggestions.contains('1A')) FAutocompleteItem('1A'),
252-
if (suggestions.contains('1B')) FAutocompleteItem('1B'),
251+
if (suggestions.contains('1A')) FAutocompleteItem(value: '1A'),
252+
if (suggestions.contains('1B')) FAutocompleteItem(value: ''1B'),
253253
],
254254
),
255255
FAutocompleteSection(
256256
label: const Text('Level 2'),
257257
items: ['2A', '2B'].where(suggestions.contains).toList(),
258258
),
259-
if (suggestions.contains('3')) FAutocompleteItem('3'),
260-
if (suggestions.contains('4')) FAutocompleteItem('4'),
259+
if (suggestions.contains('3')) FAutocompleteItem(value: ''3'),
260+
if (suggestions.contains('4')) FAutocompleteItem(value: ''4'),
261261
].where((item) =>
262262
item is FAutocompleteSection ? item.children.isNotEmpty : true
263263
).toList(),
@@ -288,7 +288,7 @@ FAutocomplete.builder(
288288
return query.isEmpty ? fruits : fruits.where((fruit) => fruit.toLowerCase().startsWith(query.toLowerCase()));
289289
},
290290
contentBuilder: (context, query, suggestions) => [
291-
for (final suggestion in suggestions) FAutocompleteItem(suggestion)
291+
for (final suggestion in suggestions) FAutocompleteItem(value: suggestion)
292292
],
293293
);
294294
}
@@ -314,12 +314,12 @@ FAutocomplete.builder(
314314
await Future.delayed(const Duration(seconds: 3));
315315
return query.isEmpty ? fruits : fruits.where((fruit) => fruit.toLowerCase().startsWith(query.toLowerCase()));
316316
},
317-
contentLoadingBuilder: (context, style, _) => Padding(
317+
contentLoadingBuilder: (context, style) => Padding(
318318
padding: const EdgeInsets.all(14.0),
319319
child: Text('Here be dragons...', style: style.emptyTextStyle),
320320
),
321321
contentBuilder: (context, query, suggestions) => [
322-
for (final suggestion in suggestions) FAutocompleteItem(suggestion)
322+
for (final suggestion in suggestions) FAutocompleteItem(value: suggestion)
323323
],
324324
);
325325
}
@@ -344,7 +344,7 @@ FAutocomplete.builder(
344344
throw StateError('Error loading data');
345345
},
346346
contentBuilder: (context, query, suggestions) => [
347-
for (final suggestion in suggestions) FAutocompleteItem(suggestion)
347+
for (final suggestion in suggestions) FAutocompleteItem(value: suggestion)
348348
],
349349
contentErrorBuilder: (context, error, trace) {
350350
return Padding(

docs/app/docs/form/date-field/page.mdx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ FDateField(
7979
mouseCursor: SystemMouseCursors.text,
8080
canRequestFocus: true,
8181
baselineInputYear: 2000,
82-
builder: (context, styles, child) => child!,
83-
prefixBuilder: (context, styles, child) => Icon(Icons.calendar_today),
84-
suffixBuilder: null,
82+
builder: (context, style, states, child) => child!,
83+
prefixBuilder: (context, style, states) => Icon(Icons.calendar_today),
84+
suffixBuilder: (context, style, states) => Icon(Icons.calendar_today),
8585
clearable: true,
8686
calendar: FDateFieldCalendarProperties(),
8787
label: Text('Select Date'),
@@ -124,12 +124,12 @@ FDateField.calendar(
124124
spacing: FPortalSpacing(4),
125125
shift: FPortalShift.flip,
126126
offset: Offset.zero,
127-
hideOnTapOutside: FHidePopoverRegion.none,
127+
hideRegion: FPopoverHideRegion.none,
128128
label: Text('Calendar Date'),
129129
description: Text('Select a date from the calendar'),
130-
builder: (context, styles, child) => child!,
131-
prefixBuilder: (context, styles, child) => Icon(Icons.calendar_today),
132-
suffixBuilder: null,
130+
builder: (context, style, states, child) => child!,
131+
prefixBuilder: (context, style, states) => Icon(Icons.calendar_today),
132+
suffixBuilder: (context, style, states) => Icon(Icons.calendar_today),
133133
forceErrorText: null,
134134
errorBuilder: (context, error) => Text(error, style: TextStyle(color: Colors.red)),
135135
);
@@ -161,12 +161,12 @@ FDateField.input(
161161
autoHide: true,
162162
anchor: Alignment.topLeft,
163163
inputAnchor: Alignment.bottomLeft,
164-
hideOnTapOutside: FHidePopoverRegion.none,
164+
hideRegion: FPopoverHideRegion.none,
165165
label: Text('Calendar Date'),
166166
description: Text('Select a date from the calendar'),
167-
builder: (context, styles, child) => child!,
168-
prefixBuilder: (context, styles, child) => Icon(Icons.calendar_today),
169-
suffixBuilder: null,
167+
builder: (context, style, states, child) => child!,
168+
prefixBuilder: (context, style, states) => Icon(Icons.calendar_today),
169+
suffixBuilder: (context, style, states) => Icon(Icons.calendar_today),
170170
forceErrorText: null,
171171
errorBuilder: (context, error) => Text(error, style: TextStyle(color: Colors.red)),
172172
);

0 commit comments

Comments
 (0)