Cleanup intro, remove button handler on final screen.

This commit is contained in:
Shawn 2023-01-03 10:35:26 -07:00
parent 7f54f4fab6
commit 15e1892589

View File

@ -24,7 +24,7 @@ class _IntroScreenState extends State<IntroScreen> {
late final PageController _pageController = PageController()..addListener(_handlePageChanged); late final PageController _pageController = PageController()..addListener(_handlePageChanged);
final ValueNotifier<int> _currentPage = ValueNotifier(0); final ValueNotifier<int> _currentPage = ValueNotifier(0);
bool get _isOnLastPage => _currentPage.value.round() == pageData.length - 1;
@override @override
void dispose() { void dispose() {
_pageController.dispose(); _pageController.dispose();
@ -50,6 +50,7 @@ class _IntroScreenState extends State<IntroScreen> {
void _handleNavTextDoubleTapped() { void _handleNavTextDoubleTapped() {
final int current = _pageController.page!.round(); final int current = _pageController.page!.round();
if (_isOnLastPage) return;
_pageController.animateToPage(current + 1, duration: 250.ms, curve: Curves.easeIn); _pageController.animateToPage(current + 1, duration: 250.ms, curve: Curves.easeIn);
} }
@ -66,10 +67,19 @@ class _IntroScreenState extends State<IntroScreen> {
// However, we only want the title / description to actually swipe, // However, we only want the title / description to actually swipe,
// so we stack a PageView with that content over top of all the other // so we stack a PageView with that content over top of all the other
// content, and line up their layouts. // content, and line up their layouts.
final List<Widget> pages = pageData.map((e) => _Page(data: e)).toList(); final List<Widget> pages = pageData.map((e) => _Page(data: e)).toList();
final Widget content = Stack(children: [ /// Return resulting widget tree
return DefaultTextColor(
color: $styles.colors.offWhite,
child: Container(
color: $styles.colors.black,
child: SafeArea(
child: Animate(
delay: 500.ms,
effects: const [FadeEffect()],
child: Stack(
children: [
// page view with title & description: // page view with title & description:
MergeSemantics( MergeSemantics(
child: Semantics( child: Semantics(
@ -123,8 +133,8 @@ class _IntroScreenState extends State<IntroScreen> {
Container( Container(
height: _pageIndicatorHeight, height: _pageIndicatorHeight,
alignment: Alignment(0.0, -0.75), alignment: Alignment(0.0, -0.75),
child: child: AppPageIndicator(
AppPageIndicator(count: pageData.length, controller: _pageController, color: $styles.colors.offWhite), count: pageData.length, controller: _pageController, color: $styles.colors.offWhite),
), ),
Spacer(flex: 2), Spacer(flex: 2),
@ -149,13 +159,10 @@ class _IntroScreenState extends State<IntroScreen> {
child: _buildNavText(context), child: _buildNavText(context),
), ),
), ),
]); ],
),
return DefaultTextColor( ),
color: $styles.colors.offWhite, ),
child: Container(
color: $styles.colors.black,
child: SafeArea(child: content.animate().fadeIn(delay: 500.ms)),
), ),
); );
} }
@ -208,7 +215,7 @@ class _IntroScreenState extends State<IntroScreen> {
duration: $styles.times.fast, duration: $styles.times.fast,
child: Semantics( child: Semantics(
onTapHint: $strings.introSemanticNavigate, onTapHint: $strings.introSemanticNavigate,
onTap: _handleNavTextDoubleTapped, onTap: _isOnLastPage ? null : _handleNavTextDoubleTapped,
child: Text($strings.introSemanticSwipeLeft, style: $styles.text.bodySmall), child: Text($strings.introSemanticSwipeLeft, style: $styles.text.bodySmall),
), ),
); );