Skip to content

Commit 34ddf97

Browse files
committed
fix: 🐛 chatTextFieldViewKey key gets re-initialized every widget render
1 parent 9709321 commit 34ddf97

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
* **Feat**: [251](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/251) Add
44
support to provide a type of suggestions item(Scrollable or Multi Line).
5-
* **Fix**: [281](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/281) Fix date
5+
* **Fix**: [281](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/281) Fix date
66
and time divider in between messages
77
* **Fix**: [282](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/pull/282) Upgrade
88
version of audio wave forms 1.2.0
99
* **Fix**: [276](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/276) link preview
1010
custom error message
1111
* **Feat**: [280](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/280) ability to
1212
disable link preview
13+
* **Fix**: [253](https://github.com/SimformSolutionsPvtLtd/flutter_chatview/issues/253)
14+
chatTextFieldViewKey key gets re-initialized every widget render
1315

1416
## [2.3.0]
1517

lib/src/widgets/chat_view.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,13 @@ class _ChatViewState extends State<ChatView>
179179

180180
FeatureActiveConfig get featureActiveConfig => widget.featureActiveConfig;
181181

182+
late GlobalKey chatTextFieldViewKey;
183+
182184
@override
183185
void initState() {
184186
super.initState();
185187
setLocaleMessages('en', ReceiptsCustomMessages());
188+
chatTextFieldViewKey = GlobalKey();
186189
}
187190

188191
@override
@@ -196,6 +199,7 @@ class _ChatViewState extends State<ChatView>
196199
chatController: chatController,
197200
featureActiveConfig: featureActiveConfig,
198201
profileCircleConfiguration: widget.profileCircleConfig,
202+
chatTextFieldViewKey: chatTextFieldViewKey,
199203
child: SuggestionsConfigIW(
200204
suggestionsConfig: widget.replySuggestionsConfig,
201205
child: Builder(builder: (context) {

lib/src/widgets/chat_view_inherited_widget.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ class ChatViewInheritedWidget extends InheritedWidget {
1010
required Widget child,
1111
required this.featureActiveConfig,
1212
required this.chatController,
13+
required this.chatTextFieldViewKey,
1314
this.profileCircleConfiguration,
1415
}) : super(key: key, child: child);
1516
final FeatureActiveConfig featureActiveConfig;
1617
final ProfileCircleConfiguration? profileCircleConfiguration;
1718
final ChatController chatController;
18-
final GlobalKey chatTextFieldViewKey = GlobalKey();
19+
final GlobalKey chatTextFieldViewKey;
1920
final ValueNotifier<bool> showPopUp = ValueNotifier(false);
2021
final GlobalKey<ReactionPopupState> reactionPopupKey = GlobalKey();
2122

0 commit comments

Comments
 (0)