Skip to content

Commit

Permalink
Fix issue with scrollController has no client
Browse files Browse the repository at this point in the history
  • Loading branch information
Fintasys committed Mar 22, 2024
1 parent 3a0aa64 commit 5fa070d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 2.1.1

- Address issue with inconsistent JVM-target compatibility (thx @GleammerRay)
- Fix issue with ScrollController

## 2.1.0

Expand Down
12 changes: 7 additions & 5 deletions lib/src/emoji_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,13 @@ class EmojiPickerState extends State<EmojiPicker> {
if (widget.scrollController != null) {
final scrollController = widget.scrollController!;
WidgetsBinding.instance.addPostFrameCallback((_) {
scrollController.animateTo(
scrollController.position.maxScrollExtent,
duration: const Duration(milliseconds: 200),
curve: Curves.ease,
);
if (scrollController.hasClients) {
scrollController.animateTo(
scrollController.position.maxScrollExtent,
duration: const Duration(milliseconds: 200),
curve: Curves.ease,
);
}
});
}
}
Expand Down

0 comments on commit 5fa070d

Please sign in to comment.