Advertisement
mactech24

myCode

May 15th, 2023
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 3.35 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2. import 'package:login_app/src/constants/colors/colors.dart';
  3. import 'package:login_app/src/constants/images/images.dart';
  4. import 'package:login_app/src/features/authentication/models/onboarding_screen_model.dart';
  5.  
  6. import '../../../common_widgets/onboarding_widget.dart';
  7.  
  8. class OnboardingScreen extends StatelessWidget {
  9.   OnboardingScreen({Key? key}) : super(key: key);
  10.   final _controller = PageController();
  11.   int currentPage = 0;
  12.  
  13.   @override
  14.   Widget build(BuildContext context) {
  15.     Size size = MediaQuery.of(context).size;
  16.     final pages = [
  17.       OnboardingScreenWidget(
  18.         model: OnBoardingScreenModel(
  19.           image: onboarding1,
  20.           title: "Learn It All",
  21.           subTitle:
  22.               "You can learn how to write clean codes with MacallTech Don't miss this wonderful opportunity",
  23.           height: size.height * 0.5,
  24.         ),
  25.       ),
  26.       OnboardingScreenWidget(
  27.         model: OnBoardingScreenModel(
  28.           image: onboarding2,
  29.           title: "Learn It All",
  30.           subTitle:
  31.               "You can learn how to write clean codes with MacallTech Don't miss this wonderful opportunity",
  32.           height: size.height * 0.5,
  33.         ),
  34.       ),
  35.       OnboardingScreenWidget(
  36.         model: OnBoardingScreenModel(
  37.           image: onboarding3,
  38.           title: "Learn It All",
  39.           subTitle:
  40.               "You can learn how to write clean codes with MacallTech Don't miss this wonderful opportunity",
  41.           height: size.height * 0.5,
  42.         ),
  43.       ),
  44.     ];
  45.     return Scaffold(
  46.       body: Stack(
  47.         alignment: Alignment.topCenter,
  48.         children: [
  49.           PageView(
  50.             controller: _controller,
  51.             onPageChanged: pageChanged,
  52.             children: pages,
  53.           ),
  54.           Positioned(
  55.             bottom: 100,
  56.             child: Container(
  57.                 decoration: BoxDecoration(
  58.                   color: kPrimaryDarkColor,
  59.                 ),
  60.                 child: Row(
  61.                   children: [
  62.                     TextButton(
  63.                       style: TextButton.styleFrom(
  64.                         primary: kWhiteColor,
  65.                       ),
  66.                       onPressed: () {},
  67.                       child: Text(
  68.                         "Next",
  69.                         style: Theme.of(context)
  70.                             .textTheme
  71.                             .headlineSmall
  72.                             ?.copyWith(
  73.                                 color: kWhiteColor,
  74.                                 fontWeight: FontWeight.bold),
  75.                       ),
  76.                     ),
  77.                     Icon(Icons.arrow_forward_ios),
  78.                   ],
  79.                 )),
  80.           ),
  81.           Positioned(
  82.             right: 20,
  83.             top: 40,
  84.             child: TextButton(
  85.               onPressed: () {
  86.                 _controller.jumpToPage(2);
  87.               },
  88.               child: Text(
  89.                 "Skip",
  90.                 style: Theme.of(context).textTheme.headlineSmall!.copyWith(
  91.                       fontWeight: FontWeight.bold,
  92.                       color: kPrimaryDarkColor,
  93.                     ),
  94.               ),
  95.             ),
  96.           ),
  97.         ],
  98.       ),
  99.     );
  100.   }
  101.  
  102.   void pageChanged(int activePageIndex) {
  103.     currentPage = activePageIndex;
  104.   }
  105. }
  106.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement