From 79de6ee6fa16e81b845ab76d1015bbac4cc9307d Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Tue, 7 Oct 2025 22:01:44 +0300 Subject: [PATCH] feat(registration): Issue-691 register_via_social_screen.dart --- .../pages/register_via_social_screen.dart | 167 ++++++++++++++++-- 1 file changed, 157 insertions(+), 10 deletions(-) diff --git a/lib/features/auth/presentation/pages/register_via_social_screen.dart b/lib/features/auth/presentation/pages/register_via_social_screen.dart index 24c4fc46..211b9eae 100644 --- a/lib/features/auth/presentation/pages/register_via_social_screen.dart +++ b/lib/features/auth/presentation/pages/register_via_social_screen.dart @@ -1,6 +1,10 @@ +import 'package:eatvio_app/core/const.dart'; +import 'package:eatvio_app/core/theme/theme_helper.dart'; import 'package:eatvio_app/core/widgets/custom_text_form_field.dart'; +import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:mask_text_input_formatter/mask_text_input_formatter.dart'; +import 'package:url_launcher/url_launcher.dart'; class RegisterViaSocialScreen extends StatefulWidget { const RegisterViaSocialScreen({super.key}); @@ -66,7 +70,6 @@ class _RegisterViaSocialScreenState extends State { textInputType: TextInputType.emailAddress, keyboardType: TextInputType.emailAddress, hintText: 'Введите email', - autofocus: true, textInputAction: TextInputAction.next, onChanged: (newValue) {}, ), @@ -82,19 +85,163 @@ class _RegisterViaSocialScreenState extends State { onChanged: (newValue) {}, ), const SizedBox(height: 12), - const Text('Дата рождения'), - const SizedBox(height: 4), - CustomTextFormField( - textInputAction: TextInputAction.done, - hintText: '01.01.2000', - controller: TextEditingController(), - keyboardType: TextInputType.number, - inputFormatters: [maskFormatterForBirthday], - onChanged: (newValue) {}, + Row( + children: [ + SizedBox( + width: MediaQuery.of(context).size.width / 2 - 22, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + const Text('Дата рождения'), + const SizedBox(height: 4), + CustomTextFormField( + textInputAction: TextInputAction.done, + hintText: '01.01.2000', + controller: TextEditingController(), + keyboardType: TextInputType.number, + inputFormatters: [maskFormatterForBirthday], + onChanged: (newValue) {}, + ), + ], + ), + ), + const SizedBox(width: 12), + SizedBox( + width: MediaQuery.of(context).size.width / 2 - 22, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text('Пол'), + const SizedBox(height: 4), + Row( + children: [ + Expanded(child: _genderButton('М', true)), + const SizedBox(width: 4), + Expanded(child: _genderButton('Ж', false)), + ], + ), + ], + ), + ), + ], + ), + const SizedBox(height: 12), + Row( + children: [ + SizedBox( + width: MediaQuery.of(context).size.width / 2 - 22, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + const Text('Вес'), + const SizedBox(height: 4), + CustomTextFormField(controller: TextEditingController(), hintText: 'Введите вес', onChanged: (newValue) {}), + ], + ), + ), + const SizedBox(width: 12), + SizedBox( + width: MediaQuery.of(context).size.width / 2 - 22, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text('Рост'), + const SizedBox(height: 4), + CustomTextFormField(controller: TextEditingController(), hintText: 'Введите рост', onChanged: (newValue) {}), + ], + ), + ), + ], + ), + const SizedBox(height: 28), + const Center( + child: Text( + 'Проверьте правильность заполненных\nданных. Пол, рост и вес требуются для\nрасчета вашей дневной нормы калорий', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xFF323F4B)), + textAlign: TextAlign.center, + ), + ), + const SizedBox(height: 28), + InkWell( + borderRadius: BorderRadius.circular(20), + onTap: () {}, + child: Ink( + width: MediaQuery.of(context).size.width - 32, + height: 52, + decoration: BoxDecoration(color: appTheme.blueA400, borderRadius: BorderRadius.circular(20)), + child: const Center( + child: Text( + 'Зарегистрироваться', + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 18, color: Colors.white), + ), + ), + ), + ), + const SizedBox(height: 16), + Center( + child: RichText( + textAlign: TextAlign.center, + text: TextSpan( + text: 'Нажимая "Зарегистрироваться", Вы соглашаетесь\n', + style: const TextStyle(fontSize: 16, color: Colors.black), + children: [ + const TextSpan( + text: 'c ', + style: TextStyle(fontSize: 16, color: Colors.black), + ), + if (!hidePlans) ...[ + TextSpan( + text: ' Публичной офертой', + style: TextStyle(fontSize: 16, color: appTheme.blueA400, decorationColor: appTheme.blueA400, decoration: TextDecoration.underline), + recognizer: TapGestureRecognizer()..onTap = () async => await launchUrl(Uri.parse('$baseUrl/oferta_bs.pdf')), + ), + const TextSpan( + text: ' и ', + style: TextStyle(fontSize: 16, color: Colors.black), + ), + ], + TextSpan( + text: 'Политикой конфиденциальности и защитой персональных данных', + style: TextStyle(fontSize: 16, color: appTheme.blueA400, decorationColor: appTheme.blueA400, decoration: TextDecoration.underline), + recognizer: TapGestureRecognizer()..onTap = () async => await launchUrl(Uri.parse('$baseUrl/docs/privacy.pdf')), + ), + ], + ), + ), ), ], ), ), ); } + + Widget _genderButton(String gender, bool isActive) { + return InkWell( + onTap: () {}, + borderRadius: BorderRadius.circular(20), + child: Ink( + height: 52, + decoration: BoxDecoration( + color: const Color(0xFFF6F6F6), + borderRadius: BorderRadius.circular(20), + border: isActive ? Border.all( + width: 2, + color: appTheme.blueA400, + ) : null, + ), + child: Center( + child: Text( + gender, + style: TextStyle( + color: isActive ? appTheme.blueA400 : const Color(0xFF323F4B), + fontSize: 16, + fontWeight: FontWeight.w500, + ), + ), + ), + ), + ); + } }