feat(ui): Fix issue with moving the TextEditingController into the Cubit
This commit is contained in:
parent
f89d3827a4
commit
155c9a6c60
@ -23,9 +23,6 @@ class ConversationsState with _$ConversationsState {
|
|||||||
/// Flag indicating whether the search is open or not.
|
/// Flag indicating whether the search is open or not.
|
||||||
@Default(false) bool searchOpen,
|
@Default(false) bool searchOpen,
|
||||||
|
|
||||||
/// The text inside the search box.
|
|
||||||
@Default('') String searchText,
|
|
||||||
|
|
||||||
/// Flag indicating whether we're currently performing a search or not.
|
/// Flag indicating whether we're currently performing a search or not.
|
||||||
@Default(false) bool isSearching,
|
@Default(false) bool isSearching,
|
||||||
}) = _ConversationsState;
|
}) = _ConversationsState;
|
||||||
|
@ -113,7 +113,7 @@ class ConversationsHomeAppBarState extends State<ConversationsHomeAppBar> {
|
|||||||
contentPadding: EdgeInsets.zero,
|
contentPadding: EdgeInsets.zero,
|
||||||
suffixIcon: IconButton(
|
suffixIcon: IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
state.searchText.isNotEmpty
|
context.read<ConversationsCubit>().searchBarController.text.isNotEmpty
|
||||||
? Icons.close
|
? Icons.close
|
||||||
: Icons.search,
|
: Icons.search,
|
||||||
size: pxToLp(72),
|
size: pxToLp(72),
|
||||||
|
@ -141,7 +141,7 @@ class ConversationsPageState extends State<ConversationsPage>
|
|||||||
|
|
||||||
Widget _listWrapper(BuildContext context, List<Conversation> state) {
|
Widget _listWrapper(BuildContext context, List<Conversation> state) {
|
||||||
if (state.isNotEmpty) {
|
if (state.isNotEmpty) {
|
||||||
final highlightWord = context.read<ConversationsCubit>().state.searchText;
|
final highlightWord = context.read<ConversationsCubit>().searchBarController.text;
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
itemCount: state.length,
|
itemCount: state.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
|
Loading…
Reference in New Issue
Block a user