import 'bloc/credentials_bloc.dart'; import 'models/credentials_model.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart'; import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; class CredentialsScreen extends StatelessWidget { static Widget builder(BuildContext context) { final sheet = ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet; return BlocProvider( create: (context) => CredentialsBloc( CredentialsState( credentialsModelObj: CredentialsModel(userRegistrationSheet: sheet), ), )..add(CredentialsInitialEvent()), child: CredentialsScreen(), ); } @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); return SafeArea( child: Scaffold( resizeToAvoidBottomInset: false, appBar: _buildAppBar(context), body: Container( width: double.maxFinite, padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), child: Column(children: [ SizedBox(height: 7.v), Container( height: 16.v, width: 343.h, decoration: BoxDecoration( color: theme.colorScheme.onPrimary, borderRadius: BorderRadius.circular(8.h), border: Border.all( color: theme.colorScheme.primary, width: 1.h)), child: ClipRRect( borderRadius: BorderRadius.circular(8.h), child: LinearProgressIndicator( value: 0.05, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation( appTheme.blueA400)))), SizedBox(height: 39.v), Text("user_registration".tr, style: theme.textTheme.headlineSmall), SizedBox(height: 93.v), Text("email".tr, style: theme.textTheme.bodyLarge), SizedBox(height: 3.v), BlocSelector( selector: (state) => state.valueController, builder: (context, valueController) { return CustomTextFormField( controller: valueController, textInputAction: TextInputAction.done); }), SizedBox(height: 19.v), Text("password".tr, style: theme.textTheme.bodyLarge), SizedBox(height: 5.v), BlocSelector( selector: (state) => state.passwordController, builder: (context, passwordController) { return CustomTextFormField( obscureText: true, controller: passwordController, ); }), SizedBox(height: 21.v), Text("password_confirmation".tr, style: theme.textTheme.bodyLarge), SizedBox(height: 3.v), BlocSelector( selector: (state) => state.passwordConfirmationController, builder: (context, passwordConfirmationController) { return CustomTextFormField( obscureText: true, controller: passwordConfirmationController, textInputAction: TextInputAction.done); }), Spacer(), BlocBuilder( builder: (context, state) { return NextStepButton( text: "continue".tr.toUpperCase(), margin: EdgeInsets.only( left: 16.h, right: 16.h, bottom: 50.v), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, onPressed: () { UserRegistrationSheet sheet = state.credentialsModelObj!.userRegistrationSheet; sheet.email = state.valueController!.text; sheet.password = state.passwordController!.text; sheet.passwordConfirmation = state.passwordController!.text; Navigator.pushNamed( context, AppRoutes.nameScreen, arguments: sheet, ); }); }), SizedBox(height: 17.v), ])))); } /// Section Widget PreferredSizeWidget _buildAppBar(BuildContext context) { return CustomAppBar( leadingWidth: 29.h, leading: AppbarLeadingImage( imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: () { onTapArrowLeft(context); }), centerTitle: true, title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio)); } /// Navigates to the previous screen. onTapArrowLeft(BuildContext context) { NavigatorService.goBack(); } }