From dcc3ad9cd4c99bee766a594c2a30748358109780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Badst=C3=BCbner?= Date: Mon, 17 Jun 2024 23:10:50 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20correct=20removal=20of=20?= =?UTF-8?q?newSuggestions=20listener?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/src/widgets/suggestions/suggestion_list.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/src/widgets/suggestions/suggestion_list.dart b/lib/src/widgets/suggestions/suggestion_list.dart index 1fb0c36b..d9326f6b 100644 --- a/lib/src/widgets/suggestions/suggestion_list.dart +++ b/lib/src/widgets/suggestions/suggestion_list.dart @@ -22,6 +22,7 @@ class _SuggestionListState extends State with SingleTickerProviderStateMixin { late AnimationController _controller; + ValueNotifier>? newSuggestions; @override void initState() { super.initState(); @@ -32,15 +33,15 @@ class _SuggestionListState extends State ); WidgetsBinding.instance.addPostFrameCallback((_) { if (!mounted) return; - final newSuggestions = provide?.chatController.newSuggestions; + newSuggestions = provide?.chatController.newSuggestions; newSuggestions?.addListener(animateSuggestionList); }); } void animateSuggestionList() { - final newSuggestions = provide?.chatController.newSuggestions; + newSuggestions = provide?.chatController.newSuggestions; if (newSuggestions != null) { - newSuggestions.value.isEmpty + newSuggestions!.value.isEmpty ? _controller.reverse() : _controller.forward(); } @@ -93,7 +94,6 @@ class _SuggestionListState extends State @override void dispose() { _controller.dispose(); - final newSuggestions = provide?.chatController.newSuggestions; newSuggestions?.removeListener(animateSuggestionList); super.dispose(); }