Advertisement
rifki_cs29

RegisterPage

Feb 19th, 2022
952
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 13.17 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_bloc/flutter_bloc.dart';
  3. import 'package:flutter_svg/svg.dart';
  4. import 'package:google_fonts/google_fonts.dart';
  5. import 'package:module_auth/presentation/bloc/register_access_email_bloc/register_access_email_bloc.dart';
  6. import 'package:module_core/custom_widgets/custom_button/custom_button.dart';
  7. import 'package:module_core/custom_widgets/custom_dialog_register/custom_dialog_register.dart';
  8. import 'package:module_core/custom_widgets/custom_textfield/custom_textfield.dart';
  9. import 'package:module_core/utils/app_colors.dart';
  10. import 'package:module_core/utils/app_image.dart';
  11.  
  12. class RegisterPage extends StatelessWidget {
  13.   RegisterPage({Key? key}) : super(key: key);
  14.  
  15.   final TextEditingController _fieldController =
  16.       TextEditingController(text: '');
  17.  
  18.   @override
  19.   Widget build(BuildContext context) {
  20.     return Scaffold(
  21.         body: BlocConsumer<RegisterAccessEmailBloc, RegisterAccessEmailState>(
  22.             listener: (context, state) {
  23.               if (state.errorMessage.isNotEmpty) {
  24.                 ScaffoldMessenger.of(context).showSnackBar(SnackBar(
  25.                   content: Text(state.errorMessage),
  26.                 ));
  27.               }
  28.             },
  29.             listenWhen: (previousState, currentState) =>
  30.                 previousState.errorMessage != currentState.errorMessage &&
  31.                 currentState.errorMessage != '',
  32.             builder: (context, state) {
  33.               return SafeArea(
  34.                   child: ListView(children: [
  35.                 Padding(
  36.                   padding: const EdgeInsets.only(left: 30, top: 30),
  37.                   child: Row(
  38.                     children: [
  39.                       GestureDetector(
  40.                         onTap: () => print('Back'),
  41.                         child: Container(
  42.                           width: 32,
  43.                           height: 32,
  44.                           decoration: BoxDecoration(
  45.                             color: AppColors.greyLight,
  46.                             borderRadius: BorderRadius.circular(18),
  47.                           ),
  48.                           child: SvgPicture.asset(AppImage.back_button,
  49.                               height: 24, width: 24, fit: BoxFit.scaleDown),
  50.                         ),
  51.                       ),
  52.                     ],
  53.                   ),
  54.                 ),
  55.                 SizedBox(height: 8),
  56.                 Padding(
  57.                   padding: const EdgeInsets.symmetric(horizontal: 30),
  58.                   child: AspectRatio(
  59.                     aspectRatio: 3 / 2,
  60.                     child: Container(
  61.                       height: 196,
  62.                       decoration: BoxDecoration(
  63.                         image: DecorationImage(
  64.                           image: AssetImage(AppImage.register_image),
  65.                           fit: BoxFit.cover,
  66.                         ),
  67.                       ),
  68.                     ),
  69.                   ),
  70.                 ),
  71.                 SizedBox(height: 16),
  72.                 Row(
  73.                   mainAxisAlignment: MainAxisAlignment.center,
  74.                   children: [
  75.                     Text(
  76.                       'Buat Akunmu Sekarang',
  77.                       style: GoogleFonts.poppins(
  78.                         fontSize: 16,
  79.                         fontWeight: FontWeight.w600,
  80.                         color: Color(0xff2D2F2E),
  81.                       ),
  82.                     ),
  83.                   ],
  84.                 ),
  85.                 SizedBox(height: 6),
  86.                 Row(
  87.                   mainAxisAlignment: MainAxisAlignment.center,
  88.                   children: [
  89.                     Text(
  90.                       'Sudah Punya Akun?',
  91.                       style: GoogleFonts.roboto(
  92.                         fontSize: 12,
  93.                         fontWeight: FontWeight.w400,
  94.                         color: Color(0xff2D2F2E),
  95.                       ),
  96.                     ),
  97.                     SizedBox(width: 2),
  98.                     GestureDetector(
  99.                       onTap: () => print('Masuk'),
  100.                       child: Text(
  101.                         'Masuk',
  102.                         style: GoogleFonts.roboto(
  103.                           fontSize: 12,
  104.                           fontWeight: FontWeight.w500,
  105.                           color: Color(0xff2D2F2E),
  106.                         ),
  107.                       ),
  108.                     ),
  109.                   ],
  110.                 ),
  111.                 SizedBox(height: 18),
  112.                 Divider(
  113.                   color: Color(0xffC4C4C4),
  114.                   thickness: 1,
  115.                 ),
  116.                 Padding(
  117.                   padding: const EdgeInsets.fromLTRB(30, 18, 30, 0),
  118.                   child: CustomTextField(
  119.                     title: 'Full Name',
  120.                     hintText: 'Your full name',
  121.                     controller: _fieldController,
  122.                   ),
  123.                 ),
  124.                 Padding(
  125.                   padding: const EdgeInsets.only(left: 42),
  126.                   child: Text('Contoh: account@email.com',
  127.                       style: GoogleFonts.roboto(
  128.                           fontSize: 12,
  129.                           fontWeight: FontWeight.w400,
  130.                           color: Color(0xff505050))),
  131.                 ),
  132.                 Padding(
  133.                     padding: const EdgeInsets.fromLTRB(30, 18, 30, 0),
  134.                     child: CustomButton(
  135.                         title: 'Daftar',
  136.                         onPressed: () {
  137.                           showDialog(
  138.                               context: context,
  139.                               builder: (BuildContext context) {
  140.                                 return CustomDialogRegister(
  141.                                   title: 'email@email.com',
  142.                                   descriptions:
  143.                                       'Apakah email yang anda masukkan sudah benar?',
  144.                                   textYes: 'Ya, benar',
  145.                                   textNo: "Ubah",
  146.                                   onPressedYes: () {
  147.                                     BlocProvider.of<RegisterAccessEmailBloc>(
  148.                                             context)
  149.                                         .add(OnClickRegisterAccess(
  150.                                             _fieldController.text));
  151.                                   },
  152.                                   onPressedNo: () {
  153.                                     Navigator.pop(context);
  154.                                   },
  155.                                   image: AppImage.register_email,
  156.                                 );
  157.                               });
  158.                         })),
  159.                 Padding(
  160.                   padding:
  161.                       const EdgeInsets.symmetric(horizontal: 40, vertical: 10),
  162.                   child: RichText(
  163.                     textAlign: TextAlign.center,
  164.                     text: TextSpan(
  165.                       text: 'Dengan mendaftar, saya menyetujui ',
  166.                       style: GoogleFonts.roboto(
  167.                         fontSize: 12,
  168.                         fontWeight: FontWeight.w400,
  169.                         color: Color(0xff2D2F2E),
  170.                       ),
  171.                       children: <TextSpan>[
  172.                         TextSpan(
  173.                             text: 'Syarat dan ketentuan ',
  174.                             style: GoogleFonts.roboto(
  175.                               fontSize: 12,
  176.                               fontWeight: FontWeight.w500,
  177.                               color: Color(0xff2D2F2E),
  178.                             )),
  179.                         TextSpan(
  180.                           text: ' yang berlaku di sistem kami',
  181.                           style: GoogleFonts.roboto(
  182.                             fontSize: 12,
  183.                             fontWeight: FontWeight.w400,
  184.                             color: Color(0xff2D2F2E),
  185.                           ),
  186.                         ),
  187.                       ],
  188.                     ),
  189.                   ),
  190.                 ),
  191.                 Padding(
  192.                   padding: const EdgeInsets.fromLTRB(30, 10, 30, 20),
  193.                   child: IntrinsicHeight(
  194.                     child: Row(
  195.                       children: [
  196.                         Expanded(
  197.                           child: Container(
  198.                             margin: EdgeInsets.only(right: 10),
  199.                             height: 1,
  200.                             color: Color(0xffC4C4C4),
  201.                           ),
  202.                         ),
  203.                         Text(
  204.                           'atau daftar dengan metode lain',
  205.                           style: GoogleFonts.roboto(
  206.                             fontSize: 10,
  207.                             fontWeight: FontWeight.w400,
  208.                             color: Color(0xff2D2F2E),
  209.                           ),
  210.                         ),
  211.                         Expanded(
  212.                           child: Container(
  213.                             height: 1,
  214.                             margin: EdgeInsets.only(left: 10),
  215.                             color: Color(0xffC4C4C4),
  216.                           ),
  217.                         ),
  218.                       ],
  219.                     ),
  220.                   ),
  221.                 ),
  222.                 Padding(
  223.                   padding: EdgeInsets.symmetric(horizontal: 30),
  224.                   child: Row(
  225.                       mainAxisAlignment: MainAxisAlignment.spaceBetween,
  226.                       children: [
  227.                         Container(
  228.                           height: 40,
  229.                           width: MediaQuery.of(context).size.width / 2 - 40,
  230.                           decoration: BoxDecoration(
  231.                               borderRadius: BorderRadius.circular(8),
  232.                               color: Color(0xffFEFEFE),
  233.                               boxShadow: [
  234.                                 BoxShadow(
  235.                                     color: Colors.black12,
  236.                                     blurRadius: 4,
  237.                                     spreadRadius: 1,
  238.                                     offset: Offset(4, 4)) // Shadow ),
  239.                               ]),
  240.                           child: Padding(
  241.                             padding: const EdgeInsets.symmetric(
  242.                                 horizontal: 24, vertical: 12),
  243.                             child: Row(
  244.                               mainAxisAlignment: MainAxisAlignment.center,
  245.                               children: [
  246.                                 SvgPicture.asset(AppImage.google,
  247.                                     height: 24,
  248.                                     width: 24,
  249.                                     fit: BoxFit.scaleDown),
  250.                                 SizedBox(width: 8),
  251.                                 Text(
  252.                                   'Google',
  253.                                   style: GoogleFonts.roboto(
  254.                                     fontSize: 14,
  255.                                     fontWeight: FontWeight.w500,
  256.                                     color: Color(0xff2D2F2E),
  257.                                   ),
  258.                                 ),
  259.                               ],
  260.                             ),
  261.                           ),
  262.                         ),
  263.                         Container(
  264.                           height: 40,
  265.                           width: MediaQuery.of(context).size.width / 2 - 40,
  266.                           decoration: BoxDecoration(
  267.                               borderRadius: BorderRadius.circular(8),
  268.                               color: Color(0xff395185),
  269.                               boxShadow: [
  270.                                 BoxShadow(
  271.                                     color: Colors.black12,
  272.                                     blurRadius: 4,
  273.                                     spreadRadius: 1,
  274.                                     offset: Offset(4, 4)) // Shadow ),
  275.                               ]),
  276.                           child: Padding(
  277.                             padding: const EdgeInsets.symmetric(
  278.                                 horizontal: 24, vertical: 12),
  279.                             child: Row(
  280.                               mainAxisAlignment: MainAxisAlignment.center,
  281.                               children: [
  282.                                 SvgPicture.asset(AppImage.facebook,
  283.                                     height: 30,
  284.                                     width: 30,
  285.                                     fit: BoxFit.scaleDown),
  286.                                 SizedBox(width: 8),
  287.                                 Text(
  288.                                   'Facebook',
  289.                                   style: GoogleFonts.roboto(
  290.                                     fontSize: 14,
  291.                                     fontWeight: FontWeight.w500,
  292.                                     color: Color(0xffFEFEFE),
  293.                                   ),
  294.                                 ),
  295.                               ],
  296.                             ),
  297.                           ),
  298.                         )
  299.                       ]),
  300.                 )
  301.               ]));
  302.             }));
  303.   }
  304. }
  305.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement