diff --git a/.github/ISSUE_TEMPLATE/add_presentation.md b/.github/ISSUE_TEMPLATE/add_presentation.md index 80e6b00..6fc69da 100644 --- a/.github/ISSUE_TEMPLATE/add_presentation.md +++ b/.github/ISSUE_TEMPLATE/add_presentation.md @@ -11,8 +11,8 @@ Add information about the presentation here. **Requirements** -- [ ] Provide a link to the presentation (if deployed, just to check it out) - [ ] Provide a link to the source code - [ ] Provide a title for the presentation +- [ ] Provide a language of the presentation - [ ] Provide your full name - [ ] Provide a link to your social media profile diff --git a/CHANGELOG.md b/CHANGELOG.md index 05c8725..60c893a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,15 @@ +# NEXT + +- fix: `FlutterDeckSlideStepsBuilder` triggers builder on slide change +- fix: `FlutterDeckSlideStepsListener` triggers listener on slide change + # 0.4.2 -docs: update split slide documentation in README.md +- docs: update split slide documentation in README.md # 0.4.1 -fix: override text colors for Material text styles +- fix: override text colors for Material text styles # 0.4.0 diff --git a/README.md b/README.md index 17844cd..a2975f6 100644 --- a/README.md +++ b/README.md @@ -692,11 +692,11 @@ Every slide deck comes with a navigation drawer that can be used to navigate thr ## Presentations built with flutter_deck 🚀 -| Title | Author | -| ----------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- | -| [Let me introduce you to Flutter](https://github.com/mkobuolys/introduction-to-flutter) | [Mangirdas Kazlauskas][mangirdas_kazlauskas_link] | -| [Control your Flutter application on the fly with Firebase Remote Config](https://github.com/mkobuolys/firebase-remote-config-talk) | [Mangirdas Kazlauskas][mangirdas_kazlauskas_link] | -| [Introdução ao Flutter Web (Introduction to Flutter Web)](https://github.com/afucher/flutter_web_101) | [Arthur Fücher](https://x.com/Thur) | +| Title | Language | Author | +| ----------------------------------------------------------------------------------------------------------------------------------- | ---------- | ------------------------------------------------- | +| [Let me introduce you to Flutter](https://github.com/mkobuolys/introduction-to-flutter) | English | [Mangirdas Kazlauskas][mangirdas_kazlauskas_link] | +| [Control your Flutter application on the fly with Firebase Remote Config](https://github.com/mkobuolys/firebase-remote-config-talk) | English | [Mangirdas Kazlauskas][mangirdas_kazlauskas_link] | +| [Introduction to Flutter Web](https://github.com/afucher/flutter_web_101) | Portuguese | [Arthur Fücher](https://x.com/Thur) | [flutter_install_link]: https://docs.flutter.dev/get-started/install [license_badge]: https://img.shields.io/badge/license-MIT-blue.svg diff --git a/cspell/authors.txt b/cspell/authors.txt index 5c68da1..392b7fe 100644 --- a/cspell/authors.txt +++ b/cspell/authors.txt @@ -1,2 +1,4 @@ Mangirdas -Kazlauskas \ No newline at end of file +Kazlauskas +Arthur +Fücher \ No newline at end of file diff --git a/lib/src/widgets/flutter_deck_slide_steps_builder.dart b/lib/src/widgets/flutter_deck_slide_steps_builder.dart index 9c6330d..a949eb9 100644 --- a/lib/src/widgets/flutter_deck_slide_steps_builder.dart +++ b/lib/src/widgets/flutter_deck_slide_steps_builder.dart @@ -36,6 +36,7 @@ class _FlutterDeckSlideStepsBuilderState extends State { FlutterDeckRouter? _router; int? _stepNumber; + int? _slideNumber; @override void dispose() { @@ -50,7 +51,10 @@ class _FlutterDeckSlideStepsBuilderState if (_router != null) return; - _router = context.flutterDeck.router..addListener(_onRouteChange); + final flutterDeck = context.flutterDeck; + + _slideNumber = flutterDeck.slideNumber; + _router = flutterDeck.router..addListener(_onRouteChange); // Needed for the first render, e.g. when the user navigates to a slide // directly via URL or deep link. @@ -58,7 +62,11 @@ class _FlutterDeckSlideStepsBuilderState } void _onRouteChange() { - setState(() => _stepNumber = context.flutterDeck.stepNumber); + final flutterDeck = context.flutterDeck; + + if (_slideNumber != flutterDeck.slideNumber) return; + + setState(() => _stepNumber = flutterDeck.stepNumber); } @override diff --git a/lib/src/widgets/flutter_deck_slide_steps_listener.dart b/lib/src/widgets/flutter_deck_slide_steps_listener.dart index 1203e0c..4520b90 100644 --- a/lib/src/widgets/flutter_deck_slide_steps_listener.dart +++ b/lib/src/widgets/flutter_deck_slide_steps_listener.dart @@ -39,6 +39,7 @@ class FlutterDeckSlideStepsListener extends StatefulWidget { class _FlutterDeckSlideStepsListenerState extends State { FlutterDeckRouter? _router; + int? _slideNumber; @override void dispose() { @@ -53,11 +54,18 @@ class _FlutterDeckSlideStepsListenerState if (_router != null) return; - _router = context.flutterDeck.router..addListener(_onRouteChange); + final flutterDeck = context.flutterDeck; + + _slideNumber = flutterDeck.slideNumber; + _router = flutterDeck.router..addListener(_onRouteChange); } void _onRouteChange() { - widget.listener(context, context.flutterDeck.stepNumber); + final flutterDeck = context.flutterDeck; + + if (_slideNumber != flutterDeck.slideNumber) return; + + widget.listener(context, flutterDeck.stepNumber); } @override