AbdulRahmanAlHamali / flutter_typeahead

A TypeAhead widget for Flutter, where you can show suggestions to users as they type
BSD 2-Clause "Simplified" License
820 stars 342 forks source link

[Bug] Drop frame in 5.x.x version #590

Open ThanhPhungTien opened 4 months ago

ThanhPhungTien commented 4 months ago

Steps to reproduce

  1. I used version 4.7.0 before and everything work fine.
  2. I upgrade package to 5.2.0 and the UI drop frame when it render the view has TypeAheadField

Expected results

Smooth like before

Actual results

The UI become lagging

Package Version

5.2.0

Platform

Android, iOS

Code sample

Code sample ```dart TypeAheadField( focusNode: widget.focusNode, controller: widget.controller, builder: (context, controller, focusNode) => TextFormField( decoration: _inputDecoration(), style: AppTextStyles.body( color: widget.enabled ? AppColors.text : AppColors.disable, ), controller: controller, maxLines: 3, minLines: 1, inputFormatters: _getInputFormatter(), keyboardType: widget.keyboardType, enabled: widget.enabled, focusNode: focusNode, textInputAction: TextInputAction.done, autovalidateMode: AutovalidateMode.onUserInteraction, onSaved: (value) => _onSaved(value), validator: (value) { String? error = _validate(value); _hasError = error != null; return error; }, ), debounceDuration: const Duration(milliseconds: 200), onSelected: _onSuggestionSelected, itemBuilder: (_, suggestion) => ItemSuggestionWidget( previousText: _previousText, suggestion: suggestion, ), itemSeparatorBuilder: (context, index) => const Divider( height: 0.5, thickness: 0.5, color: AppColors.onSecondaryContainer, ), suggestionsCallback: (String pattern) async { if (pattern == _previousText && !_hasError) { return []; } pattern = pattern.trim(); if (pattern.isNullOrEmpty || pattern.length < 2) { return []; } await bloc.query(pattern); return bloc.state.suggestions; }, direction: widget.suggestionDirection, hideOnEmpty: true, retainOnLoading: false, ) ```

Logs

Logs ```console [Paste your logs here] ```

Screenshots or Video

Screenshots / Video demonstration https://github.com/AbdulRahmanAlHamali/flutter_typeahead/assets/23505450/5ce2e9de-1d43-422f-8c1f-22286e605ef8
awaitUsername commented 3 months ago

This seems to happen on pages with many TextFields. Downgrading for now... :(