Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- import 'package:login_app/src/constants/colors/colors.dart';
- import 'package:login_app/src/constants/images/images.dart';
- import 'package:login_app/src/features/authentication/models/onboarding_screen_model.dart';
- import '../../../common_widgets/onboarding_widget.dart';
- class OnboardingScreen extends StatelessWidget {
- OnboardingScreen({Key? key}) : super(key: key);
- final _controller = PageController();
- int currentPage = 0;
- @override
- Widget build(BuildContext context) {
- Size size = MediaQuery.of(context).size;
- final pages = [
- OnboardingScreenWidget(
- model: OnBoardingScreenModel(
- image: onboarding1,
- title: "Learn It All",
- subTitle:
- "You can learn how to write clean codes with MacallTech Don't miss this wonderful opportunity",
- height: size.height * 0.5,
- ),
- ),
- OnboardingScreenWidget(
- model: OnBoardingScreenModel(
- image: onboarding2,
- title: "Learn It All",
- subTitle:
- "You can learn how to write clean codes with MacallTech Don't miss this wonderful opportunity",
- height: size.height * 0.5,
- ),
- ),
- OnboardingScreenWidget(
- model: OnBoardingScreenModel(
- image: onboarding3,
- title: "Learn It All",
- subTitle:
- "You can learn how to write clean codes with MacallTech Don't miss this wonderful opportunity",
- height: size.height * 0.5,
- ),
- ),
- ];
- return Scaffold(
- body: Stack(
- alignment: Alignment.topCenter,
- children: [
- PageView(
- controller: _controller,
- onPageChanged: pageChanged,
- children: pages,
- ),
- Positioned(
- bottom: 100,
- child: Container(
- decoration: BoxDecoration(
- color: kPrimaryDarkColor,
- ),
- child: Row(
- children: [
- TextButton(
- style: TextButton.styleFrom(
- primary: kWhiteColor,
- ),
- onPressed: () {},
- child: Text(
- "Next",
- style: Theme.of(context)
- .textTheme
- .headlineSmall
- ?.copyWith(
- color: kWhiteColor,
- fontWeight: FontWeight.bold),
- ),
- ),
- Icon(Icons.arrow_forward_ios),
- ],
- )),
- ),
- Positioned(
- right: 20,
- top: 40,
- child: TextButton(
- onPressed: () {
- _controller.jumpToPage(2);
- },
- child: Text(
- "Skip",
- style: Theme.of(context).textTheme.headlineSmall!.copyWith(
- fontWeight: FontWeight.bold,
- color: kPrimaryDarkColor,
- ),
- ),
- ),
- ),
- ],
- ),
- );
- }
- void pageChanged(int activePageIndex) {
- currentPage = activePageIndex;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement