A TypeAhead widget for Flutter, where you can show suggestions to users as they type
BSD 2-Clause "Simplified" License
831
stars
349
forks
source link
how to use suggestion controller want to display data list when user just focus on text box #578
Closed
VimarsSpaceo closed 7 months ago
Steps to reproduce
cant able to use suggestion controller
Expected results
-
Actual results
Package Version
5.1.0
Platform
Android, iOS
Code sample
TypeAheadField(
suggestionsCallback: (search) {
controller.searchText.value = search;
return controller.searchedUserList;
},
builder: (context, controller, focusNode) {
return CommonAppInputOutlined(
textEditingController: controller,
focusNode: focusNode,
borderRadius: 8,
hintText: LocaleKeys.searchByNameOrEmail.tr,
prefixIcon: Assets.images.icSearch,
);
},
hideOnEmpty: true,
suggestionsController: ,
controller: controller.searchController,
debounceDuration: const Duration(milliseconds: 1000),
itemBuilder: (context, item) {
return Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: 32.w,
width: 32.w,
child: CircleAvatar(
backgroundColor: Colors.primaries[Random().nextInt(14)],
child: Text(
item.fullName![0].toUpperCase(),
style: regularMuliTextStyle(
fontSize: fontSize14,
color: AppColors.colorWhite,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
),
12.horizontalSpace,
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
item.fullName ?? '',
style: regularMuliTextStyle(
fontSize: fontSize16,
color: AppColors.color1D1D1D,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Text(
item.email ?? '',
style: regularMuliTextStyle(
fontSize: fontSize12,
color: AppColors.color5D5D5D,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
)
],
),
),
Text(
LocaleKeys.invite.tr,
style: regularMuliTextStyle(color: AppColors.color1D1D1D, fontSize: fontSize12),
)
],
).paddingSymmetric(vertical: 8.h, horizontal: 12.w);
},
decorationBuilder: (context, child) {
return Material(
type: MaterialType.card,
elevation: 4,
color: AppColors.colorWhite,
borderRadius: BorderRadius.circular(8),
child: child,
);
},
constraints: const BoxConstraints(maxHeight: 350),
onSelected: (item) {
controller
.inviteMemberToBoard(InviteBoardDTO(boardUuid: controller.appDataModel.udid ?? '', toUuid: item.uuid));
Utils.closeKeyboard();
},
),
Logs
Logs
```console [Paste your logs here] ```Screenshots or Video
Screenshots / Video demonstration
[Upload media here]