The suggestions in ListTile of typeaheadformfield works out of the bottomsheet, but it doesn't work inside the bottomsheet.i have already passed the context to the bottomheet,it fetchs the suggestions from the callback but it doesn't render inside bottomsheet. i checked it out the bottomsheet and it returns the suggestions.
void _postModals(context) {
showModalBottomSheet(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(25.0))),
backgroundColor: Colors.white,
context: context,
isScrollControlled: true,
builder: (context) => Padding(
padding: const EdgeInsets.symmetric(horizontal: 18),
child: Obx(() => Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
const SizedBox(
height: 18.0,
),
Padding(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom),
child: Container(
height: 400,
child: Form(
key: postController.CaptionForm,
child: Column(
children: [
Expanded(
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: TypeAheadFormField<User?>(
hideOnEmpty: true,
textFieldConfiguration:
TextFieldConfiguration(
controller: postController
.captionController,
decoration:
const InputDecoration.collapsed(
hintText: 'put users',
hintStyle: TextStyle(
fontSize: 15,
)),
),
suggestionsCallback:
RemoteServices.fetchFollowers,
itemBuilder:
(context, User? suggestion) {
final user = suggestion!;
return ListTile(
title: Text(user.name),
);
},
onSuggestionSelected:
(User? suggestion) {
final user = suggestion;
ScaffoldMessenger.of(context)
..removeCurrentSnackBar()
..showSnackBar(SnackBar(
content: Text(
'Selected user: ${user!.name}'),
));
},
validator: (value) {
return postController
.validateCaption(value!);
},
),
),
SizedBox(
height: 40,
),
],
),
),
],
),
),
),
),
],
)),
));
}