-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DropdownFieldBlocBuilder with search #64
Comments
Hello, you can use any widget with form_bloc easily, please find one and I will gladly tell you how, maybe in the future I will integrate one. |
thank you for your feedback |
Hello, for the moment I will not integrate them, in future versions when the internal API improves a little it will be easier to add widgets :) But it is quite simple, just do the following steps:
If you want to reuse it, just add the parameters you need dependencies:
select_dialog: ^1.0.7 class SelectDialogFieldBlocBuilder<Value> extends StatelessWidget {
const SelectDialogFieldBlocBuilder({
Key key,
@required this.selectFieldBloc,
}) : super(key: key);
final SelectFieldBloc<Value, Object> selectFieldBloc;
@override
Widget build(BuildContext context) {
return BlocBuilder<SelectFieldBloc, SelectFieldBlocState>(
bloc: selectFieldBloc,
builder: (context, state) {
return GestureDetector(
child: InputDecorator(
decoration: InputDecoration(
labelText: 'Dropdown with search',
errorText: state.canShowError
? FieldBlocBuilder.defaultErrorBuilder(
context,
state.error,
selectFieldBloc,
)
: null,
),
child: Text(state?.value ?? ''),
),
onTap: () {
SelectDialog.showModal<Value>(
context,
label: "Select an option",
selectedValue: state.value,
items: state.items,
onChange: selectFieldBloc.updateValue,
searchBoxDecoration: InputDecoration(
hintText: 'Awesome hint',
),
);
},
);
},
);
}
} class MyFormBloc extends FormBloc<String, String> {
final select1 = SelectFieldBloc(
items: ['Option 1', 'Option 2'],
);
//...
} ...
build...
SelectDialogFieldBlocBuilder(
selectFieldBloc: formBloc.select1,
),
... If you create or find any awesome widget in pub, create a request to add support for it :) |
thank you a lot, you are the best |
Hello
thank you a lot for this project
please can you add search to the DropdownField
thank you
The text was updated successfully, but these errors were encountered: