From 7b91f5e3c5acdf42b7e710a841b79a64c7a6aed9 Mon Sep 17 00:00:00 2001 From: Andrew Zuo Date: Mon, 17 May 2021 19:18:23 -0400 Subject: [PATCH 1/4] Added semantics around next button and dot indicators --- lib/src/introduction_screen.dart | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/src/introduction_screen.dart b/lib/src/introduction_screen.dart index 0d694b7..8403ecc 100644 --- a/lib/src/introduction_screen.dart +++ b/lib/src/introduction_screen.dart @@ -294,10 +294,13 @@ class IntroductionScreenState extends State { onPressed: isSkipBtn ? _onSkip : null, ); - final nextBtn = IntroButton( - child: widget.next, - color: widget.nextColor ?? widget.color, - onPressed: widget.showNextButton && !_isScrolling ? next : null, + final nextBtn = Semantics( + child: IntroButton( + child: widget.next, + color: widget.nextColor ?? widget.color, + onPressed: widget.showNextButton && !_isScrolling ? next : null, + ), + label: "Next", ); final doneBtn = IntroButton( @@ -361,7 +364,10 @@ class IntroductionScreenState extends State { flex: widget.dotsFlex, child: Center( child: widget.isProgress - ? DotsIndicator( + ? Semantics( + label: "Page $_currentPage of ${getPagesLength()}", + explicitChildNodes: true, + child: DotsIndicator( reversed: widget.rtl, dotsCount: getPagesLength(), position: _currentPage, @@ -369,6 +375,7 @@ class IntroductionScreenState extends State { onTap: widget.isProgressTap && !widget.freeze ? (pos) => animateScroll(pos.toInt()) : null, + ), ) : const SizedBox(), ), From 5e9ea92837bca6429be2467ea06da53445893c24 Mon Sep 17 00:00:00 2001 From: Andrew Zuo Date: Mon, 17 May 2021 19:29:33 -0400 Subject: [PATCH 2/4] Tweaked labels slightly and toggled explicit child nodes --- lib/src/introduction_screen.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/introduction_screen.dart b/lib/src/introduction_screen.dart index 8403ecc..60f48ed 100644 --- a/lib/src/introduction_screen.dart +++ b/lib/src/introduction_screen.dart @@ -300,7 +300,7 @@ class IntroductionScreenState extends State { color: widget.nextColor ?? widget.color, onPressed: widget.showNextButton && !_isScrolling ? next : null, ), - label: "Next", + label: "Next Button", ); final doneBtn = IntroButton( @@ -365,8 +365,8 @@ class IntroductionScreenState extends State { child: Center( child: widget.isProgress ? Semantics( - label: "Page $_currentPage of ${getPagesLength()}", - explicitChildNodes: true, + label: "Page ${_currentPage.round()} of ${getPagesLength()}", + explicitChildNodes: false, child: DotsIndicator( reversed: widget.rtl, dotsCount: getPagesLength(), From 133d787a7f312ab359405336ea662e50e68498c9 Mon Sep 17 00:00:00 2001 From: Andrew Zuo Date: Mon, 17 May 2021 19:48:37 -0400 Subject: [PATCH 3/4] Page number has to be incremented by 1 and hiding child semantics should work now --- lib/src/introduction_screen.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/introduction_screen.dart b/lib/src/introduction_screen.dart index 60f48ed..1759c97 100644 --- a/lib/src/introduction_screen.dart +++ b/lib/src/introduction_screen.dart @@ -365,8 +365,8 @@ class IntroductionScreenState extends State { child: Center( child: widget.isProgress ? Semantics( - label: "Page ${_currentPage.round()} of ${getPagesLength()}", - explicitChildNodes: false, + label: "Page ${_currentPage.round() + 1} of ${getPagesLength()}", + excludeSemantics: true, child: DotsIndicator( reversed: widget.rtl, dotsCount: getPagesLength(), From 24ee9aaa0b0d9f4539951364f42475d85fb38739 Mon Sep 17 00:00:00 2001 From: Andrew Zuo Date: Mon, 17 May 2021 19:56:32 -0400 Subject: [PATCH 4/4] These lines should probably be intented one more --- lib/src/introduction_screen.dart | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/src/introduction_screen.dart b/lib/src/introduction_screen.dart index 1759c97..c074dd6 100644 --- a/lib/src/introduction_screen.dart +++ b/lib/src/introduction_screen.dart @@ -365,16 +365,16 @@ class IntroductionScreenState extends State { child: Center( child: widget.isProgress ? Semantics( - label: "Page ${_currentPage.round() + 1} of ${getPagesLength()}", - excludeSemantics: true, - child: DotsIndicator( - reversed: widget.rtl, - dotsCount: getPagesLength(), - position: _currentPage, - decorator: widget.dotsDecorator, - onTap: widget.isProgressTap && !widget.freeze - ? (pos) => animateScroll(pos.toInt()) - : null, + label: "Page ${_currentPage.round() + 1} of ${getPagesLength()}", + excludeSemantics: true, + child: DotsIndicator( + reversed: widget.rtl, + dotsCount: getPagesLength(), + position: _currentPage, + decorator: widget.dotsDecorator, + onTap: widget.isProgressTap && !widget.freeze + ? (pos) => animateScroll(pos.toInt()) + : null, ), ) : const SizedBox(),