Skip to content

Commit b5100e3

Browse files
fix: update form validators setup
1 parent a86bf42 commit b5100e3

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

example/lib/main.dart

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class MyApp extends StatelessWidget {
2222
GlobalMaterialLocalizations.delegate,
2323
GlobalWidgetsLocalizations.delegate,
2424
],
25-
supportedLocales: FormBuilderLocalizations.delegate.supportedLocales,
25+
supportedLocales: const [Locale('en')],
2626
home: const MyHomePage(),
2727
);
2828
}
@@ -72,16 +72,25 @@ class _MyHomePageState extends State<MyHomePage> {
7272
),
7373
),
7474
FormBuilderSearchableDropdown<String>(
75-
popupProps: const PopupProps.menu(showSearchBox: true),
75+
popupProps: PopupProps.dialog(
76+
showSelectedItems: true,
77+
showSearchBox: true,
78+
isFilterOnline: true,
79+
),
80+
autoValidateMode: AutovalidateMode.onUserInteraction,
7681
dropdownSearchDecoration: const InputDecoration(
7782
hintText: 'Search',
7883
labelText: 'Search',
7984
),
8085
name: 'searchable_dropdown_offline',
8186
items: allCountries,
87+
clearButtonProps: ClearButtonProps(icon: Icon(Icons.close)),
8288
onChanged: _onChanged,
8389
decoration: const InputDecoration(
8490
labelText: 'Searchable Dropdown Offline'),
91+
validator: FormBuilderValidators.compose([
92+
FormBuilderValidators.required(),
93+
]),
8594
filterFn: (country, filter) =>
8695
country.toLowerCase().contains(filter.toLowerCase()),
8796
),

0 commit comments

Comments
 (0)