feat(ui): Fix issue with moving the TextEditingController into the Cubit

This commit is contained in:
PapaTutuWawa 2023-12-20 21:25:17 +01:00
parent f89d3827a4
commit 155c9a6c60
3 changed files with 2 additions and 5 deletions

View File

@ -23,9 +23,6 @@ class ConversationsState with _$ConversationsState {
/// Flag indicating whether the search is open or not.
@Default(false) bool searchOpen,
/// The text inside the search box.
@Default('') String searchText,
/// Flag indicating whether we're currently performing a search or not.
@Default(false) bool isSearching,
}) = _ConversationsState;

View File

@ -113,7 +113,7 @@ class ConversationsHomeAppBarState extends State<ConversationsHomeAppBar> {
contentPadding: EdgeInsets.zero,
suffixIcon: IconButton(
icon: Icon(
state.searchText.isNotEmpty
context.read<ConversationsCubit>().searchBarController.text.isNotEmpty
? Icons.close
: Icons.search,
size: pxToLp(72),

View File

@ -141,7 +141,7 @@ class ConversationsPageState extends State<ConversationsPage>
Widget _listWrapper(BuildContext context, List<Conversation> state) {
if (state.isNotEmpty) {
final highlightWord = context.read<ConversationsCubit>().state.searchText;
final highlightWord = context.read<ConversationsCubit>().searchBarController.text;
return ListView.builder(
itemCount: state.length,
itemBuilder: (context, index) {