refactor(all): refactor

This commit is contained in:
alex
2024-07-09 17:50:32 +03:00
parent f79b9f03ae
commit e180ff16b6
37 changed files with 1706 additions and 1123 deletions

View File

@@ -27,70 +27,87 @@ class CredentialsScreen extends StatelessWidget {
Widget build(BuildContext context) {
mediaQueryData = MediaQuery.of(context);
return 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<Color>(appTheme.blueA400),),),),
SizedBox(height: 39.v),
Text("user_registration".tr, style: theme.textTheme.headlineSmall),
SizedBox(height: 16.v),
Text("email".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 3.v),
BlocSelector<CredentialsBloc, CredentialsState, TextEditingController?>(
selector: (state) => state.emailController,
builder: (context, emailController) {
return CustomTextFormField(controller: emailController, textInputAction: TextInputAction.done);
},),
SizedBox(height: 22.v),
Text("username".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 3.v),
BlocSelector<CredentialsBloc, CredentialsState, TextEditingController?>(
selector: (state) => state.nameController,
builder: (context, nameController) {
return CustomTextFormField(controller: nameController, textInputAction: TextInputAction.done);
},),
SizedBox(height: 19.v),
Text("password".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 5.v),
BlocSelector<CredentialsBloc, CredentialsState, TextEditingController?>(
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<CredentialsBloc, CredentialsState, TextEditingController?>(
selector: (state) => state.passwordConfirmationController,
builder: (context, passwordConfirmationController) {
return CustomTextFormField(obscureText: true, controller: passwordConfirmationController, textInputAction: TextInputAction.done);
},),
Spacer(),
BlocBuilder<CredentialsBloc, CredentialsState>(builder: (context, state) {
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: (1 / 15).toDouble(),
backgroundColor: theme.colorScheme.onPrimary,
valueColor: AlwaysStoppedAnimation<Color>(appTheme.blueA400),
),
),
),
SizedBox(height: 39.v),
Text("user_registration".tr, style: theme.textTheme.headlineSmall),
SizedBox(height: 16.v),
Text("email".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 3.v),
BlocSelector<CredentialsBloc, CredentialsState, TextEditingController?>(
selector: (state) => state.emailController,
builder: (context, emailController) {
return CustomTextFormField(controller: emailController, textInputAction: TextInputAction.done);
},
),
SizedBox(height: 22.v),
Text("username".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 3.v),
BlocSelector<CredentialsBloc, CredentialsState, TextEditingController?>(
selector: (state) => state.nameController,
builder: (context, nameController) {
return CustomTextFormField(controller: nameController, textInputAction: TextInputAction.done);
},
),
SizedBox(height: 19.v),
Text("password".tr, style: theme.textTheme.bodyLarge),
SizedBox(height: 5.v),
BlocSelector<CredentialsBloc, CredentialsState, TextEditingController?>(
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<CredentialsBloc, CredentialsState, TextEditingController?>(
selector: (state) => state.passwordConfirmationController,
builder: (context, passwordConfirmationController) {
return CustomTextFormField(obscureText: true, controller: passwordConfirmationController, textInputAction: TextInputAction.done);
},
),
Spacer(),
BlocBuilder<CredentialsBloc, CredentialsState>(
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: onTapContinue(state, context),);
},),
],),),);
text: "continue".tr.toUpperCase(),
margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
onPressed: onTapContinue(state, context),
);
},
),
],
),
),
);
}
onTapContinue(CredentialsState state, BuildContext context) {