flutter_chatview icon indicating copy to clipboard operation
flutter_chatview copied to clipboard

fix: 🐛 Padding `chatTextFieldViewKey` key gets re-initialized every widget render

Open ElyasAsmad opened this issue 1 year ago • 0 comments

Description

This proposed PR aims to fix #216 and #253.

Before changes In lib/src/widgets/send_message_widget.dart (line 147), the widget gets re-rendered every time there are any state changes (e.g: screen resizing due to keyboard avoiding behavior in iOS) in the widget due to the chatTextFieldViewKey key re-initialization of the Padding widget. See video below:

https://github.com/user-attachments/assets/efc63716-5923-4663-a088-edaa6c9c15d4

After changes This PR makes the chatTextFieldViewKey to be initialized only once (singleton design pattern-like), even after widget state changes. This prevents unnecessary re-render.

https://github.com/user-attachments/assets/d2a5c1ce-f08d-4aa0-a45b-6eb91e20066e

Checklist

  • [x] The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
  • [x] I have followed the Contributor Guide when preparing my PR.
  • [ ] I have updated/added tests for ALL new/updated/fixed functionality.
  • [ ] I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • [ ] I have updated/added relevant examples in examples or docs.

Breaking Change?

  • [ ] Yes, this PR is a breaking change.
  • [x] No, this PR is not a breaking change.

Related Issues

Closes #216 and #253

ElyasAsmad avatar Sep 11 '24 18:09 ElyasAsmad