@@ -42,28 +42,32 @@ class IntroductionScreen extends StatefulWidget {
4242
4343 /// Override pre-made done button.
4444 /// You can what you want (button, text, image, ...)
45- final Widget ? overrideDone;
45+ final Widget Function (BuildContext context, Function ()? onPressed)?
46+ overrideDone;
4647
4748 /// Skip button child for the pre-made TextButton
4849 final Widget ? skip;
4950
5051 /// Override pre-made skip button.
5152 /// You can what you want (button, text, image, ...)
52- final Widget ? overrideSkip;
53+ final Widget Function (BuildContext context, Function () onPressed)?
54+ overrideSkip;
5355
5456 /// Next button child for the pre-made TextButton
5557 final Widget ? next;
5658
5759 /// Override pre-made next button.
5860 /// You can what you want (button, text, image, ...)
59- final Widget ? overrideNext;
61+ final Widget Function (BuildContext context, Function ()? onPressed)?
62+ overrideNext;
6063
6164 /// Back button child for the pre-made TextButton
6265 final Widget ? back;
6366
6467 /// Override pre-made back button.
6568 /// You can what you want (button, text, image, ...)
66- final Widget ? overrideBack;
69+ final Widget Function (BuildContext context, Function ()? onPressed)?
70+ overrideBack;
6771
6872 /// Is the Skip button should be display
6973 ///
@@ -558,49 +562,53 @@ class IntroductionScreenState extends State<IntroductionScreen> {
558562 maintainAnimation: true ,
559563 // Needs to be true to maintain size
560564 maintainSize: true ,
561- child: widget.overrideSkip ??
562- IntroButton (
563- child: widget.skip! ,
564- style: widget.baseBtnStyle? .merge (widget.skipStyle) ??
565- widget.skipStyle,
566- semanticLabel: widget.skipSemantic,
567- onPressed: _onSkip,
568- ),
565+ child: widget.overrideSkip != null
566+ ? widget.overrideSkip !(context, _onSkip)
567+ : IntroButton (
568+ child: widget.skip! ,
569+ style: widget.baseBtnStyle? .merge (widget.skipStyle) ??
570+ widget.skipStyle,
571+ semanticLabel: widget.skipSemantic,
572+ onPressed: _onSkip,
573+ ),
569574 );
570575 } else if (widget.showBackButton &&
571576 getCurrentPage () > 0 &&
572577 widget.canProgress (getCurrentPage ())) {
573- leftBtn = widget.overrideBack ??
574- IntroButton (
575- child: widget.back! ,
576- style: widget.baseBtnStyle? .merge (widget.backStyle) ??
577- widget.backStyle,
578- semanticLabel: widget.backSemantic,
579- onPressed: ! _isScrolling ? previous : null ,
580- );
578+ leftBtn = widget.overrideBack != null
579+ ? widget.overrideBack !(context, ! _isScrolling ? previous : null )
580+ : IntroButton (
581+ child: widget.back! ,
582+ style: widget.baseBtnStyle? .merge (widget.backStyle) ??
583+ widget.backStyle,
584+ semanticLabel: widget.backSemantic,
585+ onPressed: ! _isScrolling ? previous : null ,
586+ );
581587 }
582588
583589 Widget ? rightBtn;
584590 if (isLastPage && widget.showDoneButton) {
585- rightBtn = widget.overrideDone ??
586- IntroButton (
587- child: widget.done! ,
588- style: widget.baseBtnStyle? .merge (widget.doneStyle) ??
589- widget.doneStyle,
590- semanticLabel: widget.doneSemantic,
591- onPressed: ! _isScrolling ? widget.onDone : null ,
592- );
591+ rightBtn = widget.overrideDone != null
592+ ? widget.overrideDone !(context, ! _isScrolling ? widget.onDone : null )
593+ : IntroButton (
594+ child: widget.done! ,
595+ style: widget.baseBtnStyle? .merge (widget.doneStyle) ??
596+ widget.doneStyle,
597+ semanticLabel: widget.doneSemantic,
598+ onPressed: ! _isScrolling ? widget.onDone : null ,
599+ );
593600 } else if (! isLastPage &&
594601 widget.showNextButton &&
595602 widget.canProgress (getCurrentPage ())) {
596- rightBtn = widget.overrideNext ??
597- IntroButton (
598- child: widget.next! ,
599- style: widget.baseBtnStyle? .merge (widget.nextStyle) ??
600- widget.nextStyle,
601- semanticLabel: widget.nextSemantic,
602- onPressed: ! _isScrolling ? next : null ,
603- );
603+ rightBtn = widget.overrideNext != null
604+ ? widget.overrideNext !(context, ! _isScrolling ? next : null )
605+ : IntroButton (
606+ child: widget.next! ,
607+ style: widget.baseBtnStyle? .merge (widget.nextStyle) ??
608+ widget.nextStyle,
609+ semanticLabel: widget.nextSemantic,
610+ onPressed: ! _isScrolling ? next : null ,
611+ );
604612 }
605613
606614 final pages = widget.pages
0 commit comments