I wanted to add a login button below the onboarding screen: how could I do that? Below I have provided the picture of the screen and the code I have implemented so far. Appreciate your help on this.
class OnBoardingScreen extends StatefulWidget {
const OnBoardingScreen({Key? key}) : super(key: key);
@override
_OnBoardingScreenState createState() => _OnBoardingScreenState();
}
class _OnBoardingScreenState extends State<OnBoardingScreen> {
PageController _controller = PageController();
//keep track of if we are on the last page or not
bool onLastPage = false;
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
PageView(
onPageChanged: (index) {
setState(() {
onLastPage = (index == 2);
});
},
controller: _controller,
children: [
IntroPageOne(),
IntroPageTwo(),
IntroPageThree(),
],
),
//dot indicators
Container(
alignment: Alignment(0, 0.6),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
//skip
GestureDetector(
onTap: () {
_controller.jumpTo(2);
},
child: Text('Skip', style: TextStyle(
height: 1.2,
fontFamily: "Roboto",
fontSize: 15,
color: MainGreen,
fontWeight: FontWeight.w500,
// fontWeight: FontWeight.w100,
))),
SmoothPageIndicator(
controller: _controller,
count: 3,
effect: WormEffect(
dotColor: Colors.grey,
activeDotColor: MainGreen,
),
),
//next or done
onLastPage
? GestureDetector(
onTap: () {
Get.to(() => const LoginScreen());
},
child: Text('Done',
style: TextStyle(
height: 1.2,
fontFamily: "Roboto",
fontSize: 15,
color: MainGreen,
fontWeight: FontWeight.w500,
// fontWeight: FontWeight.w100,
)),
)
: GestureDetector(
onTap: () {
_controller.nextPage(
duration: Duration(milliseconds: 500),
curve: Curves.easeIn,
);
},
child: Text('Next', style: TextStyle(
height: 1.2,
fontFamily: "Roboto",
fontSize: 15,
color: MainGreen,
fontWeight: FontWeight.w500,
// fontWeight: FontWeight.w100,
)),
)
],
)),
MainButton("Login")
],
));
}
}

