forked from eatvio/eatvio_app
feat(registration): finished layout for new registration screen
This commit is contained in:
@@ -2,7 +2,9 @@ import 'package:eatvio_app/core/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/widgets/custom_outlined_button.dart';
|
||||
import 'package:eatvio_app/core/widgets/custom_text_form_field.dart';
|
||||
import 'package:eatvio_app/features/create_diet/presentation/widgets/error_widget.dart';
|
||||
import 'package:eatvio_app/features/registration_v2/cubit/registration_cubit.dart';
|
||||
import 'package:eatvio_app/features/registration_v2/cubit/registration_state.dart';
|
||||
import 'package:eatvio_app/features/registration_v2/presentation/widgets/sex_widget.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -15,75 +17,84 @@ class FirstStepContent extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
return BlocBuilder<RegistrationCubitV2, RegistrationStateV2>(
|
||||
builder: (context, state) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.first_name, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(hintText: s.your_name),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.last_name, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(hintText: s.your_last_name),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(s.email, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
CustomTextFormField(hintText: s.type_email),
|
||||
const SizedBox(height: 12),
|
||||
Text(s.phone, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
const CustomTextFormField(hintText: '+7 (999) 999 99 99'),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.date_of_birth, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
textInputAction: TextInputAction.done,
|
||||
hintText: '01.01.2000',
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [maskFormatterForBirthday],
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.first_name, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(hintText: s.your_name, hasError: !state.isFirstNameValid),
|
||||
if (!state.isFirstNameValid) ...[const SizedBox(height: 4), ValidationErrorWidget(error: s.first_name_validation_error)],
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.last_name, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(hintText: s.your_last_name, hasError: !state.isLastNameValid),
|
||||
if (!state.isLastNameValid) ...[const SizedBox(height: 4), ValidationErrorWidget(error: s.last_name_error)],
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
const Expanded(child: SexWidget()),
|
||||
const SizedBox(height: 12),
|
||||
Text(s.email, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
CustomTextFormField(hintText: s.type_email, hasError: !state.isEmailValid),
|
||||
if (!state.isEmailValid) ...[const SizedBox(height: 4), ValidationErrorWidget(error: s.email_error)],
|
||||
const SizedBox(height: 12),
|
||||
Text(s.phone, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
const CustomTextFormField(hintText: '+7 (999) 999 99 99'),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.date_of_birth, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
textInputAction: TextInputAction.done,
|
||||
hintText: '01.01.2000',
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [maskFormatterForBirthday],
|
||||
hasError: !state.isBirthdayValid,
|
||||
),
|
||||
if (!state.isBirthdayValid) ...[const SizedBox(height: 4), ValidationErrorWidget(error: s.date_of_birth_error)],
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
const Expanded(child: SexWidget()),
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
CustomOutlinedButton(
|
||||
onPressed: () {
|
||||
context.read<RegistrationCubitV2>().nextStep();
|
||||
},
|
||||
text: s.next,
|
||||
height: 52,
|
||||
buttonTextStyle: TextStyles.textSSemibold.copyWith(color: appTheme.whiteA700),
|
||||
buttonStyle: ButtonStyle(side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400)),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
CustomOutlinedButton(
|
||||
onPressed: () {
|
||||
context.read<RegistrationCubitV2>().nextStep();
|
||||
},
|
||||
text: s.next,
|
||||
height: 52,
|
||||
buttonTextStyle: TextStyles.textSSemibold.copyWith(color: appTheme.whiteA700),
|
||||
buttonStyle: ButtonStyle(side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400)),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,11 @@ import 'package:eatvio_app/core/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/features/registration_v2/cubit/registration_cubit.dart';
|
||||
import 'package:eatvio_app/features/registration_v2/cubit/registration_state.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
|
||||
class PasswordField extends StatefulWidget {
|
||||
const PasswordField({super.key, required this.cubit});
|
||||
@@ -13,8 +16,10 @@ class PasswordField extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _PasswordFieldState extends State<PasswordField> {
|
||||
bool copied = false;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
return BlocBuilder<RegistrationCubitV2, RegistrationStateV2>(
|
||||
bloc: widget.cubit,
|
||||
builder: (context, state) {
|
||||
@@ -26,10 +31,43 @@ class _PasswordFieldState extends State<PasswordField> {
|
||||
width: double.infinity,
|
||||
child: Row(
|
||||
children: [
|
||||
Text('Klknasd978!9', style: TextStyles.textMMediumAuto.copyWith(color: appTheme.black)),
|
||||
Text('qweqweqwe', style: TextStyles.textMMediumAuto.copyWith(color: appTheme.black)),
|
||||
const Spacer(),
|
||||
GestureDetector(
|
||||
onTap: copied
|
||||
? null
|
||||
: () async {
|
||||
Clipboard.setData(const ClipboardData(text: 'qweqwe'));
|
||||
setState(() {
|
||||
copied = true;
|
||||
});
|
||||
Future.delayed(const Duration(seconds: 3), () {
|
||||
setState(() {
|
||||
copied = false;
|
||||
});
|
||||
});
|
||||
},
|
||||
child: SvgPicture.asset(
|
||||
copied ? 'assets/icons/check_filled.svg' : 'assets/icons/copy2.svg',
|
||||
height: 20,
|
||||
width: 20,
|
||||
colorFilter: copied ? null : ColorFilter.mode(appTheme.black, BlendMode.srcIn),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (copied) ...[
|
||||
const SizedBox(height: 6),
|
||||
Row(
|
||||
children: [
|
||||
SvgPicture.asset('assets/icons/check.svg', height: 10, width: 10),
|
||||
const SizedBox(width: 4),
|
||||
Text(s.copied2, style: TextStyles.textSMedium.copyWith(color: appTheme.darkGreen)),
|
||||
],
|
||||
),
|
||||
],
|
||||
SizedBox(height: copied ? 18 : 12),
|
||||
],
|
||||
);
|
||||
},
|
||||
|
||||
@@ -5,8 +5,9 @@ import 'package:eatvio_app/core/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/widgets/custom_outlined_button.dart';
|
||||
import 'package:eatvio_app/core/widgets/custom_text_form_field.dart';
|
||||
import 'package:eatvio_app/core/widgets/show_error_dialog.dart';
|
||||
import 'package:eatvio_app/features/create_diet/presentation/widgets/error_widget.dart';
|
||||
import 'package:eatvio_app/features/registration_v2/cubit/registration_cubit.dart';
|
||||
import 'package:eatvio_app/features/registration_v2/cubit/registration_state.dart';
|
||||
import 'package:eatvio_app/features/registration_v2/presentation/widgets/phisical_activity.dart';
|
||||
import 'package:eatvio_app/features/registration_v2/presentation/widgets/show_successful_registration_bottom_sheet.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
@@ -21,100 +22,105 @@ class SecondStepContent extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.last_step, style: TextStyles.textFS24FW700.copyWith(color: appTheme.black)),
|
||||
const SizedBox(height: 12),
|
||||
Text(s.user_data_desc, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
const SizedBox(height: 16),
|
||||
Row(
|
||||
return BlocBuilder<RegistrationCubitV2, RegistrationStateV2>(
|
||||
builder: (context, state) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.height, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(hintText: s.type_height),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.weight, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(hintText: s.type_weight),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(s.email, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
const PhisicalActivity(),
|
||||
const SizedBox(height: 12),
|
||||
const Spacer(),
|
||||
Row(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
context.read<RegistrationCubitV2>().prevStep();
|
||||
},
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: Ink(
|
||||
height: 52,
|
||||
width: 52,
|
||||
decoration: BoxDecoration(color: appTheme.gray50, borderRadius: BorderRadius.circular(20)),
|
||||
child: Center(child: Icon(Icons.arrow_back_ios_new_rounded, color: appTheme.blueA400, size: 24)),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Expanded(
|
||||
child: CustomOutlinedButton(
|
||||
onPressed: () {
|
||||
showSuccessfulRegistrationBottomSheet(context, context.read<RegistrationCubitV2>());
|
||||
// showErrorDialog(context);
|
||||
},
|
||||
text: s.register,
|
||||
height: 52,
|
||||
buttonTextStyle: TextStyles.textSSemibold.copyWith(color: appTheme.whiteA700),
|
||||
buttonStyle: ButtonStyle(side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Center(
|
||||
child: RichText(
|
||||
textAlign: TextAlign.center,
|
||||
text: TextSpan(
|
||||
text: 'Нажимая “Зарегистрироваться”, Вы соглашаетесь \n',
|
||||
style: const TextStyle(fontSize: 12, color: Colors.black),
|
||||
Text(s.last_step, style: TextStyles.textFS24FW700.copyWith(color: appTheme.black)),
|
||||
const SizedBox(height: 12),
|
||||
Text(s.user_data_desc, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
const SizedBox(height: 16),
|
||||
Row(
|
||||
children: [
|
||||
const TextSpan(text: 'c '),
|
||||
if (!hidePlans) ...[
|
||||
TextSpan(
|
||||
text: ' Публичной офертой',
|
||||
style: TextStyle(fontSize: 12, color: appTheme.blueA400, decorationColor: appTheme.blueA400, decoration: TextDecoration.underline),
|
||||
recognizer: TapGestureRecognizer()..onTap = () async => await launchUrl(Uri.parse('${sl<AppConfig>().baseUrl}/oferta_bs.pdf')),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.height, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(hintText: s.type_height, hasError: !state.isHeightValid),
|
||||
if (!state.isHeightValid) ValidationErrorWidget(error: s.height_error),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.weight, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(hintText: s.type_weight, hasError: !state.isWeightValid),
|
||||
if (!state.isWeightValid) ValidationErrorWidget(error: s.weight_error),
|
||||
],
|
||||
),
|
||||
const TextSpan(text: ' и '),
|
||||
],
|
||||
TextSpan(
|
||||
text: 'Политикой конфиденциальности\nи защитой персональных данных',
|
||||
style: TextStyle(fontSize: 12, color: appTheme.blueA400, decorationColor: appTheme.blueA400, decoration: TextDecoration.underline),
|
||||
recognizer: TapGestureRecognizer()..onTap = () async => await launchUrl(Uri.parse('${sl<AppConfig>().baseUrl}/docs/privacy.pdf')),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
],
|
||||
const SizedBox(height: 12),
|
||||
Text(s.phisical_activity, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
const PhisicalActivity(),
|
||||
const SizedBox(height: 12),
|
||||
const Spacer(),
|
||||
Row(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
context.read<RegistrationCubitV2>().prevStep();
|
||||
},
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: Ink(
|
||||
height: 52,
|
||||
width: 52,
|
||||
decoration: BoxDecoration(color: appTheme.gray50, borderRadius: BorderRadius.circular(20)),
|
||||
child: Center(child: Icon(Icons.arrow_back_ios_new_rounded, color: appTheme.blueA400, size: 24)),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Expanded(
|
||||
child: CustomOutlinedButton(
|
||||
onPressed: () {
|
||||
showRegistrationBottomSheet(context, context.read<RegistrationCubitV2>(), false, () async {});
|
||||
},
|
||||
text: s.register,
|
||||
height: 52,
|
||||
buttonTextStyle: TextStyles.textSSemibold.copyWith(color: appTheme.whiteA700),
|
||||
buttonStyle: ButtonStyle(side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Center(
|
||||
child: RichText(
|
||||
textAlign: TextAlign.center,
|
||||
text: TextSpan(
|
||||
text: 'Нажимая “Зарегистрироваться”, Вы соглашаетесь \n',
|
||||
style: const TextStyle(fontSize: 12, color: Colors.black),
|
||||
children: [
|
||||
const TextSpan(text: 'c '),
|
||||
if (!hidePlans) ...[
|
||||
TextSpan(
|
||||
text: ' Публичной офертой',
|
||||
style: TextStyle(fontSize: 12, color: appTheme.blueA400, decorationColor: appTheme.blueA400, decoration: TextDecoration.underline),
|
||||
recognizer: TapGestureRecognizer()..onTap = () async => await launchUrl(Uri.parse('${sl<AppConfig>().baseUrl}/oferta_bs.pdf')),
|
||||
),
|
||||
const TextSpan(text: ' и '),
|
||||
],
|
||||
TextSpan(
|
||||
text: 'Политикой конфиденциальности\nи защитой персональных данных',
|
||||
style: TextStyle(fontSize: 12, color: appTheme.blueA400, decorationColor: appTheme.blueA400, decoration: TextDecoration.underline),
|
||||
recognizer: TapGestureRecognizer()..onTap = () async => await launchUrl(Uri.parse('${sl<AppConfig>().baseUrl}/docs/privacy.pdf')),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:eatvio_app/core/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/features/create_diet/presentation/widgets/error_widget.dart';
|
||||
import 'package:eatvio_app/features/registration_v2/cubit/registration_cubit.dart';
|
||||
import 'package:eatvio_app/features/registration_v2/cubit/registration_state.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
@@ -14,31 +15,70 @@ class SexWidget extends StatelessWidget {
|
||||
final s = S.of(context);
|
||||
return BlocBuilder<RegistrationCubitV2, RegistrationStateV2>(
|
||||
builder: (context, state) {
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
return Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.sex, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
InkWell(
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.sex, style: TextStyles.textSMedium.copyWith(color: appTheme.black)),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
context.read<RegistrationCubitV2>().setGender('male');
|
||||
},
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: Ink(
|
||||
height: 60,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF6F6F6),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: state.isGenderValid
|
||||
? state.gender == 'male'
|
||||
? Border.all(width: 2, color: appTheme.blueA400)
|
||||
: null
|
||||
: Border.all(width: 1, color: appTheme.red),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
s.male_short,
|
||||
style: TextStyle(
|
||||
color: state.gender == 'male' ? appTheme.blueA400 : const Color(0xFF323F4B),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
context.read<RegistrationCubitV2>().setGender('male');
|
||||
context.read<RegistrationCubitV2>().setGender('female');
|
||||
},
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: Ink(
|
||||
height: 52,
|
||||
height: 60,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF6F6F6),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: state.gender == 'male' ? Border.all(width: 2, color: appTheme.blueA400) : null,
|
||||
border: state.isGenderValid
|
||||
? state.gender == 'female'
|
||||
? Border.all(width: 2, color: appTheme.blueA400)
|
||||
: null
|
||||
: Border.all(width: 1, color: appTheme.red),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
s.male_short,
|
||||
s.female_short,
|
||||
style: TextStyle(
|
||||
color: state.gender == 'male' ? appTheme.blueA400 : const Color(0xFF323F4B),
|
||||
color: state.gender == 'female' ? appTheme.blueA400 : const Color(0xFF323F4B),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
@@ -46,36 +86,10 @@ class SexWidget extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
context.read<RegistrationCubitV2>().setGender('female');
|
||||
},
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: Ink(
|
||||
height: 52,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF6F6F6),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: state.gender == 'female' ? Border.all(width: 2, color: appTheme.blueA400) : null,
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
s.female_short,
|
||||
style: TextStyle(
|
||||
color: state.gender == 'female' ? appTheme.blueA400 : const Color(0xFF323F4B),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (!state.isGenderValid) ...[const SizedBox(height: 4), ValidationErrorWidget(error: s.gender_error)],
|
||||
],
|
||||
);
|
||||
},
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import 'package:eatvio_app/core/theme/custom_text_style.dart';
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/widgets/custom_outlined_button.dart';
|
||||
import 'package:eatvio_app/features/registration_v2/cubit/registration_cubit.dart';
|
||||
import 'package:eatvio_app/features/registration_v2/presentation/widgets/password_field.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
void showSuccessfulRegistrationBottomSheet(BuildContext context, RegistrationCubitV2 cubit) {
|
||||
void showRegistrationBottomSheet(BuildContext context, RegistrationCubitV2 cubit, bool isSuccess, Future<void> Function() tryAgain) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
@@ -14,14 +15,27 @@ void showSuccessfulRegistrationBottomSheet(BuildContext context, RegistrationCub
|
||||
builder: (context) => Container(
|
||||
margin: EdgeInsets.only(left: 8, right: 8, bottom: MediaQuery.of(context).viewInsets.bottom + MediaQuery.of(context).padding.bottom),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: appTheme.whiteA700),
|
||||
child: SuccessfulBottomSheet(cubit: cubit),
|
||||
child: RegistrationBottomSheet(cubit: cubit, isSuccess: isSuccess),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class SuccessfulBottomSheet extends StatelessWidget {
|
||||
const SuccessfulBottomSheet({super.key, required this.cubit});
|
||||
class RegistrationBottomSheet extends StatefulWidget {
|
||||
const RegistrationBottomSheet({super.key, required this.cubit, required this.isSuccess});
|
||||
final RegistrationCubitV2 cubit;
|
||||
final bool isSuccess;
|
||||
@override
|
||||
State<RegistrationBottomSheet> createState() => _RegistrationBottomSheetState();
|
||||
}
|
||||
|
||||
class _RegistrationBottomSheetState extends State<RegistrationBottomSheet> {
|
||||
late bool isSuccess;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
isSuccess = widget.isSuccess;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
@@ -29,27 +43,64 @@ class SuccessfulBottomSheet extends StatelessWidget {
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12.0),
|
||||
child: Row(
|
||||
children: [
|
||||
SvgPicture.asset('assets/icons/sucess.svg', height: 16, width: 16),
|
||||
const SizedBox(width: 8),
|
||||
Text(s.registration_completed, style: TextStyles.textFS22FW600.copyWith(color: appTheme.black)),
|
||||
],
|
||||
),
|
||||
),
|
||||
children: isSuccess
|
||||
? [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12.0),
|
||||
child: Row(
|
||||
children: [
|
||||
SvgPicture.asset('assets/icons/sucess.svg', height: 16, width: 16),
|
||||
const SizedBox(width: 8),
|
||||
Text(s.registration_completed, style: TextStyles.textFS22FW600.copyWith(color: appTheme.black)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 16.0),
|
||||
child: Text(s.acc_has_been_created, style: TextStyles.textMMediumAuto.copyWith(color: appTheme.darkGrey)),
|
||||
),
|
||||
PasswordField(cubit: cubit),
|
||||
Text(s.password_desc, style: TextStyles.textSMedium.copyWith(color: appTheme.darkGrey)),
|
||||
const SizedBox(width: 20),
|
||||
//button
|
||||
],
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 16.0),
|
||||
child: Text(s.acc_has_been_created, style: TextStyles.textMMediumAuto.copyWith(color: appTheme.darkGrey)),
|
||||
),
|
||||
PasswordField(cubit: widget.cubit),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20.0),
|
||||
child: Text(s.password_desc, style: TextStyles.textSMedium.copyWith(color: appTheme.darkGrey)),
|
||||
),
|
||||
|
||||
CustomOutlinedButton(
|
||||
text: s.login,
|
||||
height: 52,
|
||||
buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700),
|
||||
buttonStyle: ButtonStyle(side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400)),
|
||||
onPressed: () async {},
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
//button
|
||||
]
|
||||
: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12.0),
|
||||
child: Row(
|
||||
children: [
|
||||
SvgPicture.asset('assets/icons/close_mark.svg', height: 16, width: 16),
|
||||
const SizedBox(width: 8),
|
||||
Text(s.signUpFailed, style: TextStyles.textFS22FW600.copyWith(color: appTheme.black)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 16.0),
|
||||
child: Text(s.error_desc, style: TextStyles.textMMediumAuto.copyWith(color: appTheme.darkGrey)),
|
||||
),
|
||||
CustomOutlinedButton(
|
||||
text: s.try_again,
|
||||
height: 52,
|
||||
buttonTextStyle: TextStyles.textMSemibold.copyWith(color: appTheme.whiteA700),
|
||||
buttonStyle: ButtonStyle(side: const WidgetStatePropertyAll(BorderSide.none), backgroundColor: WidgetStatePropertyAll(appTheme.blueA400)),
|
||||
onPressed: () async {},
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,17 +11,12 @@ class StepProgress extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<RegistrationCubitV2, RegistrationStateV2>(
|
||||
builder: (context, state) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
context.read<RegistrationCubitV2>().nextStep();
|
||||
},
|
||||
child: LinearProgressIndicator(
|
||||
value: state.step == 0 ? 0.5 : 1,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
color: appTheme.blueA400,
|
||||
backgroundColor: appTheme.greyD9,
|
||||
minHeight: 8,
|
||||
),
|
||||
return LinearProgressIndicator(
|
||||
value: state.step == 0 ? 0.5 : 1,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
color: appTheme.blueA400,
|
||||
backgroundColor: appTheme.greyD9,
|
||||
minHeight: 8,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user