Skip to content

Commit

Permalink
fix: 🐛 Fixed mounter issue inside the _scrollIntoView function
Browse files Browse the repository at this point in the history
  • Loading branch information
Sahil-Simform committed Dec 20, 2024
1 parent cf351c2 commit 24e9328
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
- Feature [#478](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/478) - Added
feasibility to change auto scroll widget alignment `scrollAlignment`.
- Feature ✨: Added `enableAutoScroll` to `showcase`.
- Fix [#489](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/pull/489) - Fixed
mounter issue inside the `_scrollIntoView` function

## [3.0.0]
- [BREAKING] Fixed [#434](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/434) removed deprecated text style after Flutter 3.22 follow [migration guide](https://docs.flutter.dev/release/breaking-changes/3-19-deprecations#texttheme)
Expand Down
5 changes: 4 additions & 1 deletion lib/src/showcase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -603,12 +603,15 @@ class _ShowcaseState extends State<Showcase> {

void _scrollIntoView() {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
final keyContext = widget.key.currentContext;
if (!mounted || (keyContext?.mounted ?? true)) return;
setState(() => _isScrollRunning = true);
await Scrollable.ensureVisible(
widget.key.currentContext!,
keyContext!,
duration: showCaseWidgetState.widget.scrollDuration,
alignment: widget.scrollAlignment,
);
if (!mounted) return;
setState(() => _isScrollRunning = false);
});
}
Expand Down

0 comments on commit 24e9328

Please sign in to comment.