From a39fb847fe141b6bfe0957f6acdef368e7635138 Mon Sep 17 00:00:00 2001 From: maxxkim Date: Tue, 19 Dec 2023 16:02:29 +0300 Subject: [PATCH 01/22] Changed screen types to Stateful --- .../additional_information_screen.dart | 9 ++++++++- .../allergies_screen/allergies_screen.dart | 7 ++++++- .../app_navigation_screen/app_navigation_screen.dart | 7 ++++++- .../blood_pressure_screen/blood_pressure_screen.dart | 7 ++++++- .../body_circumferences_screen.dart | 8 +++++++- .../city_of_living_screen/city_of_living_screen.dart | 7 ++++++- .../favorite_foods_screen/favorite_foods_screen.dart | 7 ++++++- .../favorite_sports_screen.dart | 7 ++++++- lib/presentation/gender_screen/gender_screen.dart | 7 ++++++- lib/presentation/height_screen/height_screen.dart | 11 ++++++++--- .../language_select_screen.dart | 7 ++++++- .../medicine_intake_screen.dart | 7 ++++++- lib/presentation/schedule_screen/schedule_screen.dart | 7 ++++++- lib/presentation/weight_screen/weight_screen.dart | 11 ++++++++--- 14 files changed, 91 insertions(+), 18 deletions(-) diff --git a/lib/presentation/additional_information_screen/additional_information_screen.dart b/lib/presentation/additional_information_screen/additional_information_screen.dart index 96559903..3265f0e0 100644 --- a/lib/presentation/additional_information_screen/additional_information_screen.dart +++ b/lib/presentation/additional_information_screen/additional_information_screen.dart @@ -8,7 +8,7 @@ import 'package:eatvio_app/widgets/custom_outlined_button.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; -class AdditionalInformationScreen extends StatelessWidget { +class AdditionalInformationScreen extends StatefulWidget { const AdditionalInformationScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { @@ -20,6 +20,13 @@ class AdditionalInformationScreen extends StatelessWidget { child: AdditionalInformationScreen()); } + @override + State createState() => + _AdditionalInformationScreenState(); +} + +class _AdditionalInformationScreenState + extends State { @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); diff --git a/lib/presentation/allergies_screen/allergies_screen.dart b/lib/presentation/allergies_screen/allergies_screen.dart index 01d732de..e98c2c54 100644 --- a/lib/presentation/allergies_screen/allergies_screen.dart +++ b/lib/presentation/allergies_screen/allergies_screen.dart @@ -8,7 +8,7 @@ import 'package:eatvio_app/widgets/custom_outlined_button.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; -class AllergiesScreen extends StatelessWidget { +class AllergiesScreen extends StatefulWidget { const AllergiesScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { @@ -19,6 +19,11 @@ class AllergiesScreen extends StatelessWidget { child: AllergiesScreen()); } + @override + State createState() => _AllergiesScreenState(); +} + +class _AllergiesScreenState extends State { @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); diff --git a/lib/presentation/app_navigation_screen/app_navigation_screen.dart b/lib/presentation/app_navigation_screen/app_navigation_screen.dart index a04ad84a..0a485d18 100644 --- a/lib/presentation/app_navigation_screen/app_navigation_screen.dart +++ b/lib/presentation/app_navigation_screen/app_navigation_screen.dart @@ -3,7 +3,7 @@ import 'models/app_navigation_model.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:flutter/material.dart'; -class AppNavigationScreen extends StatelessWidget { +class AppNavigationScreen extends StatefulWidget { const AppNavigationScreen({Key? key}) : super( key: key, @@ -19,6 +19,11 @@ class AppNavigationScreen extends StatelessWidget { ); } + @override + State createState() => _AppNavigationScreenState(); +} + +class _AppNavigationScreenState extends State { @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); diff --git a/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart b/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart index 4e849559..79c3832e 100644 --- a/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart +++ b/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart @@ -9,7 +9,7 @@ import 'package:eatvio_app/widgets/custom_outlined_button.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; -class BloodPressureScreen extends StatelessWidget { +class BloodPressureScreen extends StatefulWidget { const BloodPressureScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { @@ -20,6 +20,11 @@ class BloodPressureScreen extends StatelessWidget { child: BloodPressureScreen()); } + @override + State createState() => _BloodPressureScreenState(); +} + +class _BloodPressureScreenState extends State { @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); diff --git a/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart b/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart index dfc414e1..986271d2 100644 --- a/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart +++ b/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart @@ -8,7 +8,7 @@ import 'package:eatvio_app/widgets/custom_outlined_button.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; -class BodyCircumferencesScreen extends StatelessWidget { +class BodyCircumferencesScreen extends StatefulWidget { const BodyCircumferencesScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { @@ -19,6 +19,12 @@ class BodyCircumferencesScreen extends StatelessWidget { child: BodyCircumferencesScreen()); } + @override + State createState() => + _BodyCircumferencesScreenState(); +} + +class _BodyCircumferencesScreenState extends State { @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); diff --git a/lib/presentation/city_of_living_screen/city_of_living_screen.dart b/lib/presentation/city_of_living_screen/city_of_living_screen.dart index 92099dd9..90688e46 100644 --- a/lib/presentation/city_of_living_screen/city_of_living_screen.dart +++ b/lib/presentation/city_of_living_screen/city_of_living_screen.dart @@ -8,7 +8,7 @@ import 'package:eatvio_app/widgets/custom_drop_down.dart'; import 'package:eatvio_app/widgets/custom_outlined_button.dart'; import 'package:flutter/material.dart'; -class CityOfLivingScreen extends StatelessWidget { +class CityOfLivingScreen extends StatefulWidget { const CityOfLivingScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { @@ -19,6 +19,11 @@ class CityOfLivingScreen extends StatelessWidget { child: CityOfLivingScreen()); } + @override + State createState() => _CityOfLivingScreenState(); +} + +class _CityOfLivingScreenState extends State { @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); diff --git a/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart b/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart index 2d0a0a34..8619d3d1 100644 --- a/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart +++ b/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart @@ -8,7 +8,7 @@ import 'package:eatvio_app/widgets/custom_outlined_button.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; -class FavoriteFoodsScreen extends StatelessWidget { +class FavoriteFoodsScreen extends StatefulWidget { const FavoriteFoodsScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { @@ -19,6 +19,11 @@ class FavoriteFoodsScreen extends StatelessWidget { child: FavoriteFoodsScreen()); } + @override + State createState() => _FavoriteFoodsScreenState(); +} + +class _FavoriteFoodsScreenState extends State { @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); diff --git a/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart b/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart index 0ebdf9d6..aa4c0b37 100644 --- a/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart +++ b/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart @@ -8,7 +8,7 @@ import 'package:eatvio_app/widgets/custom_outlined_button.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; -class FavoriteSportsScreen extends StatelessWidget { +class FavoriteSportsScreen extends StatefulWidget { const FavoriteSportsScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { @@ -19,6 +19,11 @@ class FavoriteSportsScreen extends StatelessWidget { child: FavoriteSportsScreen()); } + @override + State createState() => _FavoriteSportsScreenState(); +} + +class _FavoriteSportsScreenState extends State { @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); diff --git a/lib/presentation/gender_screen/gender_screen.dart b/lib/presentation/gender_screen/gender_screen.dart index 31b0596a..6cf57ebc 100644 --- a/lib/presentation/gender_screen/gender_screen.dart +++ b/lib/presentation/gender_screen/gender_screen.dart @@ -7,7 +7,7 @@ import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; import 'package:eatvio_app/widgets/custom_outlined_button.dart'; import 'package:flutter/material.dart'; -class GenderScreen extends StatelessWidget { +class GenderScreen extends StatefulWidget { const GenderScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { @@ -18,6 +18,11 @@ class GenderScreen extends StatelessWidget { child: GenderScreen()); } + @override + State createState() => _GenderScreenState(); +} + +class _GenderScreenState extends State { @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); diff --git a/lib/presentation/height_screen/height_screen.dart b/lib/presentation/height_screen/height_screen.dart index 9d247207..61108c63 100644 --- a/lib/presentation/height_screen/height_screen.dart +++ b/lib/presentation/height_screen/height_screen.dart @@ -8,7 +8,7 @@ import 'package:eatvio_app/widgets/custom_drop_down.dart'; import 'package:eatvio_app/widgets/custom_outlined_button.dart'; import 'package:flutter/material.dart'; -class HeightScreen extends StatelessWidget { +class HeightScreen extends StatefulWidget { const HeightScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { @@ -19,6 +19,11 @@ class HeightScreen extends StatelessWidget { child: HeightScreen()); } + @override + State createState() => _HeightScreenState(); +} + +class _HeightScreenState extends State { @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); @@ -74,7 +79,7 @@ class HeightScreen extends StatelessWidget { } /// Section Widget - Widget _buildTwentySixWidget(BuildContext context) { + Widget _buildWeight(BuildContext context) { return Column(children: [ Text("your_height".tr, style: theme.textTheme.bodyLarge), SizedBox(height: 4.v), @@ -106,7 +111,7 @@ class HeightScreen extends StatelessWidget { return Column(children: [ Text("height_measurements".tr, style: theme.textTheme.headlineSmall), SizedBox(height: 174.v), - _buildTwentySixWidget(context) + _buildWeight(context) ]); } diff --git a/lib/presentation/language_select_screen/language_select_screen.dart b/lib/presentation/language_select_screen/language_select_screen.dart index 2cc0e368..aa3a759e 100644 --- a/lib/presentation/language_select_screen/language_select_screen.dart +++ b/lib/presentation/language_select_screen/language_select_screen.dart @@ -5,7 +5,7 @@ import 'package:eatvio_app/widgets/custom_drop_down.dart'; import 'package:eatvio_app/widgets/custom_outlined_button.dart'; import 'package:flutter/material.dart'; -class LanguageSelectScreen extends StatelessWidget { +class LanguageSelectScreen extends StatefulWidget { const LanguageSelectScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { @@ -16,6 +16,11 @@ class LanguageSelectScreen extends StatelessWidget { child: LanguageSelectScreen()); } + @override + State createState() => _LanguageSelectScreenState(); +} + +class _LanguageSelectScreenState extends State { @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); diff --git a/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart b/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart index 51f7e73c..b6361dba 100644 --- a/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart +++ b/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart @@ -8,7 +8,7 @@ import 'package:eatvio_app/widgets/custom_outlined_button.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; -class MedicineIntakeScreen extends StatelessWidget { +class MedicineIntakeScreen extends StatefulWidget { const MedicineIntakeScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { @@ -19,6 +19,11 @@ class MedicineIntakeScreen extends StatelessWidget { child: MedicineIntakeScreen()); } + @override + State createState() => _MedicineIntakeScreenState(); +} + +class _MedicineIntakeScreenState extends State { @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); diff --git a/lib/presentation/schedule_screen/schedule_screen.dart b/lib/presentation/schedule_screen/schedule_screen.dart index 3e29f648..c208cb5b 100644 --- a/lib/presentation/schedule_screen/schedule_screen.dart +++ b/lib/presentation/schedule_screen/schedule_screen.dart @@ -8,7 +8,7 @@ import 'package:eatvio_app/widgets/custom_outlined_button.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; -class ScheduleScreen extends StatelessWidget { +class ScheduleScreen extends StatefulWidget { const ScheduleScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { @@ -19,6 +19,11 @@ class ScheduleScreen extends StatelessWidget { child: ScheduleScreen()); } + @override + State createState() => _ScheduleScreenState(); +} + +class _ScheduleScreenState extends State { @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); diff --git a/lib/presentation/weight_screen/weight_screen.dart b/lib/presentation/weight_screen/weight_screen.dart index 78a00e21..a77ab141 100644 --- a/lib/presentation/weight_screen/weight_screen.dart +++ b/lib/presentation/weight_screen/weight_screen.dart @@ -8,7 +8,7 @@ import 'package:eatvio_app/widgets/custom_drop_down.dart'; import 'package:eatvio_app/widgets/custom_outlined_button.dart'; import 'package:flutter/material.dart'; -class WeightScreen extends StatelessWidget { +class WeightScreen extends StatefulWidget { const WeightScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { @@ -19,6 +19,11 @@ class WeightScreen extends StatelessWidget { child: WeightScreen()); } + @override + State createState() => _WeightScreenState(); +} + +class _WeightScreenState extends State { @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); @@ -74,7 +79,7 @@ class WeightScreen extends StatelessWidget { } /// Section Widget - Widget _buildTwentySixWidget(BuildContext context) { + Widget _buildWeight(BuildContext context) { return Column(children: [ Text("your_weight".tr, style: theme.textTheme.bodyLarge), SizedBox(height: 4.v), @@ -106,7 +111,7 @@ class WeightScreen extends StatelessWidget { return Column(children: [ Text("weight_measurements".tr, style: theme.textTheme.headlineSmall), SizedBox(height: 174.v), - _buildTwentySixWidget(context) + _buildWeight(context) ]); } From d923503eb48b29e964f09ed93b95da83213496da Mon Sep 17 00:00:00 2001 From: maxxkim Date: Tue, 19 Dec 2023 17:31:43 +0300 Subject: [PATCH 02/22] Progress bar fix, placeholder fix --- assets/images/img_female.png | Bin 0 -> 2495 bytes assets/images/img_male.png | Bin 0 -> 2387 bytes lib/localization/ru/ru_translations.dart | 1 + .../additional_information_screen.dart | 31 +++++----- .../allergies_screen/allergies_screen.dart | 2 +- .../blood_pressure_screen.dart | 2 +- .../body_circumferences_screen.dart | 2 +- .../city_of_living_screen.dart | 9 +-- .../date_of_birth_screen.dart | 17 +++++- .../favorite_foods_screen.dart | 16 ++++- .../favorite_sports_screen.dart | 17 +++++- .../gender_screen/gender_screen.dart | 57 ++++++++++++++++-- .../height_screen/height_screen.dart | 2 +- .../language_select_screen.dart | 16 ++++- .../medicine_intake_screen.dart | 2 +- .../schedule_screen/schedule_screen.dart | 16 ++++- .../weight_screen/weight_screen.dart | 2 +- 17 files changed, 153 insertions(+), 39 deletions(-) create mode 100644 assets/images/img_female.png create mode 100644 assets/images/img_male.png diff --git a/assets/images/img_female.png b/assets/images/img_female.png new file mode 100644 index 0000000000000000000000000000000000000000..39e3e4a34102048e722158e706173aeab9138fb5 GIT binary patch literal 2495 zcmV;w2|)IVP)=E)Fc(qWt!9**h8i^iMMGYQCj6DRK;tuVM_i%>~ng4=f=i%?8J8L zT*tm2$@2BR$3p({`*;2Z!A6>NpVtLXbl|RfK+z;`X##|1Jw+{{c~HJgTzMBlOfkld z5S01-MqdzY0$~%02qrk{@?SnF+?5)5_XCtwgV^yRKzX&i-lf_Kc`uI80^riDe4htc zoCTbl2AG?YuW7*0f+<@Vh`c`x+l|c>bW;R8sJH4uxI3kF>B8IS6}wshs#{izlqC@{ z@xfid;27O{hr}EnBcwz>A`~MdL4b zsMuBzNULO%y-G;3$l*J;u0xKa*c1o!qoiM?+&@_lEbS+pRL@s~mhA~v#z|2bV(|E<7-sfmBW2FTh1tys5w zQIuDo;|G3TIPRJ*5o=tWy)ts=)_KU1tOO*NWn#HkX4NJY>++ph^M$M}DK^4q1Ac*? z_H0}_V*yvh`%q}@8kg~|7+|JMFq6F|N6)cLMa(D$M#X!%L*w;rP%NmV=c(|r|M`72 z4X^YE%(1k4GHDAK6>tBKHD32!C_0{diMoCNX`|q z*miyNiy#j#A4pZ+q>O!460ObA`cvhpecn~$8hDEqitNxNr_mNpI65_o4!F6h5*0FgUCYP0upHqgJQ{q~Uo)I90Hd zK?Q`G+XmDl$wUe03WsRLz}B1BumhTyl5Py)ilg*V3Fx?QW+*pCI7Zh>KZi;{4@;KQy6DZWVD>RCO%neITj(C})a)yk9jB}<7$9*$K4m8X7CmP&p zMW{^{c(C3BZyeaBu0Mas;p*UG(r54cpTNgvDEjQOuQGalV`vG+17X;7NHfM>b2DW1 zVVlaA@&ATkUrjmet97f-kCz18_{WmEuJbZ@UxIB&7e*2gXkoXF1vFXF z)xiaIy|WDA^2yZynSVI-T=e?41M}*;c0&Ss?Oq&oW9W&BWyC?v10AoIt!fi%oz(Vy z|5LCP%jmSUCe}9tN+1!7N_6E|*R?Em5ekKZ5ztB?mN4YXBw~b)L(eRdTsIOk3xR?W zkgTlZ^=G0{=@Q|?@n`OO;drGIxKNM+3R7)hu^CDpu`w>T?xQj$5+kWi_gg!_c0wxg z1q;Fg$z3UV5UFBZY>Z5mXf~Cl8CeGkQ;y1@35zpe7qJO~pxQ23jH7#R_s>N?Uudn6 z1^9;7$Y+nTKnyZ2_!QXW!X#d7ZFkjJT(h<#w~n|n(f!s=+u|Y8emwwbfr9yI!=4?G z%$ph%{3KkxWy&Wf@N+!|@*~A~gAs%&T1+wdY<1c31{ltc3g)lp8IpVw&x5`66?C}qfyWO>&& zdgu1fl08p3q%SahhM9e(olvOPG1(jB$Wxx`k#bBtV15#;sn?#kW`eUk4?nVj^=wNorG5GP)`ge-!thqr_(;I zc|nSYwGDgw@&Et!LHRCku`WobfdU-ACdK2&5)0;3q&=}36>(<72kuI5v6VN<@-h^U z$Y^Fd&JqE=#S#-$%=`4+jKw1|p4yL!7#!CzG+!&o61QrJBTE$=zfRWYm*RatQ}Kwb z)<%$sfvJh#*HyWz*cU@qiL=#CaFazc)p_{nUXQ?qGk)W50my<4uZw8XPn>1~ySdix z6)_B7Y3+NEq8DJAPfQIR4RK;IthtMX{thaRu!A~h6=?DS4>PE7-`+p_j zf{56|VeU#~HZ51=@gVM2O{QmES)_NrMjMssJgU4~C1utJe+M1Yv8#maWlgbg<<@*S=BD6}5gxc17AsjYGY^V|l+lV8W;AqJI`E}uM(m^`{(9i;6@3R1VTIBOS)mO;23}UN*50~Zp zeSincfGbM?D~s~A1Q=VjWDgUOkH%rQxt)S;i-1RsUPB1~fV3_{Xq}qa*A39py-}nR zam2*i*8%NWYI>K%oH9QcfeKSG0m<4JUmF0#GmdDY^%#J^5h{wbQnYV6Vp=F*FwO!K z(kd;e0A&|2L%5bMO&oj`1i5JyAj`yCV}OzC76|d~^tG$!pv;t2z%JwDDG+#8v~=tI z`8QQ;a|O~W*}||Ak}PuS+LcRCCdwk9v^w1<)-Q6c(-0l~RkOG)At7geEeE6M2*+J- zm&2`n@Pu?9?;8OB?!SsdZ*=m*r&FV-E0OV+LJA^wvOE7h)z<#)$nC}XkKqX@*#Z-> zZvCv-({hHt{7d(^YoR#S_+a_M^tCH*Ly43mAh|3P>%($X4XRjI>5;Wk$lQ`*BYZX% z78vL+#iffDFe%=+(ED{R<6SMlEIGg|3|kxnJ;jPxR18ds_xzhWZ|{RzK@EC=MveVH z9NORU!f3>rEqEqVuz)G?j{I2XZQp~M<7>~+R8nKnkBSnpAOSNhuNK8~*xO#TB{C=g zHDFN8`_`*a>j?Q9WiG3u{LMkb(6;Kor3H2!|KWL=JB9e6H=tgim?)F&R(3DaAoIkr z&H8RCAWh9g!@l407k(z6l;NyfdI_;>%H?YJbl zT*zeG_tCFx9$$YsUwV@_2Kq$oyo`JGD;^<#yUcYp84oY!>yp!j6Rz9xbN=EPsC#63 zBi9%8XZAmB<(fC=wm`WgrRKLD3bn$7Fqmsp-XLJt@snre99OSv*Uf@PWm@B8ym5m| zW(Y_Fhg|D9RV#Dca-tSZ5C^iYkY#>YGd%0d1MM8PbZgmGnCZf_9DlI(XB(v=4t`%* zVR~Ci!0uyxA-Q{|tNmGzoTykRcNl|4pW(En1mq|};=nQR*c{rPWrC-yPzgxO^N8@4 zYd3>jgxcE%G@QXi3FwQ*=)}Oz+t;WDv@s>!7~+j5=%W(QbKl}nZj8`F&q_e)z9-aT zqDMi8Ku1mYEK<5p$6^xCs(abIakNx&Osd&*>IN?%Sp@Wuc$jE)g(c zbb3J>>)QpzKF5uFIv;PNI%1B`uH_tDs)?%vBxqnD(%rbHGZ7QV=hnb&xK6-yk;w9T z4)0PzlI4xhu7lf<0t!oAU~vgItXOI=AvbnhncUY^#8&BF+jSO5I62_qR)1>r&CUy} z&cmq81BE45Wzd2LQE(GZ93_fV*2Oup_ zurOWNa~tDxk6qSv?n{tnLM$Tf#_?}<4f7WVz@u>JiiEg3*TdpIze$(#Jc>iz5QUX6 zQ+I1)_g$6BxSo|o5K^nn@WP2xaXg8oC|fC zTM3wmgR^!ryY|=&nLw*s@xIjw`ltj<)EGdMZh3ob4&F(W6rlJ=4{2v(V90ahtx0!Z zA|+thysX?9?|3OqUZ_flebWkGzdGtPWt|TcL-^Skc;trN8j}*?U`AW|2hMg~z~yP% zZF6H+AO{bi;uS1Dk=~pkpc+i16|(t1gGVN+Xa%xMVe>;PqdmJLSs^S>SzatmBWZop z=Hhx-zU3aA_alWZ{ zK&-F+Bs}rKM80mD-WQgxJbB=mgUz^RzoIIx)e-pV-{rLJ-$OGKSAVxzzb$X9@9+4| zB(7M!^05_~>*Ex^ihE0!!&1C0@4Rift(h2=^HFf!n3Rao=@9svv|3AVl;ssE9#K@~ zq6|v})M_Ors+jlb--;HGD7ySzN<@3kz}Wp(L6*2vQyiJ9;M^s$zOWSU2gQmE zM2sxX|EaCn-^{+4Or$tFt%93Ok}1!_yElgfuAUB?|BOHhJaGlfpmFjP6L_BM{hHVz zH{BB>?XZpU)pOJ4l?(6$l&J)0ug--3JT!bG6nAqmM*C)>UZ6c|(p0q+m(8ZEMQF(y zQNUSfJ*M-HAGxRqZ4}u2Ux1eBXjLWbwj#9IbQyhvLh!egkW@mTT6rT`+^v6*a5f?i zaag(F?535A3Krt-)#dPPD2vpN=yXw;>QPnPDrscB{Vz~EjI>EsA>kahr4)S7=nEki zp~S8DPIc>BJoRk(ER(92N2eZ(2EydXhG?e|D$F+jF#@_Kzt>yk*PX-P2JVpL_{XVpO;Y3ZY!F;nh6nw7G)Tx_d=*(3!GGR_UT zW7AG|&wwue$ahS ru = { // language_select Screen "lbl_english": "English", + "finish": "Завершить", "preferred_language": "Предпочетаемый язык общения?", // Common String diff --git a/lib/presentation/additional_information_screen/additional_information_screen.dart b/lib/presentation/additional_information_screen/additional_information_screen.dart index 3265f0e0..295a98d7 100644 --- a/lib/presentation/additional_information_screen/additional_information_screen.dart +++ b/lib/presentation/additional_information_screen/additional_information_screen.dart @@ -39,15 +39,22 @@ class _AdditionalInformationScreenState padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), child: Column(children: [ SizedBox(height: 7.v), - _buildProgressIndicator(context), + 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, + backgroundColor: theme.colorScheme.onPrimary, + valueColor: AlwaysStoppedAnimation( + appTheme.blueA400)))), SizedBox(height: 20.v), - SizedBox( - width: 192.h, - child: Text("additional_information".tr, - maxLines: 2, - overflow: TextOverflow.ellipsis, - textAlign: TextAlign.center, - style: theme.textTheme.headlineSmall)), SizedBox(height: 73.v), _buildTextFormField(context), Spacer(), @@ -58,7 +65,7 @@ class _AdditionalInformationScreenState showSuccessMessage(context); }), SizedBox(height: 17.v), - Text("skip".tr, style: theme.textTheme.bodyLarge) + Text("finish".tr, style: theme.textTheme.bodyLarge) ])))); } @@ -98,12 +105,6 @@ class _AdditionalInformationScreenState height: 257.v, width: 343.h, child: Stack(alignment: Alignment.center, children: [ - Align( - alignment: Alignment.topLeft, - child: Padding( - padding: EdgeInsets.only(left: 10.h, top: 69.v), - child: Text("enter_information".tr, - style: theme.textTheme.bodyLarge))), Align( alignment: Alignment.center, child: Column(mainAxisSize: MainAxisSize.min, children: [ diff --git a/lib/presentation/allergies_screen/allergies_screen.dart b/lib/presentation/allergies_screen/allergies_screen.dart index e98c2c54..5ea99b12 100644 --- a/lib/presentation/allergies_screen/allergies_screen.dart +++ b/lib/presentation/allergies_screen/allergies_screen.dart @@ -47,7 +47,7 @@ class _AllergiesScreenState extends State { child: ClipRRect( borderRadius: BorderRadius.circular(8.h), child: LinearProgressIndicator( - value: 0.41, + value: 0.62, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation( appTheme.blueA400)))), diff --git a/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart b/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart index 79c3832e..a1c940af 100644 --- a/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart +++ b/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart @@ -51,7 +51,7 @@ class _BloodPressureScreenState extends State { child: ClipRRect( borderRadius: BorderRadius.circular(8.h), child: LinearProgressIndicator( - value: 0.63, + value: 0.76, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation( appTheme.blueA400))))), diff --git a/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart b/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart index 986271d2..5effd99e 100644 --- a/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart +++ b/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart @@ -48,7 +48,7 @@ class _BodyCircumferencesScreenState extends State { child: ClipRRect( borderRadius: BorderRadius.circular(8.h), child: LinearProgressIndicator( - value: 0.29, + value: 0.40, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation( appTheme.blueA400)))), diff --git a/lib/presentation/city_of_living_screen/city_of_living_screen.dart b/lib/presentation/city_of_living_screen/city_of_living_screen.dart index 90688e46..ca154c0b 100644 --- a/lib/presentation/city_of_living_screen/city_of_living_screen.dart +++ b/lib/presentation/city_of_living_screen/city_of_living_screen.dart @@ -8,7 +8,7 @@ import 'package:eatvio_app/widgets/custom_drop_down.dart'; import 'package:eatvio_app/widgets/custom_outlined_button.dart'; import 'package:flutter/material.dart'; -class CityOfLivingScreen extends StatefulWidget { +class CityOfLivingScreen extends StatelessWidget { const CityOfLivingScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { @@ -19,11 +19,6 @@ class CityOfLivingScreen extends StatefulWidget { child: CityOfLivingScreen()); } - @override - State createState() => _CityOfLivingScreenState(); -} - -class _CityOfLivingScreenState extends State { @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); @@ -46,7 +41,7 @@ class _CityOfLivingScreenState extends State { child: ClipRRect( borderRadius: BorderRadius.circular(8.h), child: LinearProgressIndicator( - value: 0.23, + value: 0.32, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation( appTheme.blueA400)))), diff --git a/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart b/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart index 26b3a1ab..1d0037fb 100644 --- a/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart +++ b/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart @@ -37,8 +37,21 @@ class _DateOfBirthScreenState extends State { padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), child: Column(children: [ - SizedBox(height: 7.v), - _buildProgressIndicator(context), + 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.24, + backgroundColor: theme.colorScheme.onPrimary, + valueColor: AlwaysStoppedAnimation( + appTheme.blueA400)))), SizedBox(height: 38.v), Text("date_of_birth".tr, style: theme.textTheme.headlineSmall), diff --git a/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart b/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart index 8619d3d1..c3d58c68 100644 --- a/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart +++ b/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart @@ -36,7 +36,21 @@ class _FavoriteFoodsScreenState extends State { padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), child: Column(children: [ SizedBox(height: 7.v), - _buildProgressIndicator(context), + 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.90, + backgroundColor: theme.colorScheme.onPrimary, + valueColor: AlwaysStoppedAnimation( + appTheme.blueA400)))), SizedBox(height: 19.v), Container( width: 327.h, diff --git a/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart b/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart index aa4c0b37..543a1465 100644 --- a/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart +++ b/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart @@ -38,7 +38,22 @@ class _FavoriteSportsScreenState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox(height: 20.v), - _buildProgressIndicatorSection(context), + 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.83, + backgroundColor: theme.colorScheme.onPrimary, + valueColor: AlwaysStoppedAnimation( + appTheme.blueA400)))), SizedBox(height: 38.v), Text("your_favorite_sports".tr, style: theme.textTheme.headlineSmall), diff --git a/lib/presentation/gender_screen/gender_screen.dart b/lib/presentation/gender_screen/gender_screen.dart index 6cf57ebc..66c4f3ff 100644 --- a/lib/presentation/gender_screen/gender_screen.dart +++ b/lib/presentation/gender_screen/gender_screen.dart @@ -7,6 +7,8 @@ import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; import 'package:eatvio_app/widgets/custom_outlined_button.dart'; import 'package:flutter/material.dart'; +enum Gender { male, female } + class GenderScreen extends StatefulWidget { const GenderScreen({Key? key}) : super(key: key); @@ -23,6 +25,7 @@ class GenderScreen extends StatefulWidget { } class _GenderScreenState extends State { + Gender? _gender; @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); @@ -36,14 +39,58 @@ class _GenderScreenState extends State { EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), child: Column(children: [ SizedBox(height: 7.v), - _buildProgressIndicator(context), + 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.16, + backgroundColor: theme.colorScheme.onPrimary, + valueColor: AlwaysStoppedAnimation( + appTheme.blueA400)))), SizedBox(height: 36.v), Text("your_gender".tr, style: theme.textTheme.headlineSmall), - Spacer(flex: 33), - Text(""), - SizedBox(height: 20.v), - Text(""), + RadioListTile( + title: Text('Мужской'), + value: Gender.male, + groupValue: _gender, + onChanged: (value) { + setState(() { + _gender = value as Gender?; + }); + }, + secondary: Image.asset( + _gender == Gender.male + ? 'assets/images/img_male.png' + : 'assets/images/img_male.png', + width: 40, + height: 40, + ), + ), + RadioListTile( + title: Text('Женский'), + value: Gender.female, + groupValue: _gender, + onChanged: (value) { + setState(() { + _gender = value as Gender?; + }); + }, + secondary: Image.asset( + _gender == Gender.female + ? 'assets/images/img_female.png' + : 'assets/images/img_female.png', + width: 40, + height: 40, + ), + ), Spacer(flex: 66), CustomOutlinedButton( text: "continue".tr.toUpperCase(), diff --git a/lib/presentation/height_screen/height_screen.dart b/lib/presentation/height_screen/height_screen.dart index 61108c63..0747e66b 100644 --- a/lib/presentation/height_screen/height_screen.dart +++ b/lib/presentation/height_screen/height_screen.dart @@ -46,7 +46,7 @@ class _HeightScreenState extends State { child: ClipRRect( borderRadius: BorderRadius.circular(8.h), child: LinearProgressIndicator( - value: 0.35, + value: 0.55, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation( appTheme.blueA400)))), diff --git a/lib/presentation/language_select_screen/language_select_screen.dart b/lib/presentation/language_select_screen/language_select_screen.dart index aa3a759e..c947456e 100644 --- a/lib/presentation/language_select_screen/language_select_screen.dart +++ b/lib/presentation/language_select_screen/language_select_screen.dart @@ -35,7 +35,21 @@ class _LanguageSelectScreenState extends State { height: 50.adaptSize, width: 50.adaptSize), SizedBox(height: 20.v), - _buildProgressIndicatorSection(context), + 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.08, + backgroundColor: theme.colorScheme.onPrimary, + valueColor: AlwaysStoppedAnimation( + appTheme.blueA400)))), SizedBox(height: 20.v), Container( width: 262.h, diff --git a/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart b/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart index b6361dba..7ca0eabd 100644 --- a/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart +++ b/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart @@ -47,7 +47,7 @@ class _MedicineIntakeScreenState extends State { child: ClipRRect( borderRadius: BorderRadius.circular(8.h), child: LinearProgressIndicator( - value: 0.47, + value: 0.69, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation( appTheme.blueA400)))), diff --git a/lib/presentation/schedule_screen/schedule_screen.dart b/lib/presentation/schedule_screen/schedule_screen.dart index c208cb5b..636bea39 100644 --- a/lib/presentation/schedule_screen/schedule_screen.dart +++ b/lib/presentation/schedule_screen/schedule_screen.dart @@ -36,7 +36,21 @@ class _ScheduleScreenState extends State { padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v), child: Column(children: [ SizedBox(height: 7.v), - _buildProgressIndicator(context), + 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.95, + backgroundColor: theme.colorScheme.onPrimary, + valueColor: AlwaysStoppedAnimation( + appTheme.blueA400)))), SizedBox(height: 38.v), Text("your_schedule".tr, style: theme.textTheme.headlineSmall), diff --git a/lib/presentation/weight_screen/weight_screen.dart b/lib/presentation/weight_screen/weight_screen.dart index a77ab141..abe19eb4 100644 --- a/lib/presentation/weight_screen/weight_screen.dart +++ b/lib/presentation/weight_screen/weight_screen.dart @@ -46,7 +46,7 @@ class _WeightScreenState extends State { child: ClipRRect( borderRadius: BorderRadius.circular(8.h), child: LinearProgressIndicator( - value: 0.35, + value: 0.48, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation( appTheme.blueA400)))), From 299b0b6130d132eb353e8f635784bc2471660d2d Mon Sep 17 00:00:00 2001 From: maxxkim Date: Wed, 20 Dec 2023 17:07:20 +0300 Subject: [PATCH 03/22] Added new screens (credentials and name) --- .../user_registration_model.dart | 0 lib/localization/ru/ru_translations.dart | 9 +- .../bloc/credentials_bloc.dart | 23 ++++ .../bloc/credentials_event.dart | 16 +++ .../bloc/credentials_state.dart | 42 ++++++ .../credentials_screen.dart | 130 ++++++++++++++++++ .../models/credentials_model.dart | 16 +++ .../date_of_birth_screen.dart | 2 +- .../language_select_screen.dart | 8 +- .../name_screen/bloc/name_bloc.dart | 23 ++++ .../name_screen/bloc/name_event.dart | 16 +++ .../name_screen/bloc/name_state.dart | 42 ++++++ .../name_screen/models/name_model.dart | 16 +++ lib/presentation/name_screen/name_screen.dart | 114 +++++++++++++++ lib/routes/app_routes.dart | 9 ++ 15 files changed, 460 insertions(+), 6 deletions(-) create mode 100644 lib/data/models/userRegistrationModel/user_registration_model.dart create mode 100644 lib/presentation/credentials_screen/bloc/credentials_bloc.dart create mode 100644 lib/presentation/credentials_screen/bloc/credentials_event.dart create mode 100644 lib/presentation/credentials_screen/bloc/credentials_state.dart create mode 100644 lib/presentation/credentials_screen/credentials_screen.dart create mode 100644 lib/presentation/credentials_screen/models/credentials_model.dart create mode 100644 lib/presentation/name_screen/bloc/name_bloc.dart create mode 100644 lib/presentation/name_screen/bloc/name_event.dart create mode 100644 lib/presentation/name_screen/bloc/name_state.dart create mode 100644 lib/presentation/name_screen/models/name_model.dart create mode 100644 lib/presentation/name_screen/name_screen.dart diff --git a/lib/data/models/userRegistrationModel/user_registration_model.dart b/lib/data/models/userRegistrationModel/user_registration_model.dart new file mode 100644 index 00000000..e69de29b diff --git a/lib/localization/ru/ru_translations.dart b/lib/localization/ru/ru_translations.dart index 83806f19..012f1bda 100644 --- a/lib/localization/ru/ru_translations.dart +++ b/lib/localization/ru/ru_translations.dart @@ -1,10 +1,17 @@ final Map ru = { + "user_registration": "Регистрация пользователя", + "email": "Элетронная почта", + "password": "Пароль", + "password_confirmation": "Подтвердите пароль", + "first_name": "Имя", + "last_name": "Фамилия", + // date_of_birth Screen "date_of_birth": "Дата рождения", - // city_of_living Screen "country": "Страна", "Russia": "Россия", "city": "Город", "Moscow": "Москва", "place_of_living": "Место проживания", + "what_is_your_name": "Как вас зовут?", // body_circumferences Screen "hip_circumference": "Обхват бедр", "chest_circumference": "Обхват груди", diff --git a/lib/presentation/credentials_screen/bloc/credentials_bloc.dart b/lib/presentation/credentials_screen/bloc/credentials_bloc.dart new file mode 100644 index 00000000..fe83f536 --- /dev/null +++ b/lib/presentation/credentials_screen/bloc/credentials_bloc.dart @@ -0,0 +1,23 @@ +import 'package:equatable/equatable.dart'; +import 'package:flutter/material.dart'; +import '/core/app_export.dart'; +import 'package:eatvio_app/presentation/credentials_screen/models/credentials_model.dart'; +part 'credentials_event.dart'; +part 'credentials_state.dart'; + +/// A bloc that manages the state of a Credentials according to the event that is dispatched to it. +class CredentialsBloc extends Bloc { + CredentialsBloc(CredentialsState initialState) : super(initialState) { + on(_onInitialize); + } + + _onInitialize( + CredentialsInitialEvent event, + Emitter emit, + ) async { + emit(state.copyWith( + valueController: TextEditingController(), + valueController1: TextEditingController(), + valueController2: TextEditingController())); + } +} diff --git a/lib/presentation/credentials_screen/bloc/credentials_event.dart b/lib/presentation/credentials_screen/bloc/credentials_event.dart new file mode 100644 index 00000000..3001076a --- /dev/null +++ b/lib/presentation/credentials_screen/bloc/credentials_event.dart @@ -0,0 +1,16 @@ +// ignore_for_file: must_be_immutable + +part of 'credentials_bloc.dart'; + +/// Abstract class for all events that can be dispatched from the +///Credentials widget. +/// +/// Events must be immutable and implement the [Equatable] interface. +@immutable +abstract class CredentialsEvent extends Equatable {} + +/// Event that is dispatched when the Credentials widget is first created. +class CredentialsInitialEvent extends CredentialsEvent { + @override + List get props => []; +} diff --git a/lib/presentation/credentials_screen/bloc/credentials_state.dart b/lib/presentation/credentials_screen/bloc/credentials_state.dart new file mode 100644 index 00000000..c59dec31 --- /dev/null +++ b/lib/presentation/credentials_screen/bloc/credentials_state.dart @@ -0,0 +1,42 @@ +// ignore_for_file: must_be_immutable + +part of 'credentials_bloc.dart'; + +/// Represents the state of Credentials in the application. +class CredentialsState extends Equatable { + CredentialsState({ + this.valueController, + this.valueController1, + this.valueController2, + this.credentialsModelObj, + }); + + TextEditingController? valueController; + + TextEditingController? valueController1; + + TextEditingController? valueController2; + + CredentialsModel? credentialsModelObj; + + @override + List get props => [ + valueController, + valueController1, + valueController2, + credentialsModelObj, + ]; + CredentialsState copyWith({ + TextEditingController? valueController, + TextEditingController? valueController1, + TextEditingController? valueController2, + CredentialsModel? credentialsModelObj, + }) { + return CredentialsState( + valueController: valueController ?? this.valueController, + valueController1: valueController1 ?? this.valueController1, + valueController2: valueController2 ?? this.valueController2, + credentialsModelObj: credentialsModelObj ?? this.credentialsModelObj, + ); + } +} diff --git a/lib/presentation/credentials_screen/credentials_screen.dart b/lib/presentation/credentials_screen/credentials_screen.dart new file mode 100644 index 00000000..091f5b29 --- /dev/null +++ b/lib/presentation/credentials_screen/credentials_screen.dart @@ -0,0 +1,130 @@ +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/custom_outlined_button.dart'; +import 'package:eatvio_app/widgets/custom_text_form_field.dart'; +import 'package:flutter/material.dart'; + +class CredentialsScreen extends StatefulWidget { + const CredentialsScreen({Key? key}) : super(key: key); + + static Widget builder(BuildContext context) { + return BlocProvider( + create: (context) => CredentialsBloc( + CredentialsState(credentialsModelObj: CredentialsModel())) + ..add(CredentialsInitialEvent()), + child: CredentialsScreen()); + } + + @override + State createState() => _CredentialsScreenState(); +} + +class _CredentialsScreenState extends State { + @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.valueController1, + builder: (context, valueController1) { + return CustomTextFormField( + controller: valueController1, + textInputAction: TextInputAction.done); + }), + SizedBox(height: 19.v), + Text("password".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 5.v), + BlocSelector( + selector: (state) => state.valueController2, + builder: (context, valueController2) { + return CustomTextFormField( + obscureText: true, + controller: valueController2, + ); + }), + SizedBox(height: 21.v), + Text("password_confirmation".tr, + style: theme.textTheme.bodyLarge), + SizedBox(height: 3.v), + BlocSelector( + selector: (state) => state.valueController, + builder: (context, valueController3) { + return CustomTextFormField( + obscureText: true, + controller: valueController3, + textInputAction: TextInputAction.done); + }), + Spacer(), + CustomOutlinedButton( + text: "continue".tr.toUpperCase(), + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + onPressed: () { + navigateToName(context); + }), + SizedBox(height: 17.v), + Text("skip".tr, style: theme.textTheme.bodyLarge) + ])))); + } + + /// 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(); + } + + /// Navigates to the weightScreen when the action is triggered. + navigateToName(BuildContext context) { + NavigatorService.pushNamed( + AppRoutes.nameScreen, + ); + } +} diff --git a/lib/presentation/credentials_screen/models/credentials_model.dart b/lib/presentation/credentials_screen/models/credentials_model.dart new file mode 100644 index 00000000..57ae6d7c --- /dev/null +++ b/lib/presentation/credentials_screen/models/credentials_model.dart @@ -0,0 +1,16 @@ +// ignore_for_file: must_be_immutable + +import 'package:equatable/equatable.dart'; + +/// This class defines the variables used in the [credentials_screen], +/// and is typically used to hold data that is passed between different parts of the application. +class CredentialsModel extends Equatable { + CredentialsModel() {} + + CredentialsModel copyWith() { + return CredentialsModel(); + } + + @override + List get props => []; +} diff --git a/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart b/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart index 1d0037fb..b9325910 100644 --- a/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart +++ b/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart @@ -148,7 +148,7 @@ class _DateOfBirthScreenState extends State { DateTime? dateTime = await showDatePicker( context: context, initialDate: DateTime.now(), - firstDate: DateTime(1970), + firstDate: DateTime(1924), lastDate: DateTime( DateTime.now().year, DateTime.now().month, DateTime.now().day)); if (dateTime != null) { diff --git a/lib/presentation/language_select_screen/language_select_screen.dart b/lib/presentation/language_select_screen/language_select_screen.dart index c947456e..d3683263 100644 --- a/lib/presentation/language_select_screen/language_select_screen.dart +++ b/lib/presentation/language_select_screen/language_select_screen.dart @@ -46,7 +46,7 @@ class _LanguageSelectScreenState extends State { child: ClipRRect( borderRadius: BorderRadius.circular(8.h), child: LinearProgressIndicator( - value: 0.08, + value: 0, backgroundColor: theme.colorScheme.onPrimary, valueColor: AlwaysStoppedAnimation( appTheme.blueA400)))), @@ -112,14 +112,14 @@ class _LanguageSelectScreenState extends State { margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, onPressed: () { - navigteToGender(context); + navigteToCredentials(context); }); } /// Navigates to the genderScreen when the action is triggered. - navigteToGender(BuildContext context) { + navigteToCredentials(BuildContext context) { NavigatorService.pushNamed( - AppRoutes.genderScreen, + AppRoutes.credentialsScreen, ); } } diff --git a/lib/presentation/name_screen/bloc/name_bloc.dart b/lib/presentation/name_screen/bloc/name_bloc.dart new file mode 100644 index 00000000..7611e222 --- /dev/null +++ b/lib/presentation/name_screen/bloc/name_bloc.dart @@ -0,0 +1,23 @@ +import 'package:equatable/equatable.dart'; +import 'package:flutter/material.dart'; +import '/core/app_export.dart'; +import 'package:eatvio_app/presentation/name_screen/models/name_model.dart'; +part 'name_event.dart'; +part 'name_state.dart'; + +/// A bloc that manages the state of a Name according to the event that is dispatched to it. +class NameBloc extends Bloc { + NameBloc(NameState initialState) : super(initialState) { + on(_onInitialize); + } + + _onInitialize( + NameInitialEvent event, + Emitter emit, + ) async { + emit(state.copyWith( + valueController: TextEditingController(), + valueController1: TextEditingController(), + valueController2: TextEditingController())); + } +} diff --git a/lib/presentation/name_screen/bloc/name_event.dart b/lib/presentation/name_screen/bloc/name_event.dart new file mode 100644 index 00000000..7e102994 --- /dev/null +++ b/lib/presentation/name_screen/bloc/name_event.dart @@ -0,0 +1,16 @@ +// ignore_for_file: must_be_immutable + +part of 'name_bloc.dart'; + +/// Abstract class for all events that can be dispatched from the +///Name widget. +/// +/// Events must be immutable and implement the [Equatable] interface. +@immutable +abstract class NameEvent extends Equatable {} + +/// Event that is dispatched when the Name widget is first created. +class NameInitialEvent extends NameEvent { + @override + List get props => []; +} diff --git a/lib/presentation/name_screen/bloc/name_state.dart b/lib/presentation/name_screen/bloc/name_state.dart new file mode 100644 index 00000000..d729b067 --- /dev/null +++ b/lib/presentation/name_screen/bloc/name_state.dart @@ -0,0 +1,42 @@ +// ignore_for_file: must_be_immutable + +part of 'name_bloc.dart'; + +/// Represents the state of Name in the application. +class NameState extends Equatable { + NameState({ + this.valueController, + this.valueController1, + this.valueController2, + this.nameModelObj, + }); + + TextEditingController? valueController; + + TextEditingController? valueController1; + + TextEditingController? valueController2; + + NameModel? nameModelObj; + + @override + List get props => [ + valueController, + valueController1, + valueController2, + nameModelObj, + ]; + NameState copyWith({ + TextEditingController? valueController, + TextEditingController? valueController1, + TextEditingController? valueController2, + NameModel? nameModelObj, + }) { + return NameState( + valueController: valueController ?? this.valueController, + valueController1: valueController1 ?? this.valueController1, + valueController2: valueController2 ?? this.valueController2, + nameModelObj: nameModelObj ?? this.nameModelObj, + ); + } +} diff --git a/lib/presentation/name_screen/models/name_model.dart b/lib/presentation/name_screen/models/name_model.dart new file mode 100644 index 00000000..22b22839 --- /dev/null +++ b/lib/presentation/name_screen/models/name_model.dart @@ -0,0 +1,16 @@ +// ignore_for_file: must_be_immutable + +import 'package:equatable/equatable.dart'; + +/// This class defines the variables used in the [name_screen], +/// and is typically used to hold data that is passed between different parts of the application. +class NameModel extends Equatable { + NameModel() {} + + NameModel copyWith() { + return NameModel(); + } + + @override + List get props => []; +} diff --git a/lib/presentation/name_screen/name_screen.dart b/lib/presentation/name_screen/name_screen.dart new file mode 100644 index 00000000..203513d6 --- /dev/null +++ b/lib/presentation/name_screen/name_screen.dart @@ -0,0 +1,114 @@ +import 'bloc/name_bloc.dart'; +import 'models/name_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/custom_outlined_button.dart'; +import 'package:eatvio_app/widgets/custom_text_form_field.dart'; +import 'package:flutter/material.dart'; + +class NameScreen extends StatefulWidget { + const NameScreen({Key? key}) : super(key: key); + + static Widget builder(BuildContext context) { + return BlocProvider( + create: (context) => NameBloc(NameState(nameModelObj: NameModel())) + ..add(NameInitialEvent()), + child: NameScreen()); + } + + @override + State createState() => _NameScreenState(); +} + +class _NameScreenState extends State { + @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.1, + backgroundColor: theme.colorScheme.onPrimary, + valueColor: AlwaysStoppedAnimation( + appTheme.blueA400)))), + SizedBox(height: 39.v), + Text("what_is_your_name".tr, + style: theme.textTheme.headlineSmall), + SizedBox(height: 93.v), + Text("first_name".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("last_name".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 5.v), + BlocSelector( + selector: (state) => state.valueController1, + builder: (context, valueController1) { + return CustomTextFormField( + controller: valueController1, + ); + }), + SizedBox(height: 21.v), + Spacer(), + CustomOutlinedButton( + text: "continue".tr.toUpperCase(), + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + onPressed: () { + navigateToGender(context); + }), + SizedBox(height: 17.v), + Text("skip".tr, style: theme.textTheme.bodyLarge) + ])))); + } + + /// 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(); + } + + /// Navigates to the weightScreen when the action is triggered. + navigateToGender(BuildContext context) { + NavigatorService.pushNamed( + AppRoutes.genderScreen, + ); + } +} diff --git a/lib/routes/app_routes.dart b/lib/routes/app_routes.dart index 50e3bdfd..a9adebc0 100644 --- a/lib/routes/app_routes.dart +++ b/lib/routes/app_routes.dart @@ -1,3 +1,4 @@ +import 'package:eatvio_app/presentation/credentials_screen/models/credentials_model.dart'; import 'package:flutter/material.dart'; import 'package:eatvio_app/presentation/date_of_birth_screen/date_of_birth_screen.dart'; import 'package:eatvio_app/presentation/city_of_living_screen/city_of_living_screen.dart'; @@ -14,6 +15,8 @@ import 'package:eatvio_app/presentation/schedule_screen/schedule_screen.dart'; import 'package:eatvio_app/presentation/additional_information_screen/additional_information_screen.dart'; import 'package:eatvio_app/presentation/language_select_screen/language_select_screen.dart'; import 'package:eatvio_app/presentation/height_screen/height_screen.dart'; +import 'package:eatvio_app/presentation/credentials_screen/credentials_screen.dart'; +import 'package:eatvio_app/presentation/name_screen/name_screen.dart'; import 'package:eatvio_app/presentation/app_navigation_screen/app_navigation_screen.dart'; class AppRoutes { @@ -50,6 +53,10 @@ class AppRoutes { static const String languageSelectScreen = '/language_select_screen'; + static const String nameScreen = '/name_screen'; + + static const String credentialsScreen = '/credentials_screen'; + static const String appNavigationScreen = '/app_navigation_screen'; static const String initialRoute = '/initialRoute'; @@ -60,6 +67,8 @@ class AppRoutes { bodyCircumferencesScreen: BodyCircumferencesScreen.builder, weightScreen: WeightScreen.builder, heightScreen: HeightScreen.builder, + nameScreen: NameScreen.builder, + credentialsScreen: CredentialsScreen.builder, allergiesScreen: AllergiesScreen.builder, medicineIntakeScreen: MedicineIntakeScreen.builder, splashScreen: SplashScreen.builder, From 753709000fd5c892958ed87767f89a79df8a260f Mon Sep 17 00:00:00 2001 From: maxxkim Date: Thu, 21 Dec 2023 11:43:01 +0300 Subject: [PATCH 04/22] Created ew model for user egistration --- .../user_registration_model.dart | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/lib/data/models/userRegistrationModel/user_registration_model.dart b/lib/data/models/userRegistrationModel/user_registration_model.dart index e69de29b..7f32d56c 100644 --- a/lib/data/models/userRegistrationModel/user_registration_model.dart +++ b/lib/data/models/userRegistrationModel/user_registration_model.dart @@ -0,0 +1,102 @@ +import 'dart:convert'; +import 'package:http/http.dart' as http; + +class UserRegistrationSheet { + String firstName; + String lastName; + String email; + String password; + String passwordConfirmation; + bool termsAccepted; + DateTime birthdate; + String gender; + String country; + String city; + String lang; + int weight; + int height; + int chestCircumference; + int waistCircumference; + int hipCircumference; + int bloodPressureUp; + int bloodPressureDown; + bool hasHypo = false; + bool hasHyper = false; + String aboutAllergy = ''; + String aboutTakingPils = ''; + String aboutSportHobbies = ''; + String favoriteFoods = ''; + String unfavoriteFoods = ''; + String additionalInfo = ''; + + UserRegistrationSheet({ + required this.firstName, + required this.lastName, + required this.email, + required this.password, + required this.passwordConfirmation, + required this.termsAccepted, + required this.birthdate, + required this.gender, + required this.country, + required this.city, + required this.lang, + required this.weight, + required this.height, + required this.chestCircumference, + required this.waistCircumference, + required this.hipCircumference, + required this.bloodPressureUp, + required this.bloodPressureDown, + required this.hasHypo, + required this.hasHyper, + required this.aboutAllergy, + required this.aboutTakingPils, + required this.aboutSportHobbies, + required this.favoriteFoods, + required this.unfavoriteFoods, + required this.additionalInfo, + }); + + Map toJson() { + return { + 'first_name': firstName, + 'last_name': lastName, + 'email': email, + 'password': password, + 'password_confirmation': passwordConfirmation, + 'terms': termsAccepted, + 'birthdate': birthdate.toIso8601String(), + 'gender': gender, + 'country': country, + 'city': city, + 'lang': lang, + 'weight': weight, + 'height': height, + 'chest_circumference': chestCircumference, + 'waist_circumference': waistCircumference, + 'hip_circumference': hipCircumference, + 'blood_pressure_up': bloodPressureUp, + 'blood_pressure_down': bloodPressureDown, + 'has_hypo': hasHypo, + 'has_hyper': hasHyper, + 'about_alergy': aboutAllergy, + 'about_taking_pils': aboutTakingPils, + 'about_sport_hobbies': aboutSportHobbies, + 'favorite_foods': favoriteFoods, + 'unfavorite_foods': unfavoriteFoods, + 'additional_info': additionalInfo, + }; + } + + Future sendJson(Uri url) async { + final response = await http.post( + url, + headers: {'Content-Type': 'application/json'}, + body: jsonEncode(toJson()), + ); + if (response.statusCode != 200) { + throw Exception('Failed to send data'); + } + } +} From ac0f649069e1c535b71c4be6022b621014a3b213 Mon Sep 17 00:00:00 2001 From: maxxkim Date: Thu, 21 Dec 2023 12:28:41 +0300 Subject: [PATCH 05/22] Added Finish buttn, removed schedule screen, split blood pressure into up and down --- lib/localization/ru/ru_translations.dart | 2 + .../additional_information_screen.dart | 3 +- .../bloc/blood_pressure_bloc.dart | 3 +- .../bloc/blood_pressure_state.dart | 4 + .../blood_pressure_screen.dart | 36 ++++- .../favorite_foods_screen.dart | 23 +-- .../schedule_screen/bloc/schedule_bloc.dart | 20 --- .../schedule_screen/bloc/schedule_event.dart | 16 -- .../schedule_screen/bloc/schedule_state.dart | 31 ---- .../models/schedule_model.dart | 16 -- .../schedule_screen/schedule_screen.dart | 137 ------------------ lib/routes/app_routes.dart | 3 - 12 files changed, 46 insertions(+), 248 deletions(-) delete mode 100644 lib/presentation/schedule_screen/bloc/schedule_bloc.dart delete mode 100644 lib/presentation/schedule_screen/bloc/schedule_event.dart delete mode 100644 lib/presentation/schedule_screen/bloc/schedule_state.dart delete mode 100644 lib/presentation/schedule_screen/models/schedule_model.dart delete mode 100644 lib/presentation/schedule_screen/schedule_screen.dart diff --git a/lib/localization/ru/ru_translations.dart b/lib/localization/ru/ru_translations.dart index 012f1bda..40badc28 100644 --- a/lib/localization/ru/ru_translations.dart +++ b/lib/localization/ru/ru_translations.dart @@ -36,6 +36,8 @@ final Map ru = { "do_you_have_hypertension_tendency": "Есть ли у вас склонность к гипертонии?", "your_blood_pressure": "Ваше артериальное давление?", "average_pressure": "Средние показатели давления:", + "up_pressure": "Верхние показатели давления:", + "down_pressure": "Нижние показатели давления:", "do_you_have_hypotension_tendency": "Есть ли у вас склонность к гипотонии?", // favorite_sports Screen diff --git a/lib/presentation/additional_information_screen/additional_information_screen.dart b/lib/presentation/additional_information_screen/additional_information_screen.dart index 295a98d7..f93ed9d3 100644 --- a/lib/presentation/additional_information_screen/additional_information_screen.dart +++ b/lib/presentation/additional_information_screen/additional_information_screen.dart @@ -59,13 +59,12 @@ class _AdditionalInformationScreenState _buildTextFormField(context), Spacer(), CustomOutlinedButton( - text: "continue".tr.toUpperCase(), + text: "finish".tr.toUpperCase(), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, onPressed: () { showSuccessMessage(context); }), SizedBox(height: 17.v), - Text("finish".tr, style: theme.textTheme.bodyLarge) ])))); } diff --git a/lib/presentation/blood_pressure_screen/bloc/blood_pressure_bloc.dart b/lib/presentation/blood_pressure_screen/bloc/blood_pressure_bloc.dart index 9d0a083d..8eefb84b 100644 --- a/lib/presentation/blood_pressure_screen/bloc/blood_pressure_bloc.dart +++ b/lib/presentation/blood_pressure_screen/bloc/blood_pressure_bloc.dart @@ -32,7 +32,8 @@ class BloodPressureBloc extends Bloc { ) async { emit(state.copyWith( valueController: TextEditingController(), - valueController1: TextEditingController())); + valueController1: TextEditingController(), + valueController2: TextEditingController())); emit(state.copyWith( bloodPressureModelObj: state.bloodPressureModelObj ?.copyWith(dropdownItemList: fillDropdownItemList()))); diff --git a/lib/presentation/blood_pressure_screen/bloc/blood_pressure_state.dart b/lib/presentation/blood_pressure_screen/bloc/blood_pressure_state.dart index e43ee812..08bdff74 100644 --- a/lib/presentation/blood_pressure_screen/bloc/blood_pressure_state.dart +++ b/lib/presentation/blood_pressure_screen/bloc/blood_pressure_state.dart @@ -7,6 +7,7 @@ class BloodPressureState extends Equatable { BloodPressureState({ this.valueController, this.valueController1, + this.valueController2, this.selectedDropDownValue, this.bloodPressureModelObj, }); @@ -15,6 +16,8 @@ class BloodPressureState extends Equatable { TextEditingController? valueController1; + TextEditingController? valueController2; + SelectionPopupModel? selectedDropDownValue; BloodPressureModel? bloodPressureModelObj; @@ -29,6 +32,7 @@ class BloodPressureState extends Equatable { BloodPressureState copyWith({ TextEditingController? valueController, TextEditingController? valueController1, + TextEditingController? valueController2, SelectionPopupModel? selectedDropDownValue, BloodPressureModel? bloodPressureModelObj, }) { diff --git a/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart b/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart index a1c940af..b005a3be 100644 --- a/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart +++ b/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart @@ -63,8 +63,40 @@ class _BloodPressureScreenState extends State { overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, style: theme.textTheme.headlineSmall)), - SizedBox(height: 77.v), - _buildThirtyThree(context), + SizedBox(height: 21.v), + Container( + margin: EdgeInsets.only(right: 1.h), + padding: EdgeInsets.symmetric(horizontal: 3.h), + child: Column(children: [ + Text("up_pressure".tr, + style: theme.textTheme.bodyLarge), + SizedBox(height: 2.v), + BlocSelector( + selector: (state) => state.valueController1, + builder: (context, valueController1) { + return CustomTextFormField( + controller: valueController1, + hintText: "90".tr); + }) + ])), + SizedBox(height: 21.v), + Container( + margin: EdgeInsets.only(right: 1.h), + padding: EdgeInsets.symmetric(horizontal: 3.h), + child: Column(children: [ + Text("down_pressure".tr, + style: theme.textTheme.bodyLarge), + SizedBox(height: 2.v), + BlocSelector( + selector: (state) => state.valueController2, + builder: (context, valueController2) { + return CustomTextFormField( + controller: valueController2, + hintText: "90".tr); + }) + ])), SizedBox(height: 22.v), Text("do_you_have_hypotension_tendency".tr, style: theme.textTheme.bodyLarge), diff --git a/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart b/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart index c3d58c68..2ee032e7 100644 --- a/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart +++ b/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart @@ -69,7 +69,7 @@ class _FavoriteFoodsScreenState extends State { text: "continue".tr.toUpperCase(), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, onPressed: () { - navigateToSchedule(context); + navigateToAdditionalInformationScreen(context); }), SizedBox(height: 17.v), Text("skip".tr, style: theme.textTheme.bodyLarge) @@ -90,23 +90,6 @@ class _FavoriteFoodsScreenState extends State { title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio)); } - /// Section Widget - Widget _buildProgressIndicator(BuildContext context) { - return Container( - width: 343.h, - padding: EdgeInsets.symmetric(horizontal: 4.h, vertical: 3.v), - decoration: AppDecoration.outlinePrimary - .copyWith(borderRadius: BorderRadiusStyle.circleBorder8), - child: Container( - height: 8.v, - width: 279.h, - decoration: BoxDecoration( - color: appTheme.blueA400, - borderRadius: BorderRadius.circular(4.h), - border: - Border.all(color: theme.colorScheme.primary, width: 1.h)))); - } - /// Section Widget Widget _buildTextFormField(BuildContext context) { return Column(children: [ @@ -148,9 +131,9 @@ class _FavoriteFoodsScreenState extends State { } /// Navigates to the scheduleScreen when the action is triggered. - navigateToSchedule(BuildContext context) { + navigateToAdditionalInformationScreen(BuildContext context) { NavigatorService.pushNamed( - AppRoutes.scheduleScreen, + AppRoutes.additionalInformationScreen, ); } } diff --git a/lib/presentation/schedule_screen/bloc/schedule_bloc.dart b/lib/presentation/schedule_screen/bloc/schedule_bloc.dart deleted file mode 100644 index 6dedad4a..00000000 --- a/lib/presentation/schedule_screen/bloc/schedule_bloc.dart +++ /dev/null @@ -1,20 +0,0 @@ -import 'package:equatable/equatable.dart'; -import 'package:flutter/material.dart'; -import '/core/app_export.dart'; -import 'package:eatvio_app/presentation/schedule_screen/models/schedule_model.dart'; -part 'schedule_event.dart'; -part 'schedule_state.dart'; - -/// A bloc that manages the state of a Schedule according to the event that is dispatched to it. -class ScheduleBloc extends Bloc { - ScheduleBloc(ScheduleState initialState) : super(initialState) { - on(_onInitialize); - } - - _onInitialize( - ScheduleInitialEvent event, - Emitter emit, - ) async { - emit(state.copyWith(inputPlaceholderController: TextEditingController())); - } -} diff --git a/lib/presentation/schedule_screen/bloc/schedule_event.dart b/lib/presentation/schedule_screen/bloc/schedule_event.dart deleted file mode 100644 index 711e4eaf..00000000 --- a/lib/presentation/schedule_screen/bloc/schedule_event.dart +++ /dev/null @@ -1,16 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'schedule_bloc.dart'; - -/// Abstract class for all events that can be dispatched from the -///Schedule widget. -/// -/// Events must be immutable and implement the [Equatable] interface. -@immutable -abstract class ScheduleEvent extends Equatable {} - -/// Event that is dispatched when the Schedule widget is first created. -class ScheduleInitialEvent extends ScheduleEvent { - @override - List get props => []; -} diff --git a/lib/presentation/schedule_screen/bloc/schedule_state.dart b/lib/presentation/schedule_screen/bloc/schedule_state.dart deleted file mode 100644 index 4c345db8..00000000 --- a/lib/presentation/schedule_screen/bloc/schedule_state.dart +++ /dev/null @@ -1,31 +0,0 @@ -// ignore_for_file: must_be_immutable - -part of 'schedule_bloc.dart'; - -/// Represents the state of Schedule in the application. -class ScheduleState extends Equatable { - ScheduleState({ - this.inputPlaceholderController, - this.scheduleModelObj, - }); - - TextEditingController? inputPlaceholderController; - - ScheduleModel? scheduleModelObj; - - @override - List get props => [ - inputPlaceholderController, - scheduleModelObj, - ]; - ScheduleState copyWith({ - TextEditingController? inputPlaceholderController, - ScheduleModel? scheduleModelObj, - }) { - return ScheduleState( - inputPlaceholderController: - inputPlaceholderController ?? this.inputPlaceholderController, - scheduleModelObj: scheduleModelObj ?? this.scheduleModelObj, - ); - } -} diff --git a/lib/presentation/schedule_screen/models/schedule_model.dart b/lib/presentation/schedule_screen/models/schedule_model.dart deleted file mode 100644 index 6eb1022f..00000000 --- a/lib/presentation/schedule_screen/models/schedule_model.dart +++ /dev/null @@ -1,16 +0,0 @@ -// ignore_for_file: must_be_immutable - -import 'package:equatable/equatable.dart'; - -/// This class defines the variables used in the [schedule_screen], -/// and is typically used to hold data that is passed between different parts of the application. -class ScheduleModel extends Equatable { - ScheduleModel() {} - - ScheduleModel copyWith() { - return ScheduleModel(); - } - - @override - List get props => []; -} diff --git a/lib/presentation/schedule_screen/schedule_screen.dart b/lib/presentation/schedule_screen/schedule_screen.dart deleted file mode 100644 index 636bea39..00000000 --- a/lib/presentation/schedule_screen/schedule_screen.dart +++ /dev/null @@ -1,137 +0,0 @@ -import 'bloc/schedule_bloc.dart'; -import 'models/schedule_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/custom_outlined_button.dart'; -import 'package:eatvio_app/widgets/custom_text_form_field.dart'; -import 'package:flutter/material.dart'; - -class ScheduleScreen extends StatefulWidget { - const ScheduleScreen({Key? key}) : super(key: key); - - static Widget builder(BuildContext context) { - return BlocProvider( - create: (context) => - ScheduleBloc(ScheduleState(scheduleModelObj: ScheduleModel())) - ..add(ScheduleInitialEvent()), - child: ScheduleScreen()); - } - - @override - State createState() => _ScheduleScreenState(); -} - -class _ScheduleScreenState extends State { - @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.95, - backgroundColor: theme.colorScheme.onPrimary, - valueColor: AlwaysStoppedAnimation( - appTheme.blueA400)))), - SizedBox(height: 38.v), - Text("your_schedule".tr, - style: theme.textTheme.headlineSmall), - SizedBox(height: 67.v), - _buildTextFormField(context), - Spacer(), - CustomOutlinedButton( - text: "continue".tr.toUpperCase(), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: () { - navigateToAdditional(context); - }), - SizedBox(height: 17.v), - Text("skip".tr, style: theme.textTheme.bodyLarge) - ])))); - } - - /// Section Widget - PreferredSizeWidget _buildAppBar(BuildContext context) { - return CustomAppBar( - leadingWidth: 31.h, - leading: AppbarLeadingImage( - imagePath: ImageConstant.imgArrowLeft, - margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v), - onTap: () { - onTapArrowLeft(context); - }), - centerTitle: true, - title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio)); - } - - /// Section Widget - Widget _buildProgressIndicator(BuildContext context) { - return Container( - width: 343.h, - padding: EdgeInsets.symmetric(horizontal: 4.h, vertical: 3.v), - decoration: AppDecoration.outlinePrimary - .copyWith(borderRadius: BorderRadiusStyle.circleBorder8), - child: Container( - height: 8.v, - width: 297.h, - decoration: BoxDecoration( - color: appTheme.blueA400, - borderRadius: BorderRadius.circular(4.h), - border: - Border.all(color: theme.colorScheme.primary, width: 1.h)))); - } - - /// Section Widget - Widget _buildTextFormField(BuildContext context) { - return Column(children: [ - Container( - width: 324.h, - margin: EdgeInsets.symmetric(horizontal: 9.h), - child: Text("tell_your_schedule".tr, - maxLines: 3, - overflow: TextOverflow.ellipsis, - textAlign: TextAlign.center, - style: CustomTextStyles.titleMediumSegoeUI)), - SizedBox(height: 12.v), - BlocSelector( - selector: (state) => state.inputPlaceholderController, - builder: (context, inputPlaceholderController) { - return CustomTextFormField( - controller: inputPlaceholderController, - hintText: "enter_information".tr, - textInputAction: TextInputAction.done, - maxLines: 8); - }) - ]); - } - - /// Navigates to the previous screen. - onTapArrowLeft(BuildContext context) { - NavigatorService.goBack(); - } - - /// Navigates to the additionalInformationScreen when the action is triggered. - navigateToAdditional(BuildContext context) { - NavigatorService.pushNamed( - AppRoutes.additionalInformationScreen, - ); - } -} diff --git a/lib/routes/app_routes.dart b/lib/routes/app_routes.dart index a9adebc0..0fd6f29e 100644 --- a/lib/routes/app_routes.dart +++ b/lib/routes/app_routes.dart @@ -1,4 +1,3 @@ -import 'package:eatvio_app/presentation/credentials_screen/models/credentials_model.dart'; import 'package:flutter/material.dart'; import 'package:eatvio_app/presentation/date_of_birth_screen/date_of_birth_screen.dart'; import 'package:eatvio_app/presentation/city_of_living_screen/city_of_living_screen.dart'; @@ -11,7 +10,6 @@ import 'package:eatvio_app/presentation/gender_screen/gender_screen.dart'; import 'package:eatvio_app/presentation/blood_pressure_screen/blood_pressure_screen.dart'; import 'package:eatvio_app/presentation/favorite_sports_screen/favorite_sports_screen.dart'; import 'package:eatvio_app/presentation/favorite_foods_screen/favorite_foods_screen.dart'; -import 'package:eatvio_app/presentation/schedule_screen/schedule_screen.dart'; import 'package:eatvio_app/presentation/additional_information_screen/additional_information_screen.dart'; import 'package:eatvio_app/presentation/language_select_screen/language_select_screen.dart'; import 'package:eatvio_app/presentation/height_screen/height_screen.dart'; @@ -76,7 +74,6 @@ class AppRoutes { bloodPressureScreen: BloodPressureScreen.builder, favoriteSportsScreen: FavoriteSportsScreen.builder, favoriteFoodsScreen: FavoriteFoodsScreen.builder, - scheduleScreen: ScheduleScreen.builder, additionalInformationScreen: AdditionalInformationScreen.builder, languageSelectScreen: LanguageSelectScreen.builder, appNavigationScreen: AppNavigationScreen.builder, From 88a5e2d15192e36f60128f199f71ece329479f28 Mon Sep 17 00:00:00 2001 From: maxxkim Date: Thu, 21 Dec 2023 12:37:31 +0300 Subject: [PATCH 06/22] remoced Skip btton from reuired fields screens and removed excess section widgets --- .../body_circumferences_screen.dart | 29 ++++---- .../city_of_living_screen.dart | 1 - .../credentials_screen.dart | 1 - .../date_of_birth_screen.dart | 21 ------ .../gender_screen/gender_screen.dart | 18 ----- .../height_screen/height_screen.dart | 70 ++++++++----------- lib/presentation/name_screen/name_screen.dart | 1 - .../weight_screen/weight_screen.dart | 70 ++++++++----------- 8 files changed, 74 insertions(+), 137 deletions(-) diff --git a/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart b/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart index 5effd99e..3ad5107b 100644 --- a/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart +++ b/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart @@ -56,7 +56,18 @@ class _BodyCircumferencesScreenState extends State { Text("initial_measurements".tr, style: theme.textTheme.headlineSmall), SizedBox(height: 93.v), - _buildTwentySeven(context), + Column(children: [ + Text("chest_circumference".tr, + style: theme.textTheme.bodyLarge), + SizedBox(height: 3.v), + BlocSelector( + selector: (state) => state.valueController, + builder: (context, valueController) { + return CustomTextFormField( + controller: valueController, hintText: "90".tr); + }) + ]), SizedBox(height: 19.v), Text("waist_circumference".tr, style: theme.textTheme.bodyLarge), @@ -89,7 +100,6 @@ class _BodyCircumferencesScreenState extends State { navigateToWeight(context); }), SizedBox(height: 17.v), - Text("skip".tr, style: theme.textTheme.bodyLarge) ])))); } @@ -107,21 +117,6 @@ class _BodyCircumferencesScreenState extends State { title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio)); } - /// Section Widget - Widget _buildTwentySeven(BuildContext context) { - return Column(children: [ - Text("chest_circumference".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 3.v), - BlocSelector( - selector: (state) => state.valueController, - builder: (context, valueController) { - return CustomTextFormField( - controller: valueController, hintText: "90".tr); - }) - ]); - } - /// Navigates to the previous screen. onTapArrowLeft(BuildContext context) { NavigatorService.goBack(); diff --git a/lib/presentation/city_of_living_screen/city_of_living_screen.dart b/lib/presentation/city_of_living_screen/city_of_living_screen.dart index ca154c0b..60650bf2 100644 --- a/lib/presentation/city_of_living_screen/city_of_living_screen.dart +++ b/lib/presentation/city_of_living_screen/city_of_living_screen.dart @@ -106,7 +106,6 @@ class CityOfLivingScreen extends StatelessWidget { navigateToCircumferences(context); }), SizedBox(height: 17.v), - Text("skip".tr, style: theme.textTheme.bodyLarge) ])))); } diff --git a/lib/presentation/credentials_screen/credentials_screen.dart b/lib/presentation/credentials_screen/credentials_screen.dart index 091f5b29..56ed8cf0 100644 --- a/lib/presentation/credentials_screen/credentials_screen.dart +++ b/lib/presentation/credentials_screen/credentials_screen.dart @@ -98,7 +98,6 @@ class _CredentialsScreenState extends State { navigateToName(context); }), SizedBox(height: 17.v), - Text("skip".tr, style: theme.textTheme.bodyLarge) ])))); } diff --git a/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart b/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart index b9325910..32e7c482 100644 --- a/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart +++ b/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart @@ -65,10 +65,6 @@ class _DateOfBirthScreenState extends State { navigateToCity(context); }), SizedBox(height: 17.v), - Padding( - padding: EdgeInsets.only(left: 8.h), - child: - Text("skip".tr, style: theme.textTheme.bodyLarge)) ])))); }); } @@ -87,23 +83,6 @@ class _DateOfBirthScreenState extends State { title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio)); } - /// Section Widget - Widget _buildProgressIndicator(BuildContext context) { - return Container( - width: 343.h, - padding: EdgeInsets.symmetric(horizontal: 4.h, vertical: 3.v), - decoration: AppDecoration.outlinePrimary - .copyWith(borderRadius: BorderRadiusStyle.circleBorder8), - child: Container( - height: 8.v, - width: 60.h, - decoration: BoxDecoration( - color: appTheme.blueA400, - borderRadius: BorderRadius.circular(4.h), - border: - Border.all(color: theme.colorScheme.primary, width: 1.h)))); - } - /// Section Widget Widget _buildDateInput(BuildContext context) { return Container( diff --git a/lib/presentation/gender_screen/gender_screen.dart b/lib/presentation/gender_screen/gender_screen.dart index 66c4f3ff..94ea3c6d 100644 --- a/lib/presentation/gender_screen/gender_screen.dart +++ b/lib/presentation/gender_screen/gender_screen.dart @@ -99,7 +99,6 @@ class _GenderScreenState extends State { navigateToDate(context); }), SizedBox(height: 17.v), - Text("skip".tr, style: theme.textTheme.bodyLarge) ])))); }); } @@ -118,23 +117,6 @@ class _GenderScreenState extends State { title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio)); } - /// Section Widget - Widget _buildProgressIndicator(BuildContext context) { - return Container( - width: 343.h, - padding: EdgeInsets.symmetric(horizontal: 4.h, vertical: 3.v), - decoration: AppDecoration.outlinePrimary - .copyWith(borderRadius: BorderRadiusStyle.circleBorder8), - child: Container( - height: 8.v, - width: 40.h, - decoration: BoxDecoration( - color: appTheme.blueA400, - borderRadius: BorderRadius.circular(4.h), - border: - Border.all(color: theme.colorScheme.primary, width: 1.h)))); - } - /// Navigates to the previous screen. onTapArrowLeft(BuildContext context) { NavigatorService.goBack(); diff --git a/lib/presentation/height_screen/height_screen.dart b/lib/presentation/height_screen/height_screen.dart index 0747e66b..71144d42 100644 --- a/lib/presentation/height_screen/height_screen.dart +++ b/lib/presentation/height_screen/height_screen.dart @@ -51,7 +51,37 @@ class _HeightScreenState extends State { valueColor: AlwaysStoppedAnimation( appTheme.blueA400)))), SizedBox(height: 39.v), - _buildTwentySix(context), + Column(children: [ + Text("height_measurements".tr, + style: theme.textTheme.headlineSmall), + SizedBox(height: 174.v), + Column(children: [ + Text("your_height".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 4.v), + BlocSelector( + selector: (state) => state.heightModelObj, + builder: (context, heightModelObj) { + return CustomDropDown( + icon: Container( + margin: EdgeInsets.fromLTRB( + 30.h, 11.v, 17.h, 11.v), + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(1.h)), + child: CustomImageView( + imagePath: ImageConstant.imgFavorite, + height: 12.adaptSize, + width: 12.adaptSize)), + hintText: "170", + items: heightModelObj?.dropdownItemList ?? [], + onChanged: (value) { + context + .read() + .add(ChangeDropDownEvent(value: value)); + }); + }) + ]) + ]), Spacer(), CustomOutlinedButton( text: "continue".tr.toUpperCase(), @@ -60,7 +90,6 @@ class _HeightScreenState extends State { navigateToAllergies(context); }), SizedBox(height: 17.v), - Text("skip".tr, style: theme.textTheme.bodyLarge) ])))); } @@ -78,43 +107,6 @@ class _HeightScreenState extends State { title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio)); } - /// Section Widget - Widget _buildWeight(BuildContext context) { - return Column(children: [ - Text("your_height".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 4.v), - BlocSelector( - selector: (state) => state.heightModelObj, - builder: (context, heightModelObj) { - return CustomDropDown( - icon: Container( - margin: EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v), - decoration: - BoxDecoration(borderRadius: BorderRadius.circular(1.h)), - child: CustomImageView( - imagePath: ImageConstant.imgFavorite, - height: 12.adaptSize, - width: 12.adaptSize)), - hintText: "170", - items: heightModelObj?.dropdownItemList ?? [], - onChanged: (value) { - context - .read() - .add(ChangeDropDownEvent(value: value)); - }); - }) - ]); - } - - /// Section Widget - Widget _buildTwentySix(BuildContext context) { - return Column(children: [ - Text("height_measurements".tr, style: theme.textTheme.headlineSmall), - SizedBox(height: 174.v), - _buildWeight(context) - ]); - } - /// Navigates to the previous screen. onTapArrowLeft(BuildContext context) { NavigatorService.goBack(); diff --git a/lib/presentation/name_screen/name_screen.dart b/lib/presentation/name_screen/name_screen.dart index 203513d6..7c97fa86 100644 --- a/lib/presentation/name_screen/name_screen.dart +++ b/lib/presentation/name_screen/name_screen.dart @@ -82,7 +82,6 @@ class _NameScreenState extends State { navigateToGender(context); }), SizedBox(height: 17.v), - Text("skip".tr, style: theme.textTheme.bodyLarge) ])))); } diff --git a/lib/presentation/weight_screen/weight_screen.dart b/lib/presentation/weight_screen/weight_screen.dart index abe19eb4..61cfed51 100644 --- a/lib/presentation/weight_screen/weight_screen.dart +++ b/lib/presentation/weight_screen/weight_screen.dart @@ -51,7 +51,37 @@ class _WeightScreenState extends State { valueColor: AlwaysStoppedAnimation( appTheme.blueA400)))), SizedBox(height: 39.v), - _buildTwentySix(context), + Column(children: [ + Text("weight_measurements".tr, + style: theme.textTheme.headlineSmall), + SizedBox(height: 174.v), + Column(children: [ + Text("your_weight".tr, style: theme.textTheme.bodyLarge), + SizedBox(height: 4.v), + BlocSelector( + selector: (state) => state.weightModelObj, + builder: (context, weightModelObj) { + return CustomDropDown( + icon: Container( + margin: EdgeInsets.fromLTRB( + 30.h, 11.v, 17.h, 11.v), + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(1.h)), + child: CustomImageView( + imagePath: ImageConstant.imgFavorite, + height: 12.adaptSize, + width: 12.adaptSize)), + hintText: "70", + items: weightModelObj?.dropdownItemList ?? [], + onChanged: (value) { + context + .read() + .add(ChangeDropDownEvent(value: value)); + }); + }) + ]) + ]), Spacer(), CustomOutlinedButton( text: "continue".tr.toUpperCase(), @@ -60,7 +90,6 @@ class _WeightScreenState extends State { navigateToHeight(context); }), SizedBox(height: 17.v), - Text("skip".tr, style: theme.textTheme.bodyLarge) ])))); } @@ -78,43 +107,6 @@ class _WeightScreenState extends State { title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio)); } - /// Section Widget - Widget _buildWeight(BuildContext context) { - return Column(children: [ - Text("your_weight".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 4.v), - BlocSelector( - selector: (state) => state.weightModelObj, - builder: (context, weightModelObj) { - return CustomDropDown( - icon: Container( - margin: EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v), - decoration: - BoxDecoration(borderRadius: BorderRadius.circular(1.h)), - child: CustomImageView( - imagePath: ImageConstant.imgFavorite, - height: 12.adaptSize, - width: 12.adaptSize)), - hintText: "70", - items: weightModelObj?.dropdownItemList ?? [], - onChanged: (value) { - context - .read() - .add(ChangeDropDownEvent(value: value)); - }); - }) - ]); - } - - /// Section Widget - Widget _buildTwentySix(BuildContext context) { - return Column(children: [ - Text("weight_measurements".tr, style: theme.textTheme.headlineSmall), - SizedBox(height: 174.v), - _buildWeight(context) - ]); - } - /// Navigates to the previous screen. onTapArrowLeft(BuildContext context) { NavigatorService.goBack(); From 05887cb39b18e73cbc38ff085d83c1e9b343e1a3 Mon Sep 17 00:00:00 2001 From: maxxkim Date: Thu, 21 Dec 2023 16:28:04 +0300 Subject: [PATCH 07/22] Initialized UserRegistrationSheet class --- .../additional_information_screen.dart | 16 ------- .../models/credentials_model.dart | 1 + .../bloc/language_select_bloc.dart | 1 + .../language_select_screen.dart | 45 +++++-------------- .../models/language_select_model.dart | 30 ++++++++++++- 5 files changed, 41 insertions(+), 52 deletions(-) diff --git a/lib/presentation/additional_information_screen/additional_information_screen.dart b/lib/presentation/additional_information_screen/additional_information_screen.dart index f93ed9d3..c3778012 100644 --- a/lib/presentation/additional_information_screen/additional_information_screen.dart +++ b/lib/presentation/additional_information_screen/additional_information_screen.dart @@ -82,22 +82,6 @@ class _AdditionalInformationScreenState title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio)); } - /// Section Widget - Widget _buildProgressIndicator(BuildContext context) { - return Container( - padding: EdgeInsets.symmetric(horizontal: 4.h, vertical: 3.v), - decoration: AppDecoration.outlinePrimary - .copyWith(borderRadius: BorderRadiusStyle.circleBorder8), - child: Container( - height: 8.v, - width: 332.h, - decoration: BoxDecoration( - color: appTheme.blueA400, - borderRadius: BorderRadius.circular(4.h), - border: - Border.all(color: theme.colorScheme.primary, width: 1.h)))); - } - /// Section Widget Widget _buildTextFormField(BuildContext context) { return SizedBox( diff --git a/lib/presentation/credentials_screen/models/credentials_model.dart b/lib/presentation/credentials_screen/models/credentials_model.dart index 57ae6d7c..666a756c 100644 --- a/lib/presentation/credentials_screen/models/credentials_model.dart +++ b/lib/presentation/credentials_screen/models/credentials_model.dart @@ -1,6 +1,7 @@ // ignore_for_file: must_be_immutable import 'package:equatable/equatable.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; /// This class defines the variables used in the [credentials_screen], /// and is typically used to hold data that is passed between different parts of the application. diff --git a/lib/presentation/language_select_screen/bloc/language_select_bloc.dart b/lib/presentation/language_select_screen/bloc/language_select_bloc.dart index 8560203b..9fc3fe49 100644 --- a/lib/presentation/language_select_screen/bloc/language_select_bloc.dart +++ b/lib/presentation/language_select_screen/bloc/language_select_bloc.dart @@ -27,6 +27,7 @@ class LanguageSelectBloc Emitter emit, ) { emit(state.copyWith(selectedDropDownValue: event.value)); + LanguageSelectModel().userRegistrationSheet.lang = event.value.toString(); } List fillDropdownItemList() { diff --git a/lib/presentation/language_select_screen/language_select_screen.dart b/lib/presentation/language_select_screen/language_select_screen.dart index d3683263..9349ddcc 100644 --- a/lib/presentation/language_select_screen/language_select_screen.dart +++ b/lib/presentation/language_select_screen/language_select_screen.dart @@ -5,7 +5,7 @@ import 'package:eatvio_app/widgets/custom_drop_down.dart'; import 'package:eatvio_app/widgets/custom_outlined_button.dart'; import 'package:flutter/material.dart'; -class LanguageSelectScreen extends StatefulWidget { +class LanguageSelectScreen extends StatelessWidget { const LanguageSelectScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { @@ -16,11 +16,6 @@ class LanguageSelectScreen extends StatefulWidget { child: LanguageSelectScreen()); } - @override - State createState() => _LanguageSelectScreenState(); -} - -class _LanguageSelectScreenState extends State { @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); @@ -85,41 +80,21 @@ class _LanguageSelectScreenState extends State { }), Spacer(flex: 63) ])), - bottomNavigationBar: _buildContinueButtonSection(context))); - } - - /// Section Widget - Widget _buildProgressIndicatorSection(BuildContext context) { - return Container( - width: 343.h, - padding: EdgeInsets.symmetric(horizontal: 4.h, vertical: 3.v), - decoration: AppDecoration.outlinePrimary - .copyWith(borderRadius: BorderRadiusStyle.circleBorder8), - child: Container( - height: 8.v, - width: 20.h, - decoration: BoxDecoration( - color: appTheme.blueA400, - borderRadius: BorderRadius.circular(4.h), - border: - Border.all(color: theme.colorScheme.primary, width: 1.h)))); - } - - /// Section Widget - Widget _buildContinueButtonSection(BuildContext context) { - return CustomOutlinedButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: () { - navigteToCredentials(context); - }); + bottomNavigationBar: CustomOutlinedButton( + text: "continue".tr.toUpperCase(), + margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + onPressed: () { + navigteToCredentials(context); + }))); } /// Navigates to the genderScreen when the action is triggered. navigteToCredentials(BuildContext context) { + LanguageSelectModel languageSelectModel = LanguageSelectModel(); NavigatorService.pushNamed( AppRoutes.credentialsScreen, + arguments: languageSelectModel.userRegistrationSheet, ); } } diff --git a/lib/presentation/language_select_screen/models/language_select_model.dart b/lib/presentation/language_select_screen/models/language_select_model.dart index 0b9cb205..c19faa3f 100644 --- a/lib/presentation/language_select_screen/models/language_select_model.dart +++ b/lib/presentation/language_select_screen/models/language_select_model.dart @@ -1,13 +1,41 @@ // ignore_for_file: must_be_immutable import 'package:equatable/equatable.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart'; /// This class defines the variables used in the [language_select_screen], /// and is typically used to hold data that is passed between different parts of the application. class LanguageSelectModel extends Equatable { LanguageSelectModel({this.dropdownItemList = const []}) {} - + UserRegistrationSheet userRegistrationSheet = UserRegistrationSheet( + firstName: '', + lastName: '', + email: '', + password: '', + passwordConfirmation: '', + termsAccepted: false, + birthdate: DateTime.now(), + gender: '', + country: '', + city: '', + lang: '', + weight: 0, + height: 0, + chestCircumference: 0, + waistCircumference: 0, + hipCircumference: 0, + bloodPressureUp: 0, + bloodPressureDown: 0, + hasHypo: false, + hasHyper: false, + aboutAllergy: '', + aboutTakingPils: '', + aboutSportHobbies: '', + favoriteFoods: '', + unfavoriteFoods: '', + additionalInfo: '', + ); List dropdownItemList; LanguageSelectModel copyWith({List? dropdownItemList}) { From 3faae97c9139e8612a601b1fbbf7c730914a1a81 Mon Sep 17 00:00:00 2001 From: maxxkim Date: Thu, 21 Dec 2023 16:50:47 +0300 Subject: [PATCH 08/22] Passed registration sheet between language_select and credentials --- .../bloc/credentials_bloc.dart | 6 ++-- .../bloc/credentials_state.dart | 31 +++++++++--------- .../credentials_screen.dart | 18 +++++------ .../models/credentials_model.dart | 13 +++++--- .../language_select_screen.dart | 5 ++- .../models/language_select_model.dart | 32 ++----------------- 6 files changed, 43 insertions(+), 62 deletions(-) diff --git a/lib/presentation/credentials_screen/bloc/credentials_bloc.dart b/lib/presentation/credentials_screen/bloc/credentials_bloc.dart index fe83f536..c62211ee 100644 --- a/lib/presentation/credentials_screen/bloc/credentials_bloc.dart +++ b/lib/presentation/credentials_screen/bloc/credentials_bloc.dart @@ -16,8 +16,8 @@ class CredentialsBloc extends Bloc { Emitter emit, ) async { emit(state.copyWith( - valueController: TextEditingController(), - valueController1: TextEditingController(), - valueController2: TextEditingController())); + emailController: TextEditingController(), + passwordController: TextEditingController(), + passwordConfirmationController: TextEditingController())); } } diff --git a/lib/presentation/credentials_screen/bloc/credentials_state.dart b/lib/presentation/credentials_screen/bloc/credentials_state.dart index c59dec31..91cb6633 100644 --- a/lib/presentation/credentials_screen/bloc/credentials_state.dart +++ b/lib/presentation/credentials_screen/bloc/credentials_state.dart @@ -5,37 +5,38 @@ part of 'credentials_bloc.dart'; /// Represents the state of Credentials in the application. class CredentialsState extends Equatable { CredentialsState({ - this.valueController, - this.valueController1, - this.valueController2, + this.emailController, + this.passwordController, + this.passwordConfirmationController, this.credentialsModelObj, }); - TextEditingController? valueController; + TextEditingController? emailController; - TextEditingController? valueController1; + TextEditingController? passwordController; - TextEditingController? valueController2; + TextEditingController? passwordConfirmationController; CredentialsModel? credentialsModelObj; @override List get props => [ - valueController, - valueController1, - valueController2, + emailController, + passwordController, + passwordConfirmationController, credentialsModelObj, ]; CredentialsState copyWith({ - TextEditingController? valueController, - TextEditingController? valueController1, - TextEditingController? valueController2, + TextEditingController? emailController, + TextEditingController? passwordController, + TextEditingController? passwordConfirmationController, CredentialsModel? credentialsModelObj, }) { return CredentialsState( - valueController: valueController ?? this.valueController, - valueController1: valueController1 ?? this.valueController1, - valueController2: valueController2 ?? this.valueController2, + emailController: emailController ?? this.emailController, + passwordController: passwordController ?? this.passwordController, + passwordConfirmationController: + passwordConfirmationController ?? this.passwordConfirmationController, credentialsModelObj: credentialsModelObj ?? this.credentialsModelObj, ); } diff --git a/lib/presentation/credentials_screen/credentials_screen.dart b/lib/presentation/credentials_screen/credentials_screen.dart index 56ed8cf0..ecca2c9c 100644 --- a/lib/presentation/credentials_screen/credentials_screen.dart +++ b/lib/presentation/credentials_screen/credentials_screen.dart @@ -59,10 +59,10 @@ class _CredentialsScreenState extends State { SizedBox(height: 3.v), BlocSelector( - selector: (state) => state.valueController1, - builder: (context, valueController1) { + selector: (state) => state.passwordController, + builder: (context, passwordController) { return CustomTextFormField( - controller: valueController1, + controller: passwordController, textInputAction: TextInputAction.done); }), SizedBox(height: 19.v), @@ -70,11 +70,11 @@ class _CredentialsScreenState extends State { SizedBox(height: 5.v), BlocSelector( - selector: (state) => state.valueController2, - builder: (context, valueController2) { + selector: (state) => state.passwordConfirmationController, + builder: (context, passwordConfirmationController) { return CustomTextFormField( obscureText: true, - controller: valueController2, + controller: passwordConfirmationController, ); }), SizedBox(height: 21.v), @@ -83,11 +83,11 @@ class _CredentialsScreenState extends State { SizedBox(height: 3.v), BlocSelector( - selector: (state) => state.valueController, - builder: (context, valueController3) { + selector: (state) => state.emailController, + builder: (context, emailController3) { return CustomTextFormField( obscureText: true, - controller: valueController3, + controller: emailController3, textInputAction: TextInputAction.done); }), Spacer(), diff --git a/lib/presentation/credentials_screen/models/credentials_model.dart b/lib/presentation/credentials_screen/models/credentials_model.dart index 666a756c..ae6c3201 100644 --- a/lib/presentation/credentials_screen/models/credentials_model.dart +++ b/lib/presentation/credentials_screen/models/credentials_model.dart @@ -6,12 +6,17 @@ import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_m /// This class defines the variables used in the [credentials_screen], /// and is typically used to hold data that is passed between different parts of the application. class CredentialsModel extends Equatable { - CredentialsModel() {} + UserRegistrationSheet userRegistrationSheet; - CredentialsModel copyWith() { - return CredentialsModel(); + CredentialsModel({required this.userRegistrationSheet}); + + CredentialsModel copyWith({UserRegistrationSheet? userRegistrationSheet}) { + return CredentialsModel( + userRegistrationSheet: + userRegistrationSheet ?? this.userRegistrationSheet, + ); } @override - List get props => []; + List get props => [userRegistrationSheet]; } diff --git a/lib/presentation/language_select_screen/language_select_screen.dart b/lib/presentation/language_select_screen/language_select_screen.dart index 9349ddcc..888a3c28 100644 --- a/lib/presentation/language_select_screen/language_select_screen.dart +++ b/lib/presentation/language_select_screen/language_select_screen.dart @@ -3,6 +3,7 @@ import 'models/language_select_model.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/custom_drop_down.dart'; import 'package:eatvio_app/widgets/custom_outlined_button.dart'; +import 'package:eatvio_app/presentation/credentials_screen/models/credentials_model.dart'; import 'package:flutter/material.dart'; class LanguageSelectScreen extends StatelessWidget { @@ -92,9 +93,11 @@ class LanguageSelectScreen extends StatelessWidget { /// Navigates to the genderScreen when the action is triggered. navigteToCredentials(BuildContext context) { LanguageSelectModel languageSelectModel = LanguageSelectModel(); + CredentialsModel credentialsModel = CredentialsModel( + userRegistrationSheet: languageSelectModel.userRegistrationSheet); NavigatorService.pushNamed( AppRoutes.credentialsScreen, - arguments: languageSelectModel.userRegistrationSheet, + arguments: credentialsModel, ); } } diff --git a/lib/presentation/language_select_screen/models/language_select_model.dart b/lib/presentation/language_select_screen/models/language_select_model.dart index c19faa3f..9431c5ef 100644 --- a/lib/presentation/language_select_screen/models/language_select_model.dart +++ b/lib/presentation/language_select_screen/models/language_select_model.dart @@ -1,43 +1,15 @@ // ignore_for_file: must_be_immutable import 'package:equatable/equatable.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart'; +import '../../userRegistrationSheet.dart'; /// This class defines the variables used in the [language_select_screen], /// and is typically used to hold data that is passed between different parts of the application. class LanguageSelectModel extends Equatable { LanguageSelectModel({this.dropdownItemList = const []}) {} - UserRegistrationSheet userRegistrationSheet = UserRegistrationSheet( - firstName: '', - lastName: '', - email: '', - password: '', - passwordConfirmation: '', - termsAccepted: false, - birthdate: DateTime.now(), - gender: '', - country: '', - city: '', - lang: '', - weight: 0, - height: 0, - chestCircumference: 0, - waistCircumference: 0, - hipCircumference: 0, - bloodPressureUp: 0, - bloodPressureDown: 0, - hasHypo: false, - hasHyper: false, - aboutAllergy: '', - aboutTakingPils: '', - aboutSportHobbies: '', - favoriteFoods: '', - unfavoriteFoods: '', - additionalInfo: '', - ); - List dropdownItemList; + List dropdownItemList; LanguageSelectModel copyWith({List? dropdownItemList}) { return LanguageSelectModel( dropdownItemList: dropdownItemList ?? this.dropdownItemList, From 54485500daa4b211f0a18382fdb83b59840b3ddf Mon Sep 17 00:00:00 2001 From: maxxkim Date: Thu, 21 Dec 2023 16:56:56 +0300 Subject: [PATCH 09/22] Fix --- .../credentials_screen.dart | 12 +++---- .../models/language_select_model.dart | 32 +++++++++++++++++-- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/lib/presentation/credentials_screen/credentials_screen.dart b/lib/presentation/credentials_screen/credentials_screen.dart index ecca2c9c..a68b47ec 100644 --- a/lib/presentation/credentials_screen/credentials_screen.dart +++ b/lib/presentation/credentials_screen/credentials_screen.dart @@ -8,22 +8,18 @@ import 'package:eatvio_app/widgets/custom_outlined_button.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; -class CredentialsScreen extends StatefulWidget { +class CredentialsScreen extends StatelessWidget { const CredentialsScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { return BlocProvider( - create: (context) => CredentialsBloc( - CredentialsState(credentialsModelObj: CredentialsModel())) + create: (context) => CredentialsBloc(CredentialsState( + credentialsModelObj: + ModalRoute.of(context)?.settings.arguments as CredentialsModel)) ..add(CredentialsInitialEvent()), child: CredentialsScreen()); } - @override - State createState() => _CredentialsScreenState(); -} - -class _CredentialsScreenState extends State { @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); diff --git a/lib/presentation/language_select_screen/models/language_select_model.dart b/lib/presentation/language_select_screen/models/language_select_model.dart index 9431c5ef..c19faa3f 100644 --- a/lib/presentation/language_select_screen/models/language_select_model.dart +++ b/lib/presentation/language_select_screen/models/language_select_model.dart @@ -1,15 +1,43 @@ // ignore_for_file: must_be_immutable import 'package:equatable/equatable.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart'; -import '../../userRegistrationSheet.dart'; /// This class defines the variables used in the [language_select_screen], /// and is typically used to hold data that is passed between different parts of the application. class LanguageSelectModel extends Equatable { LanguageSelectModel({this.dropdownItemList = const []}) {} - + UserRegistrationSheet userRegistrationSheet = UserRegistrationSheet( + firstName: '', + lastName: '', + email: '', + password: '', + passwordConfirmation: '', + termsAccepted: false, + birthdate: DateTime.now(), + gender: '', + country: '', + city: '', + lang: '', + weight: 0, + height: 0, + chestCircumference: 0, + waistCircumference: 0, + hipCircumference: 0, + bloodPressureUp: 0, + bloodPressureDown: 0, + hasHypo: false, + hasHyper: false, + aboutAllergy: '', + aboutTakingPils: '', + aboutSportHobbies: '', + favoriteFoods: '', + unfavoriteFoods: '', + additionalInfo: '', + ); List dropdownItemList; + LanguageSelectModel copyWith({List? dropdownItemList}) { return LanguageSelectModel( dropdownItemList: dropdownItemList ?? this.dropdownItemList, From d634922aa5866854e187fa9dcc469875861a389c Mon Sep 17 00:00:00 2001 From: maxxkim Date: Fri, 22 Dec 2023 09:54:44 +0300 Subject: [PATCH 10/22] FINALLY passed a dropdown value to a registration sheet. GREAT SUCCESS --- .../bloc/language_select_bloc.dart | 9 +++++++-- .../language_select_screen/language_select_screen.dart | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/presentation/language_select_screen/bloc/language_select_bloc.dart b/lib/presentation/language_select_screen/bloc/language_select_bloc.dart index 9fc3fe49..07bdccf6 100644 --- a/lib/presentation/language_select_screen/bloc/language_select_bloc.dart +++ b/lib/presentation/language_select_screen/bloc/language_select_bloc.dart @@ -2,13 +2,17 @@ import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; import '/core/app_export.dart'; import 'package:eatvio_app/presentation/language_select_screen/models/language_select_model.dart'; +import 'dart:convert'; part 'language_select_event.dart'; part 'language_select_state.dart'; /// A bloc that manages the state of a LanguageSelect according to the event that is dispatched to it. class LanguageSelectBloc extends Bloc { - LanguageSelectBloc(LanguageSelectState initialState) : super(initialState) { + LanguageSelectModel languageSelectModel; + LanguageSelectBloc(LanguageSelectState initialState, + {required this.languageSelectModel}) + : super(initialState) { on(_onInitialize); on(_changeDropDown); } @@ -27,7 +31,8 @@ class LanguageSelectBloc Emitter emit, ) { emit(state.copyWith(selectedDropDownValue: event.value)); - LanguageSelectModel().userRegistrationSheet.lang = event.value.toString(); + languageSelectModel.userRegistrationSheet.lang = event.value.title; + print(json.encode(languageSelectModel.userRegistrationSheet.lang)); } List fillDropdownItemList() { diff --git a/lib/presentation/language_select_screen/language_select_screen.dart b/lib/presentation/language_select_screen/language_select_screen.dart index 888a3c28..36bb6e7a 100644 --- a/lib/presentation/language_select_screen/language_select_screen.dart +++ b/lib/presentation/language_select_screen/language_select_screen.dart @@ -8,11 +8,11 @@ import 'package:flutter/material.dart'; class LanguageSelectScreen extends StatelessWidget { const LanguageSelectScreen({Key? key}) : super(key: key); - static Widget builder(BuildContext context) { return BlocProvider( create: (context) => LanguageSelectBloc( - LanguageSelectState(languageSelectModelObj: LanguageSelectModel())) + LanguageSelectState(languageSelectModelObj: LanguageSelectModel()), + languageSelectModel: LanguageSelectModel()) ..add(LanguageSelectInitialEvent()), child: LanguageSelectScreen()); } From 657643f91686d64edcec98367ef58598289f3bf1 Mon Sep 17 00:00:00 2001 From: maxxkim Date: Fri, 22 Dec 2023 11:08:57 +0300 Subject: [PATCH 11/22] Some further logic fixes --- devtools_options.yaml | 1 + .../additional_information_screen.dart | 4 +- .../allergies_screen/allergies_screen.dart | 4 +- .../blood_pressure_screen.dart | 4 +- .../body_circumferences_screen.dart | 4 +- .../city_of_living_screen.dart | 4 +- .../bloc/credentials_bloc.dart | 2 +- .../bloc/credentials_state.dart | 10 ++-- .../credentials_screen.dart | 24 +++++----- .../date_of_birth_screen.dart | 4 +- .../favorite_foods_screen.dart | 4 +- .../favorite_sports_screen.dart | 4 +- .../gender_screen/gender_screen.dart | 4 +- .../height_screen/height_screen.dart | 4 +- .../bloc/language_select_bloc.dart | 11 ++--- .../language_select_screen.dart | 48 +++++++++++-------- .../medicine_intake_screen.dart | 4 +- .../name_screen/models/name_model.dart | 11 +++-- lib/presentation/name_screen/name_screen.dart | 35 ++++++++++++-- .../weight_screen/weight_screen.dart | 4 +- ...ined_button.dart => next_step_button.dart} | 5 +- 21 files changed, 120 insertions(+), 75 deletions(-) create mode 100644 devtools_options.yaml rename lib/widgets/{custom_outlined_button.dart => next_step_button.dart} (94%) diff --git a/devtools_options.yaml b/devtools_options.yaml new file mode 100644 index 00000000..7e7e7f67 --- /dev/null +++ b/devtools_options.yaml @@ -0,0 +1 @@ +extensions: diff --git a/lib/presentation/additional_information_screen/additional_information_screen.dart b/lib/presentation/additional_information_screen/additional_information_screen.dart index c3778012..a75d2eeb 100644 --- a/lib/presentation/additional_information_screen/additional_information_screen.dart +++ b/lib/presentation/additional_information_screen/additional_information_screen.dart @@ -4,7 +4,7 @@ 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/custom_outlined_button.dart'; +import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; @@ -58,7 +58,7 @@ class _AdditionalInformationScreenState SizedBox(height: 73.v), _buildTextFormField(context), Spacer(), - CustomOutlinedButton( + NextStepButton( text: "finish".tr.toUpperCase(), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, onPressed: () { diff --git a/lib/presentation/allergies_screen/allergies_screen.dart b/lib/presentation/allergies_screen/allergies_screen.dart index 5ea99b12..fa9da4d0 100644 --- a/lib/presentation/allergies_screen/allergies_screen.dart +++ b/lib/presentation/allergies_screen/allergies_screen.dart @@ -4,7 +4,7 @@ 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/custom_outlined_button.dart'; +import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; @@ -57,7 +57,7 @@ class _AllergiesScreenState extends State { Spacer(flex: 36), _buildTextFormField(context), Spacer(flex: 63), - CustomOutlinedButton( + NextStepButton( text: "continue".tr.toUpperCase(), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, onPressed: () { diff --git a/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart b/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart index b005a3be..81ec7eaa 100644 --- a/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart +++ b/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart @@ -5,7 +5,7 @@ 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/custom_drop_down.dart'; -import 'package:eatvio_app/widgets/custom_outlined_button.dart'; +import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; @@ -160,7 +160,7 @@ class _BloodPressureScreenState extends State { }); })), Spacer(), - CustomOutlinedButton( + NextStepButton( text: "continue".tr.toUpperCase(), margin: EdgeInsets.symmetric(horizontal: 4.h), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, diff --git a/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart b/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart index 3ad5107b..aee3e4ad 100644 --- a/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart +++ b/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart @@ -4,7 +4,7 @@ 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/custom_outlined_button.dart'; +import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; @@ -93,7 +93,7 @@ class _BodyCircumferencesScreenState extends State { textInputAction: TextInputAction.done); }), Spacer(), - CustomOutlinedButton( + NextStepButton( text: "continue".tr.toUpperCase(), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, onPressed: () { diff --git a/lib/presentation/city_of_living_screen/city_of_living_screen.dart b/lib/presentation/city_of_living_screen/city_of_living_screen.dart index 60650bf2..37b24540 100644 --- a/lib/presentation/city_of_living_screen/city_of_living_screen.dart +++ b/lib/presentation/city_of_living_screen/city_of_living_screen.dart @@ -5,7 +5,7 @@ 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/custom_drop_down.dart'; -import 'package:eatvio_app/widgets/custom_outlined_button.dart'; +import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:flutter/material.dart'; class CityOfLivingScreen extends StatelessWidget { @@ -99,7 +99,7 @@ class CityOfLivingScreen extends StatelessWidget { }); }), Spacer(flex: 65), - CustomOutlinedButton( + NextStepButton( text: "continue".tr.toUpperCase(), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, onPressed: () { diff --git a/lib/presentation/credentials_screen/bloc/credentials_bloc.dart b/lib/presentation/credentials_screen/bloc/credentials_bloc.dart index c62211ee..6fab34bb 100644 --- a/lib/presentation/credentials_screen/bloc/credentials_bloc.dart +++ b/lib/presentation/credentials_screen/bloc/credentials_bloc.dart @@ -16,7 +16,7 @@ class CredentialsBloc extends Bloc { Emitter emit, ) async { emit(state.copyWith( - emailController: TextEditingController(), + valueController: TextEditingController(), passwordController: TextEditingController(), passwordConfirmationController: TextEditingController())); } diff --git a/lib/presentation/credentials_screen/bloc/credentials_state.dart b/lib/presentation/credentials_screen/bloc/credentials_state.dart index 91cb6633..2d50f0f9 100644 --- a/lib/presentation/credentials_screen/bloc/credentials_state.dart +++ b/lib/presentation/credentials_screen/bloc/credentials_state.dart @@ -5,13 +5,13 @@ part of 'credentials_bloc.dart'; /// Represents the state of Credentials in the application. class CredentialsState extends Equatable { CredentialsState({ - this.emailController, + this.valueController, this.passwordController, this.passwordConfirmationController, this.credentialsModelObj, }); - TextEditingController? emailController; + TextEditingController? valueController; TextEditingController? passwordController; @@ -21,19 +21,19 @@ class CredentialsState extends Equatable { @override List get props => [ - emailController, + valueController, passwordController, passwordConfirmationController, credentialsModelObj, ]; CredentialsState copyWith({ - TextEditingController? emailController, + TextEditingController? valueController, TextEditingController? passwordController, TextEditingController? passwordConfirmationController, CredentialsModel? credentialsModelObj, }) { return CredentialsState( - emailController: emailController ?? this.emailController, + valueController: valueController ?? this.valueController, passwordController: passwordController ?? this.passwordController, passwordConfirmationController: passwordConfirmationController ?? this.passwordConfirmationController, diff --git a/lib/presentation/credentials_screen/credentials_screen.dart b/lib/presentation/credentials_screen/credentials_screen.dart index a68b47ec..f7b297c5 100644 --- a/lib/presentation/credentials_screen/credentials_screen.dart +++ b/lib/presentation/credentials_screen/credentials_screen.dart @@ -1,10 +1,12 @@ +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; + 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/custom_outlined_button.dart'; +import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; @@ -55,10 +57,10 @@ class CredentialsScreen extends StatelessWidget { SizedBox(height: 3.v), BlocSelector( - selector: (state) => state.passwordController, - builder: (context, passwordController) { + selector: (state) => state.valueController, + builder: (context, valueController) { return CustomTextFormField( - controller: passwordController, + controller: valueController, textInputAction: TextInputAction.done); }), SizedBox(height: 19.v), @@ -66,11 +68,11 @@ class CredentialsScreen extends StatelessWidget { SizedBox(height: 5.v), BlocSelector( - selector: (state) => state.passwordConfirmationController, - builder: (context, passwordConfirmationController) { + selector: (state) => state.passwordController, + builder: (context, passwordController) { return CustomTextFormField( obscureText: true, - controller: passwordConfirmationController, + controller: passwordController, ); }), SizedBox(height: 21.v), @@ -79,15 +81,15 @@ class CredentialsScreen extends StatelessWidget { SizedBox(height: 3.v), BlocSelector( - selector: (state) => state.emailController, - builder: (context, emailController3) { + selector: (state) => state.passwordConfirmationController, + builder: (context, passwordConfirmationController) { return CustomTextFormField( obscureText: true, - controller: emailController3, + controller: passwordConfirmationController, textInputAction: TextInputAction.done); }), Spacer(), - CustomOutlinedButton( + NextStepButton( text: "continue".tr.toUpperCase(), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, onPressed: () { diff --git a/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart b/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart index 32e7c482..18d4dcb8 100644 --- a/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart +++ b/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart @@ -4,7 +4,7 @@ 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/custom_outlined_button.dart'; +import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:flutter/material.dart'; class DateOfBirthScreen extends StatefulWidget { @@ -58,7 +58,7 @@ class _DateOfBirthScreenState extends State { Spacer(flex: 39), _buildDateInput(context), Spacer(flex: 60), - CustomOutlinedButton( + NextStepButton( text: "continue".tr.toUpperCase(), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, onPressed: () { diff --git a/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart b/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart index 2ee032e7..c96a03e9 100644 --- a/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart +++ b/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart @@ -4,7 +4,7 @@ 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/custom_outlined_button.dart'; +import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; @@ -65,7 +65,7 @@ class _FavoriteFoodsScreenState extends State { SizedBox(height: 22.v), _buildTextFormField1(context), SizedBox(height: 27.v), - CustomOutlinedButton( + NextStepButton( text: "continue".tr.toUpperCase(), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, onPressed: () { diff --git a/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart b/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart index 543a1465..2db602c4 100644 --- a/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart +++ b/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart @@ -4,7 +4,7 @@ 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/custom_outlined_button.dart'; +import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; @@ -60,7 +60,7 @@ class _FavoriteSportsScreenState extends State { Spacer(flex: 32), _buildTextFormFieldSection(context), Spacer(flex: 67), - CustomOutlinedButton( + NextStepButton( text: "continue".tr.toUpperCase(), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, onPressed: () { diff --git a/lib/presentation/gender_screen/gender_screen.dart b/lib/presentation/gender_screen/gender_screen.dart index 94ea3c6d..f1a68480 100644 --- a/lib/presentation/gender_screen/gender_screen.dart +++ b/lib/presentation/gender_screen/gender_screen.dart @@ -4,7 +4,7 @@ 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/custom_outlined_button.dart'; +import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:flutter/material.dart'; enum Gender { male, female } @@ -92,7 +92,7 @@ class _GenderScreenState extends State { ), ), Spacer(flex: 66), - CustomOutlinedButton( + NextStepButton( text: "continue".tr.toUpperCase(), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, onPressed: () { diff --git a/lib/presentation/height_screen/height_screen.dart b/lib/presentation/height_screen/height_screen.dart index 71144d42..b9f55e36 100644 --- a/lib/presentation/height_screen/height_screen.dart +++ b/lib/presentation/height_screen/height_screen.dart @@ -5,7 +5,7 @@ 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/custom_drop_down.dart'; -import 'package:eatvio_app/widgets/custom_outlined_button.dart'; +import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:flutter/material.dart'; class HeightScreen extends StatefulWidget { @@ -83,7 +83,7 @@ class _HeightScreenState extends State { ]) ]), Spacer(), - CustomOutlinedButton( + NextStepButton( text: "continue".tr.toUpperCase(), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, onPressed: () { diff --git a/lib/presentation/language_select_screen/bloc/language_select_bloc.dart b/lib/presentation/language_select_screen/bloc/language_select_bloc.dart index 07bdccf6..e86c0c6f 100644 --- a/lib/presentation/language_select_screen/bloc/language_select_bloc.dart +++ b/lib/presentation/language_select_screen/bloc/language_select_bloc.dart @@ -2,17 +2,13 @@ import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; import '/core/app_export.dart'; import 'package:eatvio_app/presentation/language_select_screen/models/language_select_model.dart'; -import 'dart:convert'; part 'language_select_event.dart'; part 'language_select_state.dart'; /// A bloc that manages the state of a LanguageSelect according to the event that is dispatched to it. class LanguageSelectBloc extends Bloc { - LanguageSelectModel languageSelectModel; - LanguageSelectBloc(LanguageSelectState initialState, - {required this.languageSelectModel}) - : super(initialState) { + LanguageSelectBloc(LanguageSelectState initialState) : super(initialState) { on(_onInitialize); on(_changeDropDown); } @@ -31,8 +27,9 @@ class LanguageSelectBloc Emitter emit, ) { emit(state.copyWith(selectedDropDownValue: event.value)); - languageSelectModel.userRegistrationSheet.lang = event.value.title; - print(json.encode(languageSelectModel.userRegistrationSheet.lang)); + state.languageSelectModelObj?.userRegistrationSheet.lang = + event.value.title; + print(state.languageSelectModelObj?.userRegistrationSheet.lang); } List fillDropdownItemList() { diff --git a/lib/presentation/language_select_screen/language_select_screen.dart b/lib/presentation/language_select_screen/language_select_screen.dart index 36bb6e7a..0d1f3b9d 100644 --- a/lib/presentation/language_select_screen/language_select_screen.dart +++ b/lib/presentation/language_select_screen/language_select_screen.dart @@ -2,7 +2,7 @@ import 'bloc/language_select_bloc.dart'; import 'models/language_select_model.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/custom_drop_down.dart'; -import 'package:eatvio_app/widgets/custom_outlined_button.dart'; +import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/presentation/credentials_screen/models/credentials_model.dart'; import 'package:flutter/material.dart'; @@ -11,8 +11,7 @@ class LanguageSelectScreen extends StatelessWidget { static Widget builder(BuildContext context) { return BlocProvider( create: (context) => LanguageSelectBloc( - LanguageSelectState(languageSelectModelObj: LanguageSelectModel()), - languageSelectModel: LanguageSelectModel()) + LanguageSelectState(languageSelectModelObj: LanguageSelectModel())) ..add(LanguageSelectInitialEvent()), child: LanguageSelectScreen()); } @@ -59,7 +58,10 @@ class LanguageSelectScreen extends StatelessWidget { BlocSelector( selector: (state) => state.languageSelectModelObj, - builder: (context, languageSelectModelObj) { + builder: ( + context, + languageSelectModelObj, + ) { return CustomDropDown( icon: Container( margin: @@ -81,23 +83,31 @@ class LanguageSelectScreen extends StatelessWidget { }), Spacer(flex: 63) ])), - bottomNavigationBar: CustomOutlinedButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: () { - navigteToCredentials(context); - }))); + bottomNavigationBar: + 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: () { + navigteToCredentials(context, state); + }); + }))); } /// Navigates to the genderScreen when the action is triggered. - navigteToCredentials(BuildContext context) { - LanguageSelectModel languageSelectModel = LanguageSelectModel(); - CredentialsModel credentialsModel = CredentialsModel( - userRegistrationSheet: languageSelectModel.userRegistrationSheet); - NavigatorService.pushNamed( - AppRoutes.credentialsScreen, - arguments: credentialsModel, - ); + navigteToCredentials(BuildContext context, LanguageSelectState state) { + if (state.languageSelectModelObj != null) { + CredentialsModel credentialsModel = CredentialsModel( + userRegistrationSheet: + state.languageSelectModelObj.userRegistrationSheet, + ); + NavigatorService.pushNamed( + AppRoutes.credentialsScreen, + arguments: credentialsModel, + ); + } } } diff --git a/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart b/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart index 7ca0eabd..9382e8d1 100644 --- a/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart +++ b/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart @@ -4,7 +4,7 @@ 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/custom_outlined_button.dart'; +import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; @@ -63,7 +63,7 @@ class _MedicineIntakeScreenState extends State { SizedBox(height: 86.v), _buildTextFormField(context), Spacer(), - CustomOutlinedButton( + NextStepButton( text: "continue".tr.toUpperCase(), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, onPressed: () { diff --git a/lib/presentation/name_screen/models/name_model.dart b/lib/presentation/name_screen/models/name_model.dart index 22b22839..ac2d23d1 100644 --- a/lib/presentation/name_screen/models/name_model.dart +++ b/lib/presentation/name_screen/models/name_model.dart @@ -1,14 +1,19 @@ // ignore_for_file: must_be_immutable import 'package:equatable/equatable.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; /// This class defines the variables used in the [name_screen], /// and is typically used to hold data that is passed between different parts of the application. class NameModel extends Equatable { - NameModel() {} + NameModel({required this.userRegistrationSheet}); + UserRegistrationSheet userRegistrationSheet; - NameModel copyWith() { - return NameModel(); + NameModel copyWith({UserRegistrationSheet? userRegistrationSheet}) { + return NameModel( + userRegistrationSheet: + userRegistrationSheet ?? this.userRegistrationSheet, + ); } @override diff --git a/lib/presentation/name_screen/name_screen.dart b/lib/presentation/name_screen/name_screen.dart index 7c97fa86..b87cc7a1 100644 --- a/lib/presentation/name_screen/name_screen.dart +++ b/lib/presentation/name_screen/name_screen.dart @@ -4,8 +4,9 @@ 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/custom_outlined_button.dart'; +import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:flutter/material.dart'; class NameScreen extends StatefulWidget { @@ -13,7 +14,35 @@ class NameScreen extends StatefulWidget { static Widget builder(BuildContext context) { return BlocProvider( - create: (context) => NameBloc(NameState(nameModelObj: NameModel())) + create: (context) => NameBloc(NameState( + nameModelObj: NameModel( + userRegistrationSheet: UserRegistrationSheet( + firstName: '1', + lastName: '1', + email: '1', + password: '1', + passwordConfirmation: '1', + termsAccepted: true, + birthdate: DateTime.now(), + gender: '1', + country: '1', + city: '1', + lang: '1', + weight: 1, + height: 1, + chestCircumference: 1, + waistCircumference: 1, + hipCircumference: 1, + bloodPressureUp: 1, + bloodPressureDown: 1, + hasHypo: false, + hasHyper: false, + aboutAllergy: '1', + aboutTakingPils: '1', + aboutSportHobbies: '1', + favoriteFoods: '1', + unfavoriteFoods: '1', + additionalInfo: '1')))) ..add(NameInitialEvent()), child: NameScreen()); } @@ -75,7 +104,7 @@ class _NameScreenState extends State { }), SizedBox(height: 21.v), Spacer(), - CustomOutlinedButton( + NextStepButton( text: "continue".tr.toUpperCase(), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, onPressed: () { diff --git a/lib/presentation/weight_screen/weight_screen.dart b/lib/presentation/weight_screen/weight_screen.dart index 61cfed51..aad4c57d 100644 --- a/lib/presentation/weight_screen/weight_screen.dart +++ b/lib/presentation/weight_screen/weight_screen.dart @@ -5,7 +5,7 @@ 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/custom_drop_down.dart'; -import 'package:eatvio_app/widgets/custom_outlined_button.dart'; +import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:flutter/material.dart'; class WeightScreen extends StatefulWidget { @@ -83,7 +83,7 @@ class _WeightScreenState extends State { ]) ]), Spacer(), - CustomOutlinedButton( + NextStepButton( text: "continue".tr.toUpperCase(), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, onPressed: () { diff --git a/lib/widgets/custom_outlined_button.dart b/lib/widgets/next_step_button.dart similarity index 94% rename from lib/widgets/custom_outlined_button.dart rename to lib/widgets/next_step_button.dart index d498755c..eb3f7e35 100644 --- a/lib/widgets/custom_outlined_button.dart +++ b/lib/widgets/next_step_button.dart @@ -1,9 +1,10 @@ import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/base_button.dart'; import 'package:flutter/material.dart'; +import 'package:equatable/equatable.dart'; -class CustomOutlinedButton extends BaseButton { - CustomOutlinedButton({ +class NextStepButton extends BaseButton { + NextStepButton({ Key? key, this.decoration, this.leftIcon, From a621f8d1dac7020364a65d19308da6c838caf334 Mon Sep 17 00:00:00 2001 From: maxxkim Date: Sat, 23 Dec 2023 20:57:39 +0300 Subject: [PATCH 12/22] Fix --- .../credentials_screen/credentials_screen.dart | 7 ++++--- .../bloc/language_select_bloc.dart | 1 - .../language_select_screen.dart | 18 ++++++++---------- pubspec.yaml | 4 ++-- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/lib/presentation/credentials_screen/credentials_screen.dart b/lib/presentation/credentials_screen/credentials_screen.dart index f7b297c5..3666fb4a 100644 --- a/lib/presentation/credentials_screen/credentials_screen.dart +++ b/lib/presentation/credentials_screen/credentials_screen.dart @@ -1,5 +1,4 @@ import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; - import 'bloc/credentials_bloc.dart'; import 'models/credentials_model.dart'; import 'package:eatvio_app/core/app_export.dart'; @@ -16,8 +15,10 @@ class CredentialsScreen extends StatelessWidget { static Widget builder(BuildContext context) { return BlocProvider( create: (context) => CredentialsBloc(CredentialsState( - credentialsModelObj: - ModalRoute.of(context)?.settings.arguments as CredentialsModel)) + credentialsModelObj: CredentialsModel( + userRegistrationSheet: ModalRoute.of(context)! + .settings + .arguments as UserRegistrationSheet))) ..add(CredentialsInitialEvent()), child: CredentialsScreen()); } diff --git a/lib/presentation/language_select_screen/bloc/language_select_bloc.dart b/lib/presentation/language_select_screen/bloc/language_select_bloc.dart index e86c0c6f..d6ae042c 100644 --- a/lib/presentation/language_select_screen/bloc/language_select_bloc.dart +++ b/lib/presentation/language_select_screen/bloc/language_select_bloc.dart @@ -29,7 +29,6 @@ class LanguageSelectBloc emit(state.copyWith(selectedDropDownValue: event.value)); state.languageSelectModelObj?.userRegistrationSheet.lang = event.value.title; - print(state.languageSelectModelObj?.userRegistrationSheet.lang); } List fillDropdownItemList() { diff --git a/lib/presentation/language_select_screen/language_select_screen.dart b/lib/presentation/language_select_screen/language_select_screen.dart index 0d1f3b9d..a4b26e44 100644 --- a/lib/presentation/language_select_screen/language_select_screen.dart +++ b/lib/presentation/language_select_screen/language_select_screen.dart @@ -1,3 +1,5 @@ +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; + import 'bloc/language_select_bloc.dart'; import 'models/language_select_model.dart'; import 'package:eatvio_app/core/app_export.dart'; @@ -99,15 +101,11 @@ class LanguageSelectScreen extends StatelessWidget { /// Navigates to the genderScreen when the action is triggered. navigteToCredentials(BuildContext context, LanguageSelectState state) { - if (state.languageSelectModelObj != null) { - CredentialsModel credentialsModel = CredentialsModel( - userRegistrationSheet: - state.languageSelectModelObj.userRegistrationSheet, - ); - NavigatorService.pushNamed( - AppRoutes.credentialsScreen, - arguments: credentialsModel, - ); - } + UserRegistrationSheet sheet = + state.languageSelectModelObj!.userRegistrationSheet; + NavigatorService.pushNamed( + AppRoutes.credentialsScreen, + arguments: sheet, + ); } } diff --git a/pubspec.yaml b/pubspec.yaml index 3b441985..295bc454 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,10 +9,10 @@ dependencies: flutter_localizations: sdk: flutter flutter_bloc: ^8.0.0 - connectivity_plus: ^2.3.6 + connectivity_plus: ^5.0.2 shared_preferences: ^2.0.15 cached_network_image: ^3.2.1 - flutter_svg: ^1.1.6 + flutter_svg: ^2.0.9 equatable: ^2.0.0 dev_dependencies: flutter_test: From dbe2e40e3b94a799a449ed629dcf7e5f9317e66f Mon Sep 17 00:00:00 2001 From: maxxkim Date: Mon, 25 Dec 2023 12:12:23 +0300 Subject: [PATCH 13/22] Successfully passsed data between screens and imported UserRegistrationSheet for all screens --- .../additional_information_screen.dart | 1 + .../allergies_screen/allergies_screen.dart | 1 + .../blood_pressure_screen.dart | 1 + .../body_circumferences_screen.dart | 1 + .../city_of_living_screen.dart | 1 + .../credentials_screen.dart | 54 +++++++++++-------- .../date_of_birth_screen.dart | 1 + .../favorite_foods_screen.dart | 1 + .../favorite_sports_screen.dart | 1 + .../gender_screen/gender_screen.dart | 1 + .../height_screen/height_screen.dart | 1 + .../language_select_screen.dart | 22 ++++---- .../medicine_intake_screen.dart | 1 + lib/presentation/name_screen/name_screen.dart | 1 + .../weight_screen/weight_screen.dart | 1 + lib/widgets/custom_text_form_field.dart | 4 ++ 16 files changed, 57 insertions(+), 36 deletions(-) diff --git a/lib/presentation/additional_information_screen/additional_information_screen.dart b/lib/presentation/additional_information_screen/additional_information_screen.dart index a75d2eeb..05274de2 100644 --- a/lib/presentation/additional_information_screen/additional_information_screen.dart +++ b/lib/presentation/additional_information_screen/additional_information_screen.dart @@ -5,6 +5,7 @@ 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'; diff --git a/lib/presentation/allergies_screen/allergies_screen.dart b/lib/presentation/allergies_screen/allergies_screen.dart index fa9da4d0..ac2e3aca 100644 --- a/lib/presentation/allergies_screen/allergies_screen.dart +++ b/lib/presentation/allergies_screen/allergies_screen.dart @@ -5,6 +5,7 @@ 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'; diff --git a/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart b/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart index 81ec7eaa..365dd4e0 100644 --- a/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart +++ b/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart @@ -6,6 +6,7 @@ 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/custom_drop_down.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'; diff --git a/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart b/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart index aee3e4ad..69b295f7 100644 --- a/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart +++ b/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart @@ -5,6 +5,7 @@ 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'; diff --git a/lib/presentation/city_of_living_screen/city_of_living_screen.dart b/lib/presentation/city_of_living_screen/city_of_living_screen.dart index 37b24540..4fa7da61 100644 --- a/lib/presentation/city_of_living_screen/city_of_living_screen.dart +++ b/lib/presentation/city_of_living_screen/city_of_living_screen.dart @@ -6,6 +6,7 @@ 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/custom_drop_down.dart'; import 'package:eatvio_app/widgets/next_step_button.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:flutter/material.dart'; class CityOfLivingScreen extends StatelessWidget { diff --git a/lib/presentation/credentials_screen/credentials_screen.dart b/lib/presentation/credentials_screen/credentials_screen.dart index 3666fb4a..d65f3444 100644 --- a/lib/presentation/credentials_screen/credentials_screen.dart +++ b/lib/presentation/credentials_screen/credentials_screen.dart @@ -1,4 +1,3 @@ -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'bloc/credentials_bloc.dart'; import 'models/credentials_model.dart'; import 'package:eatvio_app/core/app_export.dart'; @@ -6,21 +5,22 @@ 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 { - const CredentialsScreen({Key? key}) : super(key: key); - static Widget builder(BuildContext context) { + final sheet = + ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet; return BlocProvider( - create: (context) => CredentialsBloc(CredentialsState( - credentialsModelObj: CredentialsModel( - userRegistrationSheet: ModalRoute.of(context)! - .settings - .arguments as UserRegistrationSheet))) - ..add(CredentialsInitialEvent()), - child: CredentialsScreen()); + create: (context) => CredentialsBloc( + CredentialsState( + credentialsModelObj: CredentialsModel(userRegistrationSheet: sheet), + ), + )..add(CredentialsInitialEvent()), + child: CredentialsScreen(), + ); } @override @@ -90,12 +90,27 @@ class CredentialsScreen extends StatelessWidget { textInputAction: TextInputAction.done); }), Spacer(), - NextStepButton( - text: "continue".tr.toUpperCase(), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: () { - navigateToName(context); - }), + 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), ])))); } @@ -118,11 +133,4 @@ class CredentialsScreen extends StatelessWidget { onTapArrowLeft(BuildContext context) { NavigatorService.goBack(); } - - /// Navigates to the weightScreen when the action is triggered. - navigateToName(BuildContext context) { - NavigatorService.pushNamed( - AppRoutes.nameScreen, - ); - } } diff --git a/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart b/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart index 18d4dcb8..d542bebf 100644 --- a/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart +++ b/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart @@ -5,6 +5,7 @@ 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:flutter/material.dart'; class DateOfBirthScreen extends StatefulWidget { diff --git a/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart b/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart index c96a03e9..034b5763 100644 --- a/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart +++ b/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart @@ -5,6 +5,7 @@ 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'; diff --git a/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart b/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart index 2db602c4..74398e64 100644 --- a/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart +++ b/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart @@ -5,6 +5,7 @@ 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'; diff --git a/lib/presentation/gender_screen/gender_screen.dart b/lib/presentation/gender_screen/gender_screen.dart index f1a68480..6d434934 100644 --- a/lib/presentation/gender_screen/gender_screen.dart +++ b/lib/presentation/gender_screen/gender_screen.dart @@ -5,6 +5,7 @@ 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:flutter/material.dart'; enum Gender { male, female } diff --git a/lib/presentation/height_screen/height_screen.dart b/lib/presentation/height_screen/height_screen.dart index b9f55e36..3acd45a2 100644 --- a/lib/presentation/height_screen/height_screen.dart +++ b/lib/presentation/height_screen/height_screen.dart @@ -6,6 +6,7 @@ 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/custom_drop_down.dart'; import 'package:eatvio_app/widgets/next_step_button.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:flutter/material.dart'; class HeightScreen extends StatefulWidget { diff --git a/lib/presentation/language_select_screen/language_select_screen.dart b/lib/presentation/language_select_screen/language_select_screen.dart index a4b26e44..44166da8 100644 --- a/lib/presentation/language_select_screen/language_select_screen.dart +++ b/lib/presentation/language_select_screen/language_select_screen.dart @@ -1,11 +1,11 @@ import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; +import 'package:eatvio_app/presentation/credentials_screen/credentials_screen.dart'; import 'bloc/language_select_bloc.dart'; import 'models/language_select_model.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/custom_drop_down.dart'; import 'package:eatvio_app/widgets/next_step_button.dart'; -import 'package:eatvio_app/presentation/credentials_screen/models/credentials_model.dart'; import 'package:flutter/material.dart'; class LanguageSelectScreen extends StatelessWidget { @@ -74,7 +74,7 @@ class LanguageSelectScreen extends StatelessWidget { imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize)), - hintText: "Русский".tr, + hintText: "Не выбрано".tr, items: languageSelectModelObj?.dropdownItemList ?? [], onChanged: (value) { @@ -94,18 +94,14 @@ class LanguageSelectScreen extends StatelessWidget { EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v), buttonStyle: CustomButtonStyles.outlinePrimaryTL15, onPressed: () { - navigteToCredentials(context, state); + UserRegistrationSheet sheet = + state.languageSelectModelObj!.userRegistrationSheet; + Navigator.pushNamed( + context, + AppRoutes.credentialsScreen, + arguments: sheet, + ); }); }))); } - - /// Navigates to the genderScreen when the action is triggered. - navigteToCredentials(BuildContext context, LanguageSelectState state) { - UserRegistrationSheet sheet = - state.languageSelectModelObj!.userRegistrationSheet; - NavigatorService.pushNamed( - AppRoutes.credentialsScreen, - arguments: sheet, - ); - } } diff --git a/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart b/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart index 9382e8d1..b552f694 100644 --- a/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart +++ b/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart @@ -5,6 +5,7 @@ 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'; diff --git a/lib/presentation/name_screen/name_screen.dart b/lib/presentation/name_screen/name_screen.dart index b87cc7a1..ead28a54 100644 --- a/lib/presentation/name_screen/name_screen.dart +++ b/lib/presentation/name_screen/name_screen.dart @@ -5,6 +5,7 @@ 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:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:flutter/material.dart'; diff --git a/lib/presentation/weight_screen/weight_screen.dart b/lib/presentation/weight_screen/weight_screen.dart index aad4c57d..f1f14656 100644 --- a/lib/presentation/weight_screen/weight_screen.dart +++ b/lib/presentation/weight_screen/weight_screen.dart @@ -6,6 +6,7 @@ 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/custom_drop_down.dart'; import 'package:eatvio_app/widgets/next_step_button.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:flutter/material.dart'; class WeightScreen extends StatefulWidget { diff --git a/lib/widgets/custom_text_form_field.dart b/lib/widgets/custom_text_form_field.dart index fed08e3f..95883776 100644 --- a/lib/widgets/custom_text_form_field.dart +++ b/lib/widgets/custom_text_form_field.dart @@ -25,6 +25,7 @@ class CustomTextFormField extends StatelessWidget { this.fillColor, this.filled = true, this.validator, + this.onSaved, }) : super( key: key, ); @@ -71,6 +72,8 @@ class CustomTextFormField extends StatelessWidget { final FormFieldValidator? validator; + final void Function(String?)? onSaved; + @override Widget build(BuildContext context) { return alignment != null @@ -94,6 +97,7 @@ class CustomTextFormField extends StatelessWidget { maxLines: maxLines ?? 1, decoration: decoration, validator: validator, + onSaved: onSaved, ), ); InputDecoration get decoration => InputDecoration( From f0ee09dfc830b991c90d039344ac2bd5428fe607 Mon Sep 17 00:00:00 2001 From: maxxkim Date: Mon, 25 Dec 2023 12:29:54 +0300 Subject: [PATCH 14/22] Added logic for NameScreen --- .../name_screen/bloc/name_bloc.dart | 5 +- .../name_screen/bloc/name_state.dart | 26 +++--- .../name_screen/models/name_model.dart | 2 +- lib/presentation/name_screen/name_screen.dart | 81 +++++++------------ 4 files changed, 44 insertions(+), 70 deletions(-) diff --git a/lib/presentation/name_screen/bloc/name_bloc.dart b/lib/presentation/name_screen/bloc/name_bloc.dart index 7611e222..00baf316 100644 --- a/lib/presentation/name_screen/bloc/name_bloc.dart +++ b/lib/presentation/name_screen/bloc/name_bloc.dart @@ -16,8 +16,7 @@ class NameBloc extends Bloc { Emitter emit, ) async { emit(state.copyWith( - valueController: TextEditingController(), - valueController1: TextEditingController(), - valueController2: TextEditingController())); + firstNameController: TextEditingController(), + lastNameController: TextEditingController())); } } diff --git a/lib/presentation/name_screen/bloc/name_state.dart b/lib/presentation/name_screen/bloc/name_state.dart index d729b067..b3e0980b 100644 --- a/lib/presentation/name_screen/bloc/name_state.dart +++ b/lib/presentation/name_screen/bloc/name_state.dart @@ -5,37 +5,31 @@ part of 'name_bloc.dart'; /// Represents the state of Name in the application. class NameState extends Equatable { NameState({ - this.valueController, - this.valueController1, - this.valueController2, + this.firstNameController, + this.lastNameController, this.nameModelObj, }); - TextEditingController? valueController; + TextEditingController? firstNameController; - TextEditingController? valueController1; - - TextEditingController? valueController2; + TextEditingController? lastNameController; NameModel? nameModelObj; @override List get props => [ - valueController, - valueController1, - valueController2, + firstNameController, + lastNameController, nameModelObj, ]; NameState copyWith({ - TextEditingController? valueController, - TextEditingController? valueController1, - TextEditingController? valueController2, + TextEditingController? firstNameController, + TextEditingController? lastNameController, NameModel? nameModelObj, }) { return NameState( - valueController: valueController ?? this.valueController, - valueController1: valueController1 ?? this.valueController1, - valueController2: valueController2 ?? this.valueController2, + firstNameController: firstNameController ?? this.firstNameController, + lastNameController: lastNameController ?? this.lastNameController, nameModelObj: nameModelObj ?? this.nameModelObj, ); } diff --git a/lib/presentation/name_screen/models/name_model.dart b/lib/presentation/name_screen/models/name_model.dart index ac2d23d1..6fa44b07 100644 --- a/lib/presentation/name_screen/models/name_model.dart +++ b/lib/presentation/name_screen/models/name_model.dart @@ -6,8 +6,8 @@ import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_m /// This class defines the variables used in the [name_screen], /// and is typically used to hold data that is passed between different parts of the application. class NameModel extends Equatable { - NameModel({required this.userRegistrationSheet}); UserRegistrationSheet userRegistrationSheet; + NameModel({required this.userRegistrationSheet}); NameModel copyWith({UserRegistrationSheet? userRegistrationSheet}) { return NameModel( diff --git a/lib/presentation/name_screen/name_screen.dart b/lib/presentation/name_screen/name_screen.dart index ead28a54..7d0eb39d 100644 --- a/lib/presentation/name_screen/name_screen.dart +++ b/lib/presentation/name_screen/name_screen.dart @@ -7,44 +7,20 @@ 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:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:flutter/material.dart'; class NameScreen extends StatefulWidget { const NameScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { + final sheet = + ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet; return BlocProvider( - create: (context) => NameBloc(NameState( - nameModelObj: NameModel( - userRegistrationSheet: UserRegistrationSheet( - firstName: '1', - lastName: '1', - email: '1', - password: '1', - passwordConfirmation: '1', - termsAccepted: true, - birthdate: DateTime.now(), - gender: '1', - country: '1', - city: '1', - lang: '1', - weight: 1, - height: 1, - chestCircumference: 1, - waistCircumference: 1, - hipCircumference: 1, - bloodPressureUp: 1, - bloodPressureDown: 1, - hasHypo: false, - hasHyper: false, - aboutAllergy: '1', - aboutTakingPils: '1', - aboutSportHobbies: '1', - favoriteFoods: '1', - unfavoriteFoods: '1', - additionalInfo: '1')))) - ..add(NameInitialEvent()), + create: (context) => NameBloc( + NameState( + nameModelObj: NameModel(userRegistrationSheet: sheet), + ), + )..add(NameInitialEvent()), child: NameScreen()); } @@ -87,30 +63,42 @@ class _NameScreenState extends State { Text("first_name".tr, style: theme.textTheme.bodyLarge), SizedBox(height: 3.v), BlocSelector( - selector: (state) => state.valueController, - builder: (context, valueController) { + selector: (state) => state.firstNameController, + builder: (context, firstNameController) { return CustomTextFormField( - controller: valueController, + controller: firstNameController, textInputAction: TextInputAction.done); }), SizedBox(height: 19.v), Text("last_name".tr, style: theme.textTheme.bodyLarge), SizedBox(height: 5.v), BlocSelector( - selector: (state) => state.valueController1, - builder: (context, valueController1) { + selector: (state) => state.lastNameController, + builder: (context, lastNameController) { return CustomTextFormField( - controller: valueController1, + controller: lastNameController, ); }), SizedBox(height: 21.v), Spacer(), - NextStepButton( - text: "continue".tr.toUpperCase(), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: () { - navigateToGender(context); - }), + 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.nameModelObj!.userRegistrationSheet; + sheet.firstName = state.firstNameController!.text; + sheet.lastName = state.lastNameController!.text; + Navigator.pushNamed( + context, + AppRoutes.genderScreen, + arguments: sheet, + ); + }); + }), SizedBox(height: 17.v), ])))); } @@ -133,11 +121,4 @@ class _NameScreenState extends State { onTapArrowLeft(BuildContext context) { NavigatorService.goBack(); } - - /// Navigates to the weightScreen when the action is triggered. - navigateToGender(BuildContext context) { - NavigatorService.pushNamed( - AppRoutes.genderScreen, - ); - } } From bf5406fec807527538a6fcee84667ac3cb655c4f Mon Sep 17 00:00:00 2001 From: maxxkim Date: Mon, 25 Dec 2023 15:35:13 +0300 Subject: [PATCH 15/22] Added logic for gender --- .../gender_screen/bloc/gender_bloc.dart | 22 +++++- .../gender_screen/bloc/gender_event.dart | 12 ++- .../gender_screen/bloc/gender_state.dart | 14 +++- .../gender_screen/gender_screen.dart | 77 ++++++++++--------- .../gender_screen/models/gender_model.dart | 12 ++- lib/presentation/name_screen/name_screen.dart | 7 +- 6 files changed, 93 insertions(+), 51 deletions(-) diff --git a/lib/presentation/gender_screen/bloc/gender_bloc.dart b/lib/presentation/gender_screen/bloc/gender_bloc.dart index 2d2b2618..b30f421a 100644 --- a/lib/presentation/gender_screen/bloc/gender_bloc.dart +++ b/lib/presentation/gender_screen/bloc/gender_bloc.dart @@ -9,10 +9,30 @@ part 'gender_state.dart'; class GenderBloc extends Bloc { GenderBloc(GenderState initialState) : super(initialState) { on(_onInitialize); + on(_GenderSelect); } _onInitialize( GenderInitialEvent event, Emitter emit, - ) async {} + ) async { + emit(state.copyWith(genderModelObj: state.genderModelObj)); + } + + _GenderSelect( + GenderSelectEvent event, + Emitter emit, + ) { + emit(state.copyWith(selectedRadioValue: event.value)); + state.genderModelObj?.userRegistrationSheet.gender = event.value; + /* + print(state.genderModelObj?.userRegistrationSheet.lang); + print(state.genderModelObj?.userRegistrationSheet.email); + print(state.genderModelObj?.userRegistrationSheet.password); + print(state.genderModelObj?.userRegistrationSheet.passwordConfirmation); + print(state.genderModelObj?.userRegistrationSheet.firstName); + print(state.genderModelObj?.userRegistrationSheet.lastName); + print(state.genderModelObj?.userRegistrationSheet.gender); + */ + } } diff --git a/lib/presentation/gender_screen/bloc/gender_event.dart b/lib/presentation/gender_screen/bloc/gender_event.dart index 3660a87c..f6b9f69c 100644 --- a/lib/presentation/gender_screen/bloc/gender_event.dart +++ b/lib/presentation/gender_screen/bloc/gender_event.dart @@ -9,8 +9,18 @@ part of 'gender_bloc.dart'; @immutable abstract class GenderEvent extends Equatable {} -/// Event that is dispatched when the Gender widget is first created. class GenderInitialEvent extends GenderEvent { @override List get props => []; } + +class GenderSelectEvent extends GenderEvent { + GenderSelectEvent({required this.value}); + + String value; + + @override + List get props => [ + value, + ]; +} diff --git a/lib/presentation/gender_screen/bloc/gender_state.dart b/lib/presentation/gender_screen/bloc/gender_state.dart index 16109442..996082e8 100644 --- a/lib/presentation/gender_screen/bloc/gender_state.dart +++ b/lib/presentation/gender_screen/bloc/gender_state.dart @@ -4,16 +4,26 @@ part of 'gender_bloc.dart'; /// Represents the state of Gender in the application. class GenderState extends Equatable { - GenderState({this.genderModelObj}); + GenderState({ + this.selectedRadioValue, + this.genderModelObj, + }); + + String? selectedRadioValue; GenderModel? genderModelObj; @override List get props => [ + selectedRadioValue, genderModelObj, ]; - GenderState copyWith({GenderModel? genderModelObj}) { + GenderState copyWith({ + String? selectedRadioValue, + GenderModel? genderModelObj, + }) { return GenderState( + selectedRadioValue: selectedRadioValue ?? this.selectedRadioValue, genderModelObj: genderModelObj ?? this.genderModelObj, ); } diff --git a/lib/presentation/gender_screen/gender_screen.dart b/lib/presentation/gender_screen/gender_screen.dart index 6d434934..b3e909e2 100644 --- a/lib/presentation/gender_screen/gender_screen.dart +++ b/lib/presentation/gender_screen/gender_screen.dart @@ -1,23 +1,25 @@ import 'bloc/gender_bloc.dart'; import 'models/gender_model.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_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:flutter/material.dart'; -enum Gender { male, female } - class GenderScreen extends StatefulWidget { const GenderScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { + final sheet = + ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet; return BlocProvider( - create: (context) => - GenderBloc(GenderState(genderModelObj: GenderModel())) - ..add(GenderInitialEvent()), + create: (context) => GenderBloc( + GenderState( + genderModelObj: GenderModel(userRegistrationSheet: sheet), + ), + )..add(GenderInitialEvent()), child: GenderScreen()); } @@ -26,9 +28,9 @@ class GenderScreen extends StatefulWidget { } class _GenderScreenState extends State { - Gender? _gender; @override Widget build(BuildContext context) { + String gender = 'female'; mediaQueryData = MediaQuery.of(context); return BlocBuilder(builder: (context, state) { return SafeArea( @@ -60,45 +62,51 @@ class _GenderScreenState extends State { style: theme.textTheme.headlineSmall), RadioListTile( title: Text('Мужской'), - value: Gender.male, - groupValue: _gender, + value: 'male', + groupValue: state.selectedRadioValue, onChanged: (value) { - setState(() { - _gender = value as Gender?; - }); + BlocProvider.of(context) + .add(GenderSelectEvent(value: 'male')); }, secondary: Image.asset( - _gender == Gender.male - ? 'assets/images/img_male.png' - : 'assets/images/img_male.png', + 'assets/images/img_male.png', width: 40, height: 40, ), ), RadioListTile( title: Text('Женский'), - value: Gender.female, - groupValue: _gender, + value: 'female', + groupValue: state.selectedRadioValue, onChanged: (value) { - setState(() { - _gender = value as Gender?; - }); + BlocProvider.of(context) + .add(GenderSelectEvent(value: 'female')); }, secondary: Image.asset( - _gender == Gender.female - ? 'assets/images/img_female.png' - : 'assets/images/img_female.png', + 'assets/images/img_female.png', width: 40, height: 40, ), ), Spacer(flex: 66), - NextStepButton( - text: "continue".tr.toUpperCase(), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: () { - navigateToDate(context); - }), + 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.genderModelObj!.userRegistrationSheet; + sheet.gender = state.selectedRadioValue!; + Navigator.pushNamed( + context, + AppRoutes.dateOfBirthScreen, + arguments: sheet, + ); + }); + }), SizedBox(height: 17.v), ])))); }); @@ -112,7 +120,9 @@ class _GenderScreenState extends State { imagePath: ImageConstant.imgArrowLeft, margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v), onTap: () { - onTapArrowLeft(context); + NavigatorService.pushNamed( + AppRoutes.dateOfBirthScreen, + ); }), centerTitle: true, title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio)); @@ -122,11 +132,4 @@ class _GenderScreenState extends State { onTapArrowLeft(BuildContext context) { NavigatorService.goBack(); } - - /// Navigates to the dateOfBirthScreen when the action is triggered. - navigateToDate(BuildContext context) { - NavigatorService.pushNamed( - AppRoutes.dateOfBirthScreen, - ); - } } diff --git a/lib/presentation/gender_screen/models/gender_model.dart b/lib/presentation/gender_screen/models/gender_model.dart index 1ba38218..b314fba5 100644 --- a/lib/presentation/gender_screen/models/gender_model.dart +++ b/lib/presentation/gender_screen/models/gender_model.dart @@ -1,16 +1,20 @@ // ignore_for_file: must_be_immutable import 'package:equatable/equatable.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; /// This class defines the variables used in the [gender_screen], /// and is typically used to hold data that is passed between different parts of the application. class GenderModel extends Equatable { - GenderModel() {} + UserRegistrationSheet userRegistrationSheet; + GenderModel({required this.userRegistrationSheet}); - GenderModel copyWith() { - return GenderModel(); + GenderModel copyWith({UserRegistrationSheet? userRegistrationSheet, gender}) { + return GenderModel( + userRegistrationSheet: + userRegistrationSheet ?? this.userRegistrationSheet); } @override - List get props => []; + List get props => [userRegistrationSheet]; } diff --git a/lib/presentation/name_screen/name_screen.dart b/lib/presentation/name_screen/name_screen.dart index 7d0eb39d..2e7bc8ab 100644 --- a/lib/presentation/name_screen/name_screen.dart +++ b/lib/presentation/name_screen/name_screen.dart @@ -9,7 +9,7 @@ import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_m import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; -class NameScreen extends StatefulWidget { +class NameScreen extends StatelessWidget { const NameScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { @@ -24,11 +24,6 @@ class NameScreen extends StatefulWidget { child: NameScreen()); } - @override - State createState() => _NameScreenState(); -} - -class _NameScreenState extends State { @override Widget build(BuildContext context) { mediaQueryData = MediaQuery.of(context); From d908f5f28c43f79cb1804938aa2c840c52abb5ec Mon Sep 17 00:00:00 2001 From: maxxkim Date: Mon, 25 Dec 2023 15:37:08 +0300 Subject: [PATCH 16/22] PasswordConfirmation fix --- lib/presentation/credentials_screen/credentials_screen.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/presentation/credentials_screen/credentials_screen.dart b/lib/presentation/credentials_screen/credentials_screen.dart index d65f3444..978aea11 100644 --- a/lib/presentation/credentials_screen/credentials_screen.dart +++ b/lib/presentation/credentials_screen/credentials_screen.dart @@ -103,7 +103,7 @@ class CredentialsScreen extends StatelessWidget { sheet.email = state.valueController!.text; sheet.password = state.passwordController!.text; sheet.passwordConfirmation = - state.passwordController!.text; + state.passwordConfirmationController!.text; Navigator.pushNamed( context, AppRoutes.nameScreen, From aa1ab31a9195e7cf39130e1feef76e9e37371b4c Mon Sep 17 00:00:00 2001 From: maxxkim Date: Mon, 25 Dec 2023 17:23:18 +0300 Subject: [PATCH 17/22] Added logic for body_circumferences and city_of_living --- .../bloc/body_circumferences_bloc.dart | 6 +- .../bloc/body_circumferences_state.dart | 33 +++++---- .../body_circumferences_screen.dart | 68 ++++++++++++------- .../models/body_circumferences_model.dart | 11 ++- .../bloc/city_of_living_bloc.dart | 3 + .../city_of_living_screen.dart | 44 +++++++----- .../models/city_of_living_model.dart | 8 ++- .../date_of_birth_screen.dart | 39 ++++++----- .../models/date_of_birth_model.dart | 12 +++- .../gender_screen/bloc/gender_bloc.dart | 9 --- lib/widgets/custom_text_form_field.dart | 5 ++ 11 files changed, 147 insertions(+), 91 deletions(-) diff --git a/lib/presentation/body_circumferences_screen/bloc/body_circumferences_bloc.dart b/lib/presentation/body_circumferences_screen/bloc/body_circumferences_bloc.dart index 5b626c60..30e0097c 100644 --- a/lib/presentation/body_circumferences_screen/bloc/body_circumferences_bloc.dart +++ b/lib/presentation/body_circumferences_screen/bloc/body_circumferences_bloc.dart @@ -18,8 +18,8 @@ class BodyCircumferencesBloc Emitter emit, ) async { emit(state.copyWith( - valueController: TextEditingController(), - valueController1: TextEditingController(), - valueController2: TextEditingController())); + chestCircumferenceController: TextEditingController(), + waistCircumferenceController: TextEditingController(), + hipCircumferenceController: TextEditingController())); } } diff --git a/lib/presentation/body_circumferences_screen/bloc/body_circumferences_state.dart b/lib/presentation/body_circumferences_screen/bloc/body_circumferences_state.dart index 9c952fb0..df28755c 100644 --- a/lib/presentation/body_circumferences_screen/bloc/body_circumferences_state.dart +++ b/lib/presentation/body_circumferences_screen/bloc/body_circumferences_state.dart @@ -5,37 +5,40 @@ part of 'body_circumferences_bloc.dart'; /// Represents the state of BodyCircumferences in the application. class BodyCircumferencesState extends Equatable { BodyCircumferencesState({ - this.valueController, - this.valueController1, - this.valueController2, + this.chestCircumferenceController, + this.waistCircumferenceController, + this.hipCircumferenceController, this.bodyCircumferencesModelObj, }); - TextEditingController? valueController; + TextEditingController? chestCircumferenceController; - TextEditingController? valueController1; + TextEditingController? waistCircumferenceController; - TextEditingController? valueController2; + TextEditingController? hipCircumferenceController; BodyCircumferencesModel? bodyCircumferencesModelObj; @override List get props => [ - valueController, - valueController1, - valueController2, + chestCircumferenceController, + waistCircumferenceController, + hipCircumferenceController, bodyCircumferencesModelObj, ]; BodyCircumferencesState copyWith({ - TextEditingController? valueController, - TextEditingController? valueController1, - TextEditingController? valueController2, + TextEditingController? chestCircumferenceController, + TextEditingController? waistCircumferenceController, + TextEditingController? hipCircumferenceController, BodyCircumferencesModel? bodyCircumferencesModelObj, }) { return BodyCircumferencesState( - valueController: valueController ?? this.valueController, - valueController1: valueController1 ?? this.valueController1, - valueController2: valueController2 ?? this.valueController2, + chestCircumferenceController: + chestCircumferenceController ?? this.chestCircumferenceController, + waistCircumferenceController: + waistCircumferenceController ?? this.waistCircumferenceController, + hipCircumferenceController: + hipCircumferenceController ?? this.hipCircumferenceController, bodyCircumferencesModelObj: bodyCircumferencesModelObj ?? this.bodyCircumferencesModelObj, ); diff --git a/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart b/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart index 69b295f7..c6e75bce 100644 --- a/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart +++ b/lib/presentation/body_circumferences_screen/body_circumferences_screen.dart @@ -1,4 +1,5 @@ import 'bloc/body_circumferences_bloc.dart'; +import 'package:flutter/services.dart'; import 'models/body_circumferences_model.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; @@ -9,25 +10,23 @@ import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_m import 'package:eatvio_app/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; -class BodyCircumferencesScreen extends StatefulWidget { +class BodyCircumferencesScreen extends StatelessWidget { const BodyCircumferencesScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { + final sheet = + ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet; return BlocProvider( create: (context) => BodyCircumferencesBloc(BodyCircumferencesState( - bodyCircumferencesModelObj: BodyCircumferencesModel())) + bodyCircumferencesModelObj: + BodyCircumferencesModel(userRegistrationSheet: sheet))) ..add(BodyCircumferencesInitialEvent()), child: BodyCircumferencesScreen()); } - @override - State createState() => - _BodyCircumferencesScreenState(); -} - -class _BodyCircumferencesScreenState extends State { @override Widget build(BuildContext context) { + final digitsOnly = FilteringTextInputFormatter.digitsOnly; mediaQueryData = MediaQuery.of(context); return SafeArea( child: Scaffold( @@ -63,10 +62,12 @@ class _BodyCircumferencesScreenState extends State { SizedBox(height: 3.v), BlocSelector( - selector: (state) => state.valueController, - builder: (context, valueController) { + selector: (state) => state.chestCircumferenceController, + builder: (context, chestCircumferenceController) { return CustomTextFormField( - controller: valueController, hintText: "90".tr); + inputFormatters: [digitsOnly], + controller: chestCircumferenceController, + hintText: "90".tr); }) ]), SizedBox(height: 19.v), @@ -75,10 +76,12 @@ class _BodyCircumferencesScreenState extends State { SizedBox(height: 5.v), BlocSelector( - selector: (state) => state.valueController1, - builder: (context, valueController1) { + selector: (state) => state.waistCircumferenceController, + builder: (context, waistCircumferenceController) { return CustomTextFormField( - controller: valueController1, hintText: "60".tr); + inputFormatters: [digitsOnly], + controller: waistCircumferenceController, + hintText: "60".tr); }), SizedBox(height: 21.v), Text("hip_circumference".tr, @@ -86,20 +89,39 @@ class _BodyCircumferencesScreenState extends State { SizedBox(height: 3.v), BlocSelector( - selector: (state) => state.valueController2, - builder: (context, valueController2) { + selector: (state) => state.hipCircumferenceController, + builder: (context, hipCircumferenceController) { return CustomTextFormField( - controller: valueController2, + inputFormatters: [digitsOnly], + controller: hipCircumferenceController, hintText: "90".tr, textInputAction: TextInputAction.done); }), Spacer(), - NextStepButton( - text: "continue".tr.toUpperCase(), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: () { - navigateToWeight(context); - }), + 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 + .bodyCircumferencesModelObj! + .userRegistrationSheet; + sheet.chestCircumference = int.tryParse( + state.chestCircumferenceController!.text)!; + sheet.waistCircumference = int.tryParse( + state.waistCircumferenceController!.text)!; + sheet.hipCircumference = int.tryParse( + state.hipCircumferenceController!.text)!; + Navigator.pushNamed( + context, + AppRoutes.weightScreen, + arguments: sheet, + ); + }); + }), SizedBox(height: 17.v), ])))); } diff --git a/lib/presentation/body_circumferences_screen/models/body_circumferences_model.dart b/lib/presentation/body_circumferences_screen/models/body_circumferences_model.dart index 3d6dd7c9..880379bd 100644 --- a/lib/presentation/body_circumferences_screen/models/body_circumferences_model.dart +++ b/lib/presentation/body_circumferences_screen/models/body_circumferences_model.dart @@ -1,16 +1,21 @@ // ignore_for_file: must_be_immutable import 'package:equatable/equatable.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; /// This class defines the variables used in the [body_circumferences_screen], /// and is typically used to hold data that is passed between different parts of the application. class BodyCircumferencesModel extends Equatable { - BodyCircumferencesModel() {} + UserRegistrationSheet userRegistrationSheet; + BodyCircumferencesModel({required this.userRegistrationSheet}) {} BodyCircumferencesModel copyWith() { - return BodyCircumferencesModel(); + return BodyCircumferencesModel( + userRegistrationSheet: + userRegistrationSheet ?? this.userRegistrationSheet, + ); } @override - List get props => []; + List get props => [userRegistrationSheet]; } diff --git a/lib/presentation/city_of_living_screen/bloc/city_of_living_bloc.dart b/lib/presentation/city_of_living_screen/bloc/city_of_living_bloc.dart index c7cf389f..c0cad702 100644 --- a/lib/presentation/city_of_living_screen/bloc/city_of_living_bloc.dart +++ b/lib/presentation/city_of_living_screen/bloc/city_of_living_bloc.dart @@ -28,6 +28,8 @@ class CityOfLivingBloc extends Bloc { Emitter emit, ) { emit(state.copyWith(selectedDropDownValue: event.value)); + state.cityOfLivingModelObj?.userRegistrationSheet.country = + event.value.title; } _changeDropDown1( @@ -35,6 +37,7 @@ class CityOfLivingBloc extends Bloc { Emitter emit, ) { emit(state.copyWith(selectedDropDownValue1: event.value)); + state.cityOfLivingModelObj?.userRegistrationSheet.city = event.value.title; } List fillDropdownItemList() { diff --git a/lib/presentation/city_of_living_screen/city_of_living_screen.dart b/lib/presentation/city_of_living_screen/city_of_living_screen.dart index 4fa7da61..2f2e8655 100644 --- a/lib/presentation/city_of_living_screen/city_of_living_screen.dart +++ b/lib/presentation/city_of_living_screen/city_of_living_screen.dart @@ -13,9 +13,12 @@ class CityOfLivingScreen extends StatelessWidget { const CityOfLivingScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { + final sheet = + ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet; return BlocProvider( - create: (context) => CityOfLivingBloc( - CityOfLivingState(cityOfLivingModelObj: CityOfLivingModel())) + create: (context) => CityOfLivingBloc(CityOfLivingState( + cityOfLivingModelObj: + CityOfLivingModel(userRegistrationSheet: sheet))) ..add(CityOfLivingInitialEvent()), child: CityOfLivingScreen()); } @@ -47,7 +50,8 @@ class CityOfLivingScreen extends StatelessWidget { valueColor: AlwaysStoppedAnimation( appTheme.blueA400)))), SizedBox(height: 39.v), - Text("Moscow".tr, style: theme.textTheme.headlineSmall), + Text("place_of_living".tr, + style: theme.textTheme.headlineSmall), Spacer(flex: 34), Text("country".tr, style: theme.textTheme.bodyLarge), SizedBox(height: 2.v), @@ -65,7 +69,7 @@ class CityOfLivingScreen extends StatelessWidget { imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize)), - hintText: "Russia".tr, + hintText: "Не выбрано".tr, items: cityOfLivingModelObj?.dropdownItemList ?? [], onChanged: (value) { context @@ -90,7 +94,7 @@ class CityOfLivingScreen extends StatelessWidget { imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize)), - hintText: "Moscow".tr, + hintText: "Не выбрано".tr, items: cityOfLivingModelObj?.dropdownItemList1 ?? [], onChanged: (value) { @@ -100,12 +104,23 @@ class CityOfLivingScreen extends StatelessWidget { }); }), Spacer(flex: 65), - NextStepButton( - text: "continue".tr.toUpperCase(), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: () { - navigateToCircumferences(context); - }), + 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.cityOfLivingModelObj!.userRegistrationSheet; + Navigator.pushNamed( + context, + AppRoutes.bodyCircumferencesScreen, + arguments: sheet, + ); + }); + }), SizedBox(height: 17.v), ])))); } @@ -128,11 +143,4 @@ class CityOfLivingScreen extends StatelessWidget { onTapArrowLeft(BuildContext context) { NavigatorService.goBack(); } - - /// Navigates to the bodyCircumferencesScreen when the action is triggered. - navigateToCircumferences(BuildContext context) { - NavigatorService.pushNamed( - AppRoutes.bodyCircumferencesScreen, - ); - } } diff --git a/lib/presentation/city_of_living_screen/models/city_of_living_model.dart b/lib/presentation/city_of_living_screen/models/city_of_living_model.dart index a20b013c..25c3dec7 100644 --- a/lib/presentation/city_of_living_screen/models/city_of_living_model.dart +++ b/lib/presentation/city_of_living_screen/models/city_of_living_model.dart @@ -2,11 +2,14 @@ import 'package:equatable/equatable.dart'; import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; /// This class defines the variables used in the [city_of_living_screen], /// and is typically used to hold data that is passed between different parts of the application. class CityOfLivingModel extends Equatable { + UserRegistrationSheet userRegistrationSheet; CityOfLivingModel({ + required this.userRegistrationSheet, this.dropdownItemList = const [], this.dropdownItemList1 = const [], }) {} @@ -20,11 +23,14 @@ class CityOfLivingModel extends Equatable { List? dropdownItemList1, }) { return CityOfLivingModel( + userRegistrationSheet: + userRegistrationSheet ?? this.userRegistrationSheet, dropdownItemList: dropdownItemList ?? this.dropdownItemList, dropdownItemList1: dropdownItemList1 ?? this.dropdownItemList1, ); } @override - List get props => [dropdownItemList, dropdownItemList1]; + List get props => + [dropdownItemList, dropdownItemList1, userRegistrationSheet]; } diff --git a/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart b/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart index d542bebf..5c3dcb6e 100644 --- a/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart +++ b/lib/presentation/date_of_birth_screen/date_of_birth_screen.dart @@ -12,9 +12,12 @@ class DateOfBirthScreen extends StatefulWidget { const DateOfBirthScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { + final sheet = + ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet; return BlocProvider( - create: (context) => DateOfBirthBloc( - DateOfBirthState(dateOfBirthModelObj: DateOfBirthModel())) + create: (context) => DateOfBirthBloc(DateOfBirthState( + dateOfBirthModelObj: + DateOfBirthModel(userRegistrationSheet: sheet))) ..add(DateOfBirthInitialEvent()), child: DateOfBirthScreen()); } @@ -59,12 +62,24 @@ class _DateOfBirthScreenState extends State { Spacer(flex: 39), _buildDateInput(context), Spacer(flex: 60), - NextStepButton( - text: "continue".tr.toUpperCase(), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: () { - navigateToCity(context); - }), + 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 + .dateOfBirthModelObj!.userRegistrationSheet; + sheet.birthdate = selectedDate; + Navigator.pushNamed( + context, + AppRoutes.cityOfLivingScreen, + arguments: sheet, + ); + }); + }), SizedBox(height: 17.v), ])))); }); @@ -124,7 +139,6 @@ class _DateOfBirthScreenState extends State { /// /// This function returns a `Future` that completes with `void`. Future openDatePickerDialog(BuildContext context) async { - var initialState = BlocProvider.of(context).state; DateTime? dateTime = await showDatePicker( context: context, initialDate: DateTime.now(), @@ -137,11 +151,4 @@ class _DateOfBirthScreenState extends State { }); } } - - /// Navigates to the cityOfLivingScreen when the action is triggered. - navigateToCity(BuildContext context) { - NavigatorService.pushNamed( - AppRoutes.cityOfLivingScreen, - ); - } } diff --git a/lib/presentation/date_of_birth_screen/models/date_of_birth_model.dart b/lib/presentation/date_of_birth_screen/models/date_of_birth_model.dart index 3cc83943..17bae696 100644 --- a/lib/presentation/date_of_birth_screen/models/date_of_birth_model.dart +++ b/lib/presentation/date_of_birth_screen/models/date_of_birth_model.dart @@ -1,16 +1,22 @@ // ignore_for_file: must_be_immutable import 'package:equatable/equatable.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; /// This class defines the variables used in the [date_of_birth_screen], /// and is typically used to hold data that is passed between different parts of the application. class DateOfBirthModel extends Equatable { - DateOfBirthModel() {} + UserRegistrationSheet userRegistrationSheet; + + DateOfBirthModel({required this.userRegistrationSheet}) {} DateOfBirthModel copyWith() { - return DateOfBirthModel(); + return DateOfBirthModel( + userRegistrationSheet: + userRegistrationSheet ?? this.userRegistrationSheet, + ); } @override - List get props => []; + List get props => [userRegistrationSheet]; } diff --git a/lib/presentation/gender_screen/bloc/gender_bloc.dart b/lib/presentation/gender_screen/bloc/gender_bloc.dart index b30f421a..112cab6e 100644 --- a/lib/presentation/gender_screen/bloc/gender_bloc.dart +++ b/lib/presentation/gender_screen/bloc/gender_bloc.dart @@ -25,14 +25,5 @@ class GenderBloc extends Bloc { ) { emit(state.copyWith(selectedRadioValue: event.value)); state.genderModelObj?.userRegistrationSheet.gender = event.value; - /* - print(state.genderModelObj?.userRegistrationSheet.lang); - print(state.genderModelObj?.userRegistrationSheet.email); - print(state.genderModelObj?.userRegistrationSheet.password); - print(state.genderModelObj?.userRegistrationSheet.passwordConfirmation); - print(state.genderModelObj?.userRegistrationSheet.firstName); - print(state.genderModelObj?.userRegistrationSheet.lastName); - print(state.genderModelObj?.userRegistrationSheet.gender); - */ } } diff --git a/lib/widgets/custom_text_form_field.dart b/lib/widgets/custom_text_form_field.dart index 95883776..00bfdf3c 100644 --- a/lib/widgets/custom_text_form_field.dart +++ b/lib/widgets/custom_text_form_field.dart @@ -1,5 +1,6 @@ import 'package:eatvio_app/core/app_export.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; class CustomTextFormField extends StatelessWidget { CustomTextFormField({ @@ -21,6 +22,7 @@ class CustomTextFormField extends StatelessWidget { this.suffix, this.suffixConstraints, this.contentPadding, + this.inputFormatters, this.borderDecoration, this.fillColor, this.filled = true, @@ -44,6 +46,8 @@ class CustomTextFormField extends StatelessWidget { final bool? obscureText; + final List? inputFormatters; + final TextInputAction? textInputAction; final TextInputType? textInputType; @@ -98,6 +102,7 @@ class CustomTextFormField extends StatelessWidget { decoration: decoration, validator: validator, onSaved: onSaved, + inputFormatters: inputFormatters, ), ); InputDecoration get decoration => InputDecoration( From 24686c8114ef2ec501112353df27b0b4a360198f Mon Sep 17 00:00:00 2001 From: maxxkim Date: Mon, 25 Dec 2023 17:27:45 +0300 Subject: [PATCH 18/22] Removed unused imports --- lib/core/utils/pref_utils.dart | 2 -- .../models/additional_information_model.dart | 2 +- lib/presentation/allergies_screen/models/allergies_model.dart | 2 +- .../app_navigation_screen/models/app_navigation_model.dart | 2 +- lib/presentation/gender_screen/bloc/gender_bloc.dart | 4 ++-- lib/presentation/height_screen/models/height_model.dart | 2 +- .../language_select_screen/language_select_screen.dart | 1 - .../language_select_screen/models/language_select_model.dart | 2 +- .../medicine_intake_screen/models/medicine_intake_model.dart | 2 +- lib/presentation/splash_screen/models/splash_model.dart | 2 +- lib/presentation/weight_screen/models/weight_model.dart | 2 +- lib/theme/theme_helper.dart | 1 - 12 files changed, 10 insertions(+), 14 deletions(-) diff --git a/lib/core/utils/pref_utils.dart b/lib/core/utils/pref_utils.dart index 5a7f1b98..5238073f 100644 --- a/lib/core/utils/pref_utils.dart +++ b/lib/core/utils/pref_utils.dart @@ -1,7 +1,5 @@ //ignore: unused_import import 'dart:convert'; -import 'dart:ui'; -import 'package:flutter/scheduler.dart'; import 'package:shared_preferences/shared_preferences.dart'; class PrefUtils { diff --git a/lib/presentation/additional_information_screen/models/additional_information_model.dart b/lib/presentation/additional_information_screen/models/additional_information_model.dart index bc31be45..3eccd2a0 100644 --- a/lib/presentation/additional_information_screen/models/additional_information_model.dart +++ b/lib/presentation/additional_information_screen/models/additional_information_model.dart @@ -5,7 +5,7 @@ import 'package:equatable/equatable.dart'; /// This class defines the variables used in the [additional_information_screen], /// and is typically used to hold data that is passed between different parts of the application. class AdditionalInformationModel extends Equatable { - AdditionalInformationModel() {} + AdditionalInformationModel(); AdditionalInformationModel copyWith() { return AdditionalInformationModel(); diff --git a/lib/presentation/allergies_screen/models/allergies_model.dart b/lib/presentation/allergies_screen/models/allergies_model.dart index 64649efe..4ba134a3 100644 --- a/lib/presentation/allergies_screen/models/allergies_model.dart +++ b/lib/presentation/allergies_screen/models/allergies_model.dart @@ -5,7 +5,7 @@ import 'package:equatable/equatable.dart'; /// This class defines the variables used in the [allergies_screen], /// and is typically used to hold data that is passed between different parts of the application. class AllergiesModel extends Equatable { - AllergiesModel() {} + AllergiesModel(); AllergiesModel copyWith() { return AllergiesModel(); diff --git a/lib/presentation/app_navigation_screen/models/app_navigation_model.dart b/lib/presentation/app_navigation_screen/models/app_navigation_model.dart index 405bdc8a..73fd71d7 100644 --- a/lib/presentation/app_navigation_screen/models/app_navigation_model.dart +++ b/lib/presentation/app_navigation_screen/models/app_navigation_model.dart @@ -5,7 +5,7 @@ import 'package:equatable/equatable.dart'; /// This class defines the variables used in the [app_navigation_screen], /// and is typically used to hold data that is passed between different parts of the application. class AppNavigationModel extends Equatable { - AppNavigationModel() {} + AppNavigationModel(); AppNavigationModel copyWith() { return AppNavigationModel(); diff --git a/lib/presentation/gender_screen/bloc/gender_bloc.dart b/lib/presentation/gender_screen/bloc/gender_bloc.dart index 112cab6e..7a2d4092 100644 --- a/lib/presentation/gender_screen/bloc/gender_bloc.dart +++ b/lib/presentation/gender_screen/bloc/gender_bloc.dart @@ -9,7 +9,7 @@ part 'gender_state.dart'; class GenderBloc extends Bloc { GenderBloc(GenderState initialState) : super(initialState) { on(_onInitialize); - on(_GenderSelect); + on(_genderSelect); } _onInitialize( @@ -19,7 +19,7 @@ class GenderBloc extends Bloc { emit(state.copyWith(genderModelObj: state.genderModelObj)); } - _GenderSelect( + _genderSelect( GenderSelectEvent event, Emitter emit, ) { diff --git a/lib/presentation/height_screen/models/height_model.dart b/lib/presentation/height_screen/models/height_model.dart index 0a9a4448..e2f18217 100644 --- a/lib/presentation/height_screen/models/height_model.dart +++ b/lib/presentation/height_screen/models/height_model.dart @@ -6,7 +6,7 @@ import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model /// This class defines the variables used in the [height_screen], /// and is typically used to hold data that is passed between different parts of the application. class HeightModel extends Equatable { - HeightModel({this.dropdownItemList = const []}) {} + HeightModel({this.dropdownItemList = const []}); List dropdownItemList; diff --git a/lib/presentation/language_select_screen/language_select_screen.dart b/lib/presentation/language_select_screen/language_select_screen.dart index 44166da8..9bae529d 100644 --- a/lib/presentation/language_select_screen/language_select_screen.dart +++ b/lib/presentation/language_select_screen/language_select_screen.dart @@ -1,5 +1,4 @@ import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; -import 'package:eatvio_app/presentation/credentials_screen/credentials_screen.dart'; import 'bloc/language_select_bloc.dart'; import 'models/language_select_model.dart'; diff --git a/lib/presentation/language_select_screen/models/language_select_model.dart b/lib/presentation/language_select_screen/models/language_select_model.dart index c19faa3f..1df7f8aa 100644 --- a/lib/presentation/language_select_screen/models/language_select_model.dart +++ b/lib/presentation/language_select_screen/models/language_select_model.dart @@ -7,7 +7,7 @@ import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model /// This class defines the variables used in the [language_select_screen], /// and is typically used to hold data that is passed between different parts of the application. class LanguageSelectModel extends Equatable { - LanguageSelectModel({this.dropdownItemList = const []}) {} + LanguageSelectModel({this.dropdownItemList = const []}); UserRegistrationSheet userRegistrationSheet = UserRegistrationSheet( firstName: '', lastName: '', diff --git a/lib/presentation/medicine_intake_screen/models/medicine_intake_model.dart b/lib/presentation/medicine_intake_screen/models/medicine_intake_model.dart index 29323f2d..5a095de4 100644 --- a/lib/presentation/medicine_intake_screen/models/medicine_intake_model.dart +++ b/lib/presentation/medicine_intake_screen/models/medicine_intake_model.dart @@ -5,7 +5,7 @@ import 'package:equatable/equatable.dart'; /// This class defines the variables used in the [medicine_intake_screen], /// and is typically used to hold data that is passed between different parts of the application. class MedicineIntakeModel extends Equatable { - MedicineIntakeModel() {} + MedicineIntakeModel(); MedicineIntakeModel copyWith() { return MedicineIntakeModel(); diff --git a/lib/presentation/splash_screen/models/splash_model.dart b/lib/presentation/splash_screen/models/splash_model.dart index a2d44d6c..6ad8f8f1 100644 --- a/lib/presentation/splash_screen/models/splash_model.dart +++ b/lib/presentation/splash_screen/models/splash_model.dart @@ -5,7 +5,7 @@ import 'package:equatable/equatable.dart'; /// This class defines the variables used in the [splash_screen], /// and is typically used to hold data that is passed between different parts of the application. class SplashModel extends Equatable { - SplashModel() {} + SplashModel(); SplashModel copyWith() { return SplashModel(); diff --git a/lib/presentation/weight_screen/models/weight_model.dart b/lib/presentation/weight_screen/models/weight_model.dart index 1ebdb828..b4957007 100644 --- a/lib/presentation/weight_screen/models/weight_model.dart +++ b/lib/presentation/weight_screen/models/weight_model.dart @@ -6,7 +6,7 @@ import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model /// This class defines the variables used in the [weight_screen], /// and is typically used to hold data that is passed between different parts of the application. class WeightModel extends Equatable { - WeightModel({this.dropdownItemList = const []}) {} + WeightModel({this.dropdownItemList = const []}); List dropdownItemList; diff --git a/lib/theme/theme_helper.dart b/lib/theme/theme_helper.dart index db1b9984..e7fb2e95 100644 --- a/lib/theme/theme_helper.dart +++ b/lib/theme/theme_helper.dart @@ -1,4 +1,3 @@ -import 'dart:ui'; import 'package:flutter/material.dart'; import '../../core/app_export.dart'; From a67f8bfd08c120db7c0baf27e5049dcd32743def Mon Sep 17 00:00:00 2001 From: maxxkim Date: Mon, 25 Dec 2023 17:30:27 +0300 Subject: [PATCH 19/22] Removed more unused imports --- .../blood_pressure_screen/models/blood_pressure_model.dart | 2 +- .../favorite_foods_screen/models/favorite_foods_model.dart | 2 +- .../favorite_sports_screen/models/favorite_sports_model.dart | 2 +- .../medicine_intake_screen/medicine_intake_screen.dart | 1 - lib/presentation/weight_screen/weight_screen.dart | 1 - lib/theme/custom_button_style.dart | 1 - lib/widgets/base_button.dart | 1 - lib/widgets/next_step_button.dart | 1 - 8 files changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/presentation/blood_pressure_screen/models/blood_pressure_model.dart b/lib/presentation/blood_pressure_screen/models/blood_pressure_model.dart index 1e6c2fa3..b3049c3a 100644 --- a/lib/presentation/blood_pressure_screen/models/blood_pressure_model.dart +++ b/lib/presentation/blood_pressure_screen/models/blood_pressure_model.dart @@ -6,7 +6,7 @@ import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model /// This class defines the variables used in the [blood_pressure_screen], /// and is typically used to hold data that is passed between different parts of the application. class BloodPressureModel extends Equatable { - BloodPressureModel({this.dropdownItemList = const []}) {} + BloodPressureModel({this.dropdownItemList = const []}); List dropdownItemList; diff --git a/lib/presentation/favorite_foods_screen/models/favorite_foods_model.dart b/lib/presentation/favorite_foods_screen/models/favorite_foods_model.dart index 3df7820b..935c6d29 100644 --- a/lib/presentation/favorite_foods_screen/models/favorite_foods_model.dart +++ b/lib/presentation/favorite_foods_screen/models/favorite_foods_model.dart @@ -5,7 +5,7 @@ import 'package:equatable/equatable.dart'; /// This class defines the variables used in the [favorite_foods_screen], /// and is typically used to hold data that is passed between different parts of the application. class FavoriteFoodsModel extends Equatable { - FavoriteFoodsModel() {} + FavoriteFoodsModel(); FavoriteFoodsModel copyWith() { return FavoriteFoodsModel(); diff --git a/lib/presentation/favorite_sports_screen/models/favorite_sports_model.dart b/lib/presentation/favorite_sports_screen/models/favorite_sports_model.dart index aa5c41b0..418fd75d 100644 --- a/lib/presentation/favorite_sports_screen/models/favorite_sports_model.dart +++ b/lib/presentation/favorite_sports_screen/models/favorite_sports_model.dart @@ -5,7 +5,7 @@ import 'package:equatable/equatable.dart'; /// This class defines the variables used in the [favorite_sports_screen], /// and is typically used to hold data that is passed between different parts of the application. class FavoriteSportsModel extends Equatable { - FavoriteSportsModel() {} + FavoriteSportsModel(); FavoriteSportsModel copyWith() { return FavoriteSportsModel(); diff --git a/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart b/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart index b552f694..9382e8d1 100644 --- a/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart +++ b/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart @@ -5,7 +5,6 @@ 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'; diff --git a/lib/presentation/weight_screen/weight_screen.dart b/lib/presentation/weight_screen/weight_screen.dart index f1f14656..aad4c57d 100644 --- a/lib/presentation/weight_screen/weight_screen.dart +++ b/lib/presentation/weight_screen/weight_screen.dart @@ -6,7 +6,6 @@ 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/custom_drop_down.dart'; import 'package:eatvio_app/widgets/next_step_button.dart'; -import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:flutter/material.dart'; class WeightScreen extends StatefulWidget { diff --git a/lib/theme/custom_button_style.dart b/lib/theme/custom_button_style.dart index ed9839fe..95a5581e 100644 --- a/lib/theme/custom_button_style.dart +++ b/lib/theme/custom_button_style.dart @@ -1,4 +1,3 @@ -import 'dart:ui'; import 'package:eatvio_app/core/app_export.dart'; import 'package:flutter/material.dart'; diff --git a/lib/widgets/base_button.dart b/lib/widgets/base_button.dart index 51da7f6c..0a572009 100644 --- a/lib/widgets/base_button.dart +++ b/lib/widgets/base_button.dart @@ -1,4 +1,3 @@ -import 'package:eatvio_app/core/app_export.dart'; import 'package:flutter/material.dart'; class BaseButton extends StatelessWidget { diff --git a/lib/widgets/next_step_button.dart b/lib/widgets/next_step_button.dart index eb3f7e35..ce972835 100644 --- a/lib/widgets/next_step_button.dart +++ b/lib/widgets/next_step_button.dart @@ -1,7 +1,6 @@ import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/base_button.dart'; import 'package:flutter/material.dart'; -import 'package:equatable/equatable.dart'; class NextStepButton extends BaseButton { NextStepButton({ From 6db94dc647344c48c6f79afe9262dee967b425e5 Mon Sep 17 00:00:00 2001 From: maxxkim Date: Mon, 25 Dec 2023 17:33:29 +0300 Subject: [PATCH 20/22] Removed even more unused imports --- .../blood_pressure_screen.dart | 19 ------------------- .../models/body_circumferences_model.dart | 2 +- .../models/city_of_living_model.dart | 2 +- .../models/date_of_birth_model.dart | 2 +- .../favorite_sports_screen.dart | 17 ----------------- .../gender_screen/gender_screen.dart | 1 - 6 files changed, 3 insertions(+), 40 deletions(-) diff --git a/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart b/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart index 365dd4e0..73bdcab7 100644 --- a/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart +++ b/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart @@ -6,7 +6,6 @@ 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/custom_drop_down.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'; @@ -187,24 +186,6 @@ class _BloodPressureScreenState extends State { title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio)); } - /// Section Widget - Widget _buildThirtyThree(BuildContext context) { - return Container( - margin: EdgeInsets.only(right: 1.h), - padding: EdgeInsets.symmetric(horizontal: 3.h), - child: Column(children: [ - Text("average_pressure".tr, style: theme.textTheme.bodyLarge), - SizedBox(height: 2.v), - BlocSelector( - selector: (state) => state.valueController, - builder: (context, valueController) { - return CustomTextFormField( - controller: valueController, hintText: "90".tr); - }) - ])); - } - /// Navigates to the previous screen. onTapArrowLeft(BuildContext context) { NavigatorService.goBack(); diff --git a/lib/presentation/body_circumferences_screen/models/body_circumferences_model.dart b/lib/presentation/body_circumferences_screen/models/body_circumferences_model.dart index 880379bd..bc684a03 100644 --- a/lib/presentation/body_circumferences_screen/models/body_circumferences_model.dart +++ b/lib/presentation/body_circumferences_screen/models/body_circumferences_model.dart @@ -7,7 +7,7 @@ import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_m /// and is typically used to hold data that is passed between different parts of the application. class BodyCircumferencesModel extends Equatable { UserRegistrationSheet userRegistrationSheet; - BodyCircumferencesModel({required this.userRegistrationSheet}) {} + BodyCircumferencesModel({required this.userRegistrationSheet}); BodyCircumferencesModel copyWith() { return BodyCircumferencesModel( diff --git a/lib/presentation/city_of_living_screen/models/city_of_living_model.dart b/lib/presentation/city_of_living_screen/models/city_of_living_model.dart index 25c3dec7..1b32e6e0 100644 --- a/lib/presentation/city_of_living_screen/models/city_of_living_model.dart +++ b/lib/presentation/city_of_living_screen/models/city_of_living_model.dart @@ -12,7 +12,7 @@ class CityOfLivingModel extends Equatable { required this.userRegistrationSheet, this.dropdownItemList = const [], this.dropdownItemList1 = const [], - }) {} + }); List dropdownItemList; diff --git a/lib/presentation/date_of_birth_screen/models/date_of_birth_model.dart b/lib/presentation/date_of_birth_screen/models/date_of_birth_model.dart index 17bae696..98700d4c 100644 --- a/lib/presentation/date_of_birth_screen/models/date_of_birth_model.dart +++ b/lib/presentation/date_of_birth_screen/models/date_of_birth_model.dart @@ -8,7 +8,7 @@ import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_m class DateOfBirthModel extends Equatable { UserRegistrationSheet userRegistrationSheet; - DateOfBirthModel({required this.userRegistrationSheet}) {} + DateOfBirthModel({required this.userRegistrationSheet}); DateOfBirthModel copyWith() { return DateOfBirthModel( diff --git a/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart b/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart index 74398e64..eb047457 100644 --- a/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart +++ b/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart @@ -86,23 +86,6 @@ class _FavoriteSportsScreenState extends State { title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio)); } - /// Section Widget - Widget _buildProgressIndicatorSection(BuildContext context) { - return Container( - width: 343.h, - padding: EdgeInsets.symmetric(horizontal: 4.h, vertical: 3.v), - decoration: AppDecoration.outlinePrimary - .copyWith(borderRadius: BorderRadiusStyle.circleBorder8), - child: Container( - height: 8.v, - width: 259.h, - decoration: BoxDecoration( - color: appTheme.blueA400, - borderRadius: BorderRadius.circular(4.h), - border: - Border.all(color: theme.colorScheme.primary, width: 1.h)))); - } - /// Section Widget Widget _buildTextFormFieldSection(BuildContext context) { return Column(children: [ diff --git a/lib/presentation/gender_screen/gender_screen.dart b/lib/presentation/gender_screen/gender_screen.dart index b3e909e2..be2c3f42 100644 --- a/lib/presentation/gender_screen/gender_screen.dart +++ b/lib/presentation/gender_screen/gender_screen.dart @@ -30,7 +30,6 @@ class GenderScreen extends StatefulWidget { class _GenderScreenState extends State { @override Widget build(BuildContext context) { - String gender = 'female'; mediaQueryData = MediaQuery.of(context); return BlocBuilder(builder: (context, state) { return SafeArea( From 3d3be843731caea0a68460757660e4f287ec5107 Mon Sep 17 00:00:00 2001 From: maxxkim Date: Mon, 25 Dec 2023 18:02:29 +0300 Subject: [PATCH 21/22] Added logic for Height and Weight --- .../height_screen/bloc/height_bloc.dart | 2 + .../height_screen/height_screen.dart | 38 +++++++++++-------- .../height_screen/models/height_model.dart | 9 ++++- .../weight_screen/bloc/weight_bloc.dart | 2 + .../weight_screen/models/weight_model.dart | 9 ++++- .../weight_screen/weight_screen.dart | 34 ++++++++++++----- 6 files changed, 64 insertions(+), 30 deletions(-) diff --git a/lib/presentation/height_screen/bloc/height_bloc.dart b/lib/presentation/height_screen/bloc/height_bloc.dart index 481fd778..629778fe 100644 --- a/lib/presentation/height_screen/bloc/height_bloc.dart +++ b/lib/presentation/height_screen/bloc/height_bloc.dart @@ -26,6 +26,8 @@ class HeightBloc extends Bloc { Emitter emit, ) { emit(state.copyWith(selectedDropDownValue: event.value)); + state.heightModelObj?.userRegistrationSheet.height = + int.tryParse(event.value.title)!; } List fillDropdownItemList() { diff --git a/lib/presentation/height_screen/height_screen.dart b/lib/presentation/height_screen/height_screen.dart index 3acd45a2..e258e465 100644 --- a/lib/presentation/height_screen/height_screen.dart +++ b/lib/presentation/height_screen/height_screen.dart @@ -13,10 +13,12 @@ class HeightScreen extends StatefulWidget { const HeightScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { + final sheet = + ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet; return BlocProvider( - create: (context) => - HeightBloc(HeightState(heightModelObj: HeightModel())) - ..add(HeightInitialEvent()), + create: (context) => HeightBloc(HeightState( + heightModelObj: HeightModel(userRegistrationSheet: sheet))) + ..add(HeightInitialEvent()), child: HeightScreen()); } @@ -84,12 +86,23 @@ class _HeightScreenState extends State { ]) ]), Spacer(), - NextStepButton( - text: "continue".tr.toUpperCase(), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: () { - navigateToAllergies(context); - }), + 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.heightModelObj!.userRegistrationSheet; + Navigator.pushNamed( + context, + AppRoutes.heightScreen, + arguments: sheet, + ); + }); + }), SizedBox(height: 17.v), ])))); } @@ -112,11 +125,4 @@ class _HeightScreenState extends State { onTapArrowLeft(BuildContext context) { NavigatorService.goBack(); } - - /// Navigates to the allergiesScreen when the action is triggered. - navigateToAllergies(BuildContext context) { - NavigatorService.pushNamed( - AppRoutes.allergiesScreen, - ); - } } diff --git a/lib/presentation/height_screen/models/height_model.dart b/lib/presentation/height_screen/models/height_model.dart index e2f18217..b108d7d9 100644 --- a/lib/presentation/height_screen/models/height_model.dart +++ b/lib/presentation/height_screen/models/height_model.dart @@ -2,20 +2,25 @@ import 'package:equatable/equatable.dart'; import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; /// This class defines the variables used in the [height_screen], /// and is typically used to hold data that is passed between different parts of the application. class HeightModel extends Equatable { - HeightModel({this.dropdownItemList = const []}); + UserRegistrationSheet userRegistrationSheet; + HeightModel( + {this.dropdownItemList = const [], required this.userRegistrationSheet}); List dropdownItemList; HeightModel copyWith({List? dropdownItemList}) { return HeightModel( + userRegistrationSheet: + userRegistrationSheet ?? this.userRegistrationSheet, dropdownItemList: dropdownItemList ?? this.dropdownItemList, ); } @override - List get props => [dropdownItemList]; + List get props => [dropdownItemList, userRegistrationSheet]; } diff --git a/lib/presentation/weight_screen/bloc/weight_bloc.dart b/lib/presentation/weight_screen/bloc/weight_bloc.dart index 37ce0901..94091376 100644 --- a/lib/presentation/weight_screen/bloc/weight_bloc.dart +++ b/lib/presentation/weight_screen/bloc/weight_bloc.dart @@ -26,6 +26,8 @@ class WeightBloc extends Bloc { Emitter emit, ) { emit(state.copyWith(selectedDropDownValue: event.value)); + state.weightModelObj?.userRegistrationSheet.weight = + int.tryParse(event.value.title)!; } List fillDropdownItemList() { diff --git a/lib/presentation/weight_screen/models/weight_model.dart b/lib/presentation/weight_screen/models/weight_model.dart index b4957007..e91ceb10 100644 --- a/lib/presentation/weight_screen/models/weight_model.dart +++ b/lib/presentation/weight_screen/models/weight_model.dart @@ -2,20 +2,25 @@ import 'package:equatable/equatable.dart'; import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; /// This class defines the variables used in the [weight_screen], /// and is typically used to hold data that is passed between different parts of the application. class WeightModel extends Equatable { - WeightModel({this.dropdownItemList = const []}); + UserRegistrationSheet userRegistrationSheet; + WeightModel( + {this.dropdownItemList = const [], required this.userRegistrationSheet}); List dropdownItemList; WeightModel copyWith({List? dropdownItemList}) { return WeightModel( + userRegistrationSheet: + userRegistrationSheet ?? this.userRegistrationSheet, dropdownItemList: dropdownItemList ?? this.dropdownItemList, ); } @override - List get props => [dropdownItemList]; + List get props => [dropdownItemList, userRegistrationSheet]; } diff --git a/lib/presentation/weight_screen/weight_screen.dart b/lib/presentation/weight_screen/weight_screen.dart index aad4c57d..8e606e1c 100644 --- a/lib/presentation/weight_screen/weight_screen.dart +++ b/lib/presentation/weight_screen/weight_screen.dart @@ -6,16 +6,19 @@ 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/custom_drop_down.dart'; import 'package:eatvio_app/widgets/next_step_button.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:flutter/material.dart'; class WeightScreen extends StatefulWidget { const WeightScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { + final sheet = + ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet; return BlocProvider( - create: (context) => - WeightBloc(WeightState(weightModelObj: WeightModel())) - ..add(WeightInitialEvent()), + create: (context) => WeightBloc(WeightState( + weightModelObj: WeightModel(userRegistrationSheet: sheet))) + ..add(WeightInitialEvent()), child: WeightScreen()); } @@ -72,7 +75,7 @@ class _WeightScreenState extends State { imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize)), - hintText: "70", + hintText: "Не выбрано", items: weightModelObj?.dropdownItemList ?? [], onChanged: (value) { context @@ -83,12 +86,23 @@ class _WeightScreenState extends State { ]) ]), Spacer(), - NextStepButton( - text: "continue".tr.toUpperCase(), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: () { - navigateToHeight(context); - }), + 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.weightModelObj!.userRegistrationSheet; + Navigator.pushNamed( + context, + AppRoutes.heightScreen, + arguments: sheet, + ); + }); + }), SizedBox(height: 17.v), ])))); } From 503a82f79e4423ad2cb1055f98ce9e25cc5666d2 Mon Sep 17 00:00:00 2001 From: maxxkim Date: Tue, 26 Dec 2023 11:31:20 +0300 Subject: [PATCH 22/22] Finish comlipling JSON file from screens --- .../additional_information_screen.dart | 34 +++++++--- .../models/additional_information_model.dart | 11 +++- .../allergies_screen/allergies_screen.dart | 33 +++++++--- .../models/allergies_model.dart | 11 +++- .../bloc/blood_pressure_bloc.dart | 38 ++++++++--- .../bloc/blood_pressure_event.dart | 15 ++++- .../bloc/blood_pressure_state.dart | 40 ++++++------ .../blood_pressure_screen.dart | 63 ++++++++++++------- .../models/blood_pressure_model.dart | 9 ++- .../bloc/favorite_foods_bloc.dart | 4 +- .../bloc/favorite_foods_state.dart | 24 +++---- .../favorite_foods_screen.dart | 54 ++++++++++------ .../models/favorite_foods_model.dart | 11 +++- .../favorite_sports_screen.dart | 40 +++++++----- .../models/favorite_sports_model.dart | 11 +++- .../height_screen/height_screen.dart | 2 +- .../medicine_intake_screen.dart | 40 +++++++----- .../models/medicine_intake_model.dart | 11 +++- 18 files changed, 301 insertions(+), 150 deletions(-) diff --git a/lib/presentation/additional_information_screen/additional_information_screen.dart b/lib/presentation/additional_information_screen/additional_information_screen.dart index 05274de2..4ee525de 100644 --- a/lib/presentation/additional_information_screen/additional_information_screen.dart +++ b/lib/presentation/additional_information_screen/additional_information_screen.dart @@ -8,15 +8,19 @@ 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'; +import 'dart:convert'; class AdditionalInformationScreen extends StatefulWidget { const AdditionalInformationScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { + final sheet = + ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet; return BlocProvider( create: (context) => AdditionalInformationBloc( AdditionalInformationState( - additionalInformationModelObj: AdditionalInformationModel())) + additionalInformationModelObj: + AdditionalInformationModel(userRegistrationSheet: sheet))) ..add(AdditionalInformationInitialEvent()), child: AdditionalInformationScreen()); } @@ -59,12 +63,23 @@ class _AdditionalInformationScreenState SizedBox(height: 73.v), _buildTextFormField(context), Spacer(), - NextStepButton( - text: "finish".tr.toUpperCase(), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: () { - showSuccessMessage(context); - }), + BlocBuilder(builder: (context, state) { + return NextStepButton( + text: "finish".tr.toUpperCase(), + margin: EdgeInsets.only( + left: 16.h, right: 16.h, bottom: 50.v), + buttonStyle: CustomButtonStyles.outlinePrimaryTL15, + onPressed: () { + var message; + UserRegistrationSheet sheet = state + .additionalInformationModelObj! + .userRegistrationSheet; + sheet.additionalInfo = state.editTextController!.text; + message = sheet.toJson(); + print(message); + }); + }), SizedBox(height: 17.v), ])))); } @@ -120,13 +135,12 @@ class _AdditionalInformationScreenState /// Displays an alert dialog when the action is triggered. /// The dialog box contains a title and a message with the `Теперь вы можете пользоваться полным функционалом приложения` - showSuccessMessage(BuildContext context) { + showSuccessMessage(BuildContext context, String text) { showDialog( context: context, builder: (_) => AlertDialog( title: const Text('Регистрация завершена!'), - content: const Text( - 'Теперь вы можете пользоваться полным функционалом приложения'), + content: const Text(text), actions: [ TextButton( onPressed: () { diff --git a/lib/presentation/additional_information_screen/models/additional_information_model.dart b/lib/presentation/additional_information_screen/models/additional_information_model.dart index 3eccd2a0..3e5243d2 100644 --- a/lib/presentation/additional_information_screen/models/additional_information_model.dart +++ b/lib/presentation/additional_information_screen/models/additional_information_model.dart @@ -1,16 +1,21 @@ // ignore_for_file: must_be_immutable import 'package:equatable/equatable.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; /// This class defines the variables used in the [additional_information_screen], /// and is typically used to hold data that is passed between different parts of the application. class AdditionalInformationModel extends Equatable { - AdditionalInformationModel(); + UserRegistrationSheet userRegistrationSheet; + AdditionalInformationModel({required this.userRegistrationSheet}); AdditionalInformationModel copyWith() { - return AdditionalInformationModel(); + return AdditionalInformationModel( + userRegistrationSheet: + userRegistrationSheet ?? this.userRegistrationSheet, + ); } @override - List get props => []; + List get props => [userRegistrationSheet]; } diff --git a/lib/presentation/allergies_screen/allergies_screen.dart b/lib/presentation/allergies_screen/allergies_screen.dart index ac2e3aca..0e4de30d 100644 --- a/lib/presentation/allergies_screen/allergies_screen.dart +++ b/lib/presentation/allergies_screen/allergies_screen.dart @@ -13,10 +13,12 @@ class AllergiesScreen extends StatefulWidget { const AllergiesScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { + final sheet = + ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet; return BlocProvider( - create: (context) => - AllergiesBloc(AllergiesState(allergiesModelObj: AllergiesModel())) - ..add(AllergiesInitialEvent()), + create: (context) => AllergiesBloc(AllergiesState( + allergiesModelObj: AllergiesModel(userRegistrationSheet: sheet))) + ..add(AllergiesInitialEvent()), child: AllergiesScreen()); } @@ -58,12 +60,25 @@ class _AllergiesScreenState extends State { Spacer(flex: 36), _buildTextFormField(context), Spacer(flex: 63), - NextStepButton( - text: "continue".tr.toUpperCase(), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: () { - navigateToMedicine(context); - }), + 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.allergiesModelObj!.userRegistrationSheet; + sheet.aboutAllergy = + state.enterInformationController!.text; + Navigator.pushNamed( + context, + AppRoutes.medicineIntakeScreen, + arguments: sheet, + ); + }); + }), SizedBox(height: 17.v), Text("skip".tr, style: theme.textTheme.bodyLarge) ])))); diff --git a/lib/presentation/allergies_screen/models/allergies_model.dart b/lib/presentation/allergies_screen/models/allergies_model.dart index 4ba134a3..5553fa4e 100644 --- a/lib/presentation/allergies_screen/models/allergies_model.dart +++ b/lib/presentation/allergies_screen/models/allergies_model.dart @@ -1,16 +1,21 @@ // ignore_for_file: must_be_immutable import 'package:equatable/equatable.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; /// This class defines the variables used in the [allergies_screen], /// and is typically used to hold data that is passed between different parts of the application. class AllergiesModel extends Equatable { - AllergiesModel(); + UserRegistrationSheet userRegistrationSheet; + AllergiesModel({required this.userRegistrationSheet}); AllergiesModel copyWith() { - return AllergiesModel(); + return AllergiesModel( + userRegistrationSheet: + userRegistrationSheet ?? this.userRegistrationSheet, + ); } @override - List get props => []; + List get props => [userRegistrationSheet]; } diff --git a/lib/presentation/blood_pressure_screen/bloc/blood_pressure_bloc.dart b/lib/presentation/blood_pressure_screen/bloc/blood_pressure_bloc.dart index 8eefb84b..c2c3632c 100644 --- a/lib/presentation/blood_pressure_screen/bloc/blood_pressure_bloc.dart +++ b/lib/presentation/blood_pressure_screen/bloc/blood_pressure_bloc.dart @@ -9,20 +9,41 @@ part 'blood_pressure_state.dart'; class BloodPressureBloc extends Bloc { BloodPressureBloc(BloodPressureState initialState) : super(initialState) { on(_onInitialize); - on(_changeDropDown); + on(_changeHypoDropDown); + on(_changeHyperDropDown); } - _changeDropDown( - ChangeDropDownEvent event, + _changeHyperDropDown( + ChangeHyperDropDownEvent event, Emitter emit, ) { - emit(state.copyWith(selectedDropDownValue: event.value)); + if (event.value.id == 1) { + state.bloodPressureModelObj!.userRegistrationSheet.hasHyper = true; + } else { + state.bloodPressureModelObj!.userRegistrationSheet.hasHyper = false; + } + emit(state.copyWith(selectedHyperValue: event.value)); + } + + _changeHypoDropDown( + ChangeHypoDownEvent event, + Emitter emit, + ) { + if (event.value.id == 1) { + state.bloodPressureModelObj!.userRegistrationSheet.hasHypo = true; + } else { + state.bloodPressureModelObj!.userRegistrationSheet.hasHypo = false; + } + emit(state.copyWith(selectedHypoValue: event.value)); } List fillDropdownItemList() { return [ - SelectionPopupModel(id: 1, title: "Да", isSelected: true), - SelectionPopupModel(id: 2, title: "Нет"), + SelectionPopupModel( + id: 1, + title: "Да", + ), + SelectionPopupModel(id: 2, title: "Нет", isSelected: true), ]; } @@ -31,9 +52,8 @@ class BloodPressureBloc extends Bloc { Emitter emit, ) async { emit(state.copyWith( - valueController: TextEditingController(), - valueController1: TextEditingController(), - valueController2: TextEditingController())); + upPressureController: TextEditingController(), + downPressureController: TextEditingController())); emit(state.copyWith( bloodPressureModelObj: state.bloodPressureModelObj ?.copyWith(dropdownItemList: fillDropdownItemList()))); diff --git a/lib/presentation/blood_pressure_screen/bloc/blood_pressure_event.dart b/lib/presentation/blood_pressure_screen/bloc/blood_pressure_event.dart index 98e86810..677d2436 100644 --- a/lib/presentation/blood_pressure_screen/bloc/blood_pressure_event.dart +++ b/lib/presentation/blood_pressure_screen/bloc/blood_pressure_event.dart @@ -16,8 +16,19 @@ class BloodPressureInitialEvent extends BloodPressureEvent { } ///event for dropdown selection -class ChangeDropDownEvent extends BloodPressureEvent { - ChangeDropDownEvent({required this.value}); +class ChangeHyperDropDownEvent extends BloodPressureEvent { + ChangeHyperDropDownEvent({required this.value}); + + SelectionPopupModel value; + + @override + List get props => [ + value, + ]; +} + +class ChangeHypoDownEvent extends BloodPressureEvent { + ChangeHypoDownEvent({required this.value}); SelectionPopupModel value; diff --git a/lib/presentation/blood_pressure_screen/bloc/blood_pressure_state.dart b/lib/presentation/blood_pressure_screen/bloc/blood_pressure_state.dart index 08bdff74..d1db1c49 100644 --- a/lib/presentation/blood_pressure_screen/bloc/blood_pressure_state.dart +++ b/lib/presentation/blood_pressure_screen/bloc/blood_pressure_state.dart @@ -5,42 +5,44 @@ part of 'blood_pressure_bloc.dart'; /// Represents the state of BloodPressure in the application. class BloodPressureState extends Equatable { BloodPressureState({ - this.valueController, - this.valueController1, - this.valueController2, - this.selectedDropDownValue, + this.upPressureController, + this.downPressureController, + this.selectedHyperValue, + this.selectedHypoValue, this.bloodPressureModelObj, }); - TextEditingController? valueController; + TextEditingController? upPressureController; - TextEditingController? valueController1; + TextEditingController? downPressureController; - TextEditingController? valueController2; + SelectionPopupModel? selectedHypoValue; - SelectionPopupModel? selectedDropDownValue; + SelectionPopupModel? selectedHyperValue; BloodPressureModel? bloodPressureModelObj; @override List get props => [ - valueController, - valueController1, - selectedDropDownValue, + upPressureController, + downPressureController, + selectedHyperValue, + selectedHypoValue, bloodPressureModelObj, ]; BloodPressureState copyWith({ - TextEditingController? valueController, - TextEditingController? valueController1, - TextEditingController? valueController2, - SelectionPopupModel? selectedDropDownValue, + TextEditingController? upPressureController, + TextEditingController? downPressureController, + SelectionPopupModel? selectedHyperValue, + SelectionPopupModel? selectedHypoValue, BloodPressureModel? bloodPressureModelObj, }) { return BloodPressureState( - valueController: valueController ?? this.valueController, - valueController1: valueController1 ?? this.valueController1, - selectedDropDownValue: - selectedDropDownValue ?? this.selectedDropDownValue, + upPressureController: upPressureController ?? this.upPressureController, + downPressureController: + downPressureController ?? this.downPressureController, + selectedHyperValue: selectedHyperValue ?? this.selectedHyperValue, + selectedHypoValue: selectedHypoValue ?? this.selectedHypoValue, bloodPressureModelObj: bloodPressureModelObj ?? this.bloodPressureModelObj, ); diff --git a/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart b/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart index 73bdcab7..f5c10e1d 100644 --- a/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart +++ b/lib/presentation/blood_pressure_screen/blood_pressure_screen.dart @@ -1,4 +1,5 @@ import 'bloc/blood_pressure_bloc.dart'; +import 'package:flutter/services.dart'; import 'models/blood_pressure_model.dart'; import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart'; @@ -7,15 +8,19 @@ import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart'; import 'package:eatvio_app/widgets/custom_drop_down.dart'; import 'package:eatvio_app/widgets/next_step_button.dart'; import 'package:eatvio_app/widgets/custom_text_form_field.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:flutter/material.dart'; class BloodPressureScreen extends StatefulWidget { const BloodPressureScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { + final sheet = + ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet; return BlocProvider( - create: (context) => BloodPressureBloc( - BloodPressureState(bloodPressureModelObj: BloodPressureModel())) + create: (context) => BloodPressureBloc(BloodPressureState( + bloodPressureModelObj: + BloodPressureModel(userRegistrationSheet: sheet))) ..add(BloodPressureInitialEvent()), child: BloodPressureScreen()); } @@ -27,6 +32,7 @@ class BloodPressureScreen extends StatefulWidget { class _BloodPressureScreenState extends State { @override Widget build(BuildContext context) { + final digitsOnly = FilteringTextInputFormatter.digitsOnly; mediaQueryData = MediaQuery.of(context); return SafeArea( child: Scaffold( @@ -73,10 +79,11 @@ class _BloodPressureScreenState extends State { SizedBox(height: 2.v), BlocSelector( - selector: (state) => state.valueController1, - builder: (context, valueController1) { + selector: (state) => state.upPressureController, + builder: (context, upPressureController) { return CustomTextFormField( - controller: valueController1, + inputFormatters: [digitsOnly], + controller: upPressureController, hintText: "90".tr); }) ])), @@ -90,10 +97,11 @@ class _BloodPressureScreenState extends State { SizedBox(height: 2.v), BlocSelector( - selector: (state) => state.valueController2, - builder: (context, valueController2) { + selector: (state) => state.downPressureController, + builder: (context, downPressureController) { return CustomTextFormField( - controller: valueController2, + inputFormatters: [digitsOnly], + controller: downPressureController, hintText: "90".tr); }) ])), @@ -118,14 +126,14 @@ class _BloodPressureScreenState extends State { imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize)), - hintText: "no".tr, + hintText: "Не выбрано".tr, items: bloodPressureModelObj?.dropdownItemList ?? [], onChanged: (value) { context .read() - .add(ChangeDropDownEvent(value: value)); + .add(ChangeHypoDownEvent(value: value)); }); })), SizedBox(height: 22.v), @@ -149,24 +157,37 @@ class _BloodPressureScreenState extends State { imagePath: ImageConstant.imgFavorite, height: 12.adaptSize, width: 12.adaptSize)), - hintText: "no".tr, + hintText: "Не выбрано".tr, items: bloodPressureModelObj?.dropdownItemList ?? [], onChanged: (value) { - context - .read() - .add(ChangeDropDownEvent(value: value)); + context.read().add( + ChangeHyperDropDownEvent(value: value)); }); })), Spacer(), - NextStepButton( - text: "continue".tr.toUpperCase(), - margin: EdgeInsets.symmetric(horizontal: 4.h), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: () { - navigateToSports(context); - }), + 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 + .bloodPressureModelObj!.userRegistrationSheet; + sheet.bloodPressureUp = + int.tryParse(state.upPressureController!.text)!; + sheet.bloodPressureDown = + int.tryParse(state.downPressureController!.text)!; + Navigator.pushNamed( + context, + AppRoutes.favoriteSportsScreen, + arguments: sheet, + ); + }); + }), SizedBox(height: 17.v), Text("skip".tr, style: theme.textTheme.bodyLarge) ])))); diff --git a/lib/presentation/blood_pressure_screen/models/blood_pressure_model.dart b/lib/presentation/blood_pressure_screen/models/blood_pressure_model.dart index b3049c3a..c002b0a9 100644 --- a/lib/presentation/blood_pressure_screen/models/blood_pressure_model.dart +++ b/lib/presentation/blood_pressure_screen/models/blood_pressure_model.dart @@ -2,20 +2,25 @@ import 'package:equatable/equatable.dart'; import 'package:eatvio_app/data/models/selectionPopupModel/selection_popup_model.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; /// This class defines the variables used in the [blood_pressure_screen], /// and is typically used to hold data that is passed between different parts of the application. class BloodPressureModel extends Equatable { - BloodPressureModel({this.dropdownItemList = const []}); + UserRegistrationSheet userRegistrationSheet; + BloodPressureModel( + {required this.userRegistrationSheet, this.dropdownItemList = const []}); List dropdownItemList; BloodPressureModel copyWith({List? dropdownItemList}) { return BloodPressureModel( + userRegistrationSheet: + userRegistrationSheet ?? this.userRegistrationSheet, dropdownItemList: dropdownItemList ?? this.dropdownItemList, ); } @override - List get props => [dropdownItemList]; + List get props => [dropdownItemList, userRegistrationSheet]; } diff --git a/lib/presentation/favorite_foods_screen/bloc/favorite_foods_bloc.dart b/lib/presentation/favorite_foods_screen/bloc/favorite_foods_bloc.dart index 95c740fe..3fcb2c5b 100644 --- a/lib/presentation/favorite_foods_screen/bloc/favorite_foods_bloc.dart +++ b/lib/presentation/favorite_foods_screen/bloc/favorite_foods_bloc.dart @@ -16,7 +16,7 @@ class FavoriteFoodsBloc extends Bloc { Emitter emit, ) async { emit(state.copyWith( - enterinformationController: TextEditingController(), - enterinformationController1: TextEditingController())); + favoriteFoodsController: TextEditingController(), + unfavoriteFoodsController: TextEditingController())); } } diff --git a/lib/presentation/favorite_foods_screen/bloc/favorite_foods_state.dart b/lib/presentation/favorite_foods_screen/bloc/favorite_foods_state.dart index fd14b209..aa4fc3b8 100644 --- a/lib/presentation/favorite_foods_screen/bloc/favorite_foods_state.dart +++ b/lib/presentation/favorite_foods_screen/bloc/favorite_foods_state.dart @@ -5,33 +5,33 @@ part of 'favorite_foods_bloc.dart'; /// Represents the state of FavoriteFoods in the application. class FavoriteFoodsState extends Equatable { FavoriteFoodsState({ - this.enterinformationController, - this.enterinformationController1, + this.favoriteFoodsController, + this.unfavoriteFoodsController, this.favoriteFoodsModelObj, }); - TextEditingController? enterinformationController; + TextEditingController? favoriteFoodsController; - TextEditingController? enterinformationController1; + TextEditingController? unfavoriteFoodsController; FavoriteFoodsModel? favoriteFoodsModelObj; @override List get props => [ - enterinformationController, - enterinformationController1, + favoriteFoodsController, + unfavoriteFoodsController, favoriteFoodsModelObj, ]; FavoriteFoodsState copyWith({ - TextEditingController? enterinformationController, - TextEditingController? enterinformationController1, + TextEditingController? favoriteFoodsController, + TextEditingController? unfavoriteFoodsController, FavoriteFoodsModel? favoriteFoodsModelObj, }) { return FavoriteFoodsState( - enterinformationController: - enterinformationController ?? this.enterinformationController, - enterinformationController1: - enterinformationController1 ?? this.enterinformationController1, + favoriteFoodsController: + favoriteFoodsController ?? this.favoriteFoodsController, + unfavoriteFoodsController: + unfavoriteFoodsController ?? this.unfavoriteFoodsController, favoriteFoodsModelObj: favoriteFoodsModelObj ?? this.favoriteFoodsModelObj, ); diff --git a/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart b/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart index 034b5763..625d221d 100644 --- a/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart +++ b/lib/presentation/favorite_foods_screen/favorite_foods_screen.dart @@ -13,9 +13,12 @@ class FavoriteFoodsScreen extends StatefulWidget { const FavoriteFoodsScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { + final sheet = + ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet; return BlocProvider( - create: (context) => FavoriteFoodsBloc( - FavoriteFoodsState(favoriteFoodsModelObj: FavoriteFoodsModel())) + create: (context) => FavoriteFoodsBloc(FavoriteFoodsState( + favoriteFoodsModelObj: + FavoriteFoodsModel(userRegistrationSheet: sheet))) ..add(FavoriteFoodsInitialEvent()), child: FavoriteFoodsScreen()); } @@ -62,16 +65,31 @@ class _FavoriteFoodsScreenState extends State { textAlign: TextAlign.center, style: theme.textTheme.headlineSmall)), SizedBox(height: 23.v), - _buildTextFormField(context), + _buildTextFormFieldFav(context), SizedBox(height: 22.v), - _buildTextFormField1(context), + _buildTextFormFieldUnfav(context), SizedBox(height: 27.v), - NextStepButton( - text: "continue".tr.toUpperCase(), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: () { - navigateToAdditionalInformationScreen(context); - }), + 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 + .favoriteFoodsModelObj!.userRegistrationSheet; + sheet.favoriteFoods = + state.favoriteFoodsController!.text; + sheet.unfavoriteFoods = + state.unfavoriteFoodsController!.text; + Navigator.pushNamed( + context, + AppRoutes.additionalInformationScreen, + arguments: sheet, + ); + }); + }), SizedBox(height: 17.v), Text("skip".tr, style: theme.textTheme.bodyLarge) ])))); @@ -92,16 +110,16 @@ class _FavoriteFoodsScreenState extends State { } /// Section Widget - Widget _buildTextFormField(BuildContext context) { + Widget _buildTextFormFieldFav(BuildContext context) { return Column(children: [ Text("favorite_foods".tr, style: CustomTextStyles.titleMediumSegoeUI), SizedBox(height: 2.v), BlocSelector( - selector: (state) => state.enterinformationController, - builder: (context, enterinformationController) { + selector: (state) => state.favoriteFoodsController, + builder: (context, favoriteFoodsController) { return CustomTextFormField( - controller: enterinformationController, + controller: favoriteFoodsController, hintText: "enter_information".tr, maxLines: 7); }) @@ -109,16 +127,16 @@ class _FavoriteFoodsScreenState extends State { } /// Section Widget - Widget _buildTextFormField1(BuildContext context) { + Widget _buildTextFormFieldUnfav(BuildContext context) { return Column(children: [ Text("unfavorite_foods".tr, style: CustomTextStyles.titleMediumSegoeUI), SizedBox(height: 2.v), BlocSelector( - selector: (state) => state.enterinformationController1, - builder: (context, enterinformationController1) { + selector: (state) => state.unfavoriteFoodsController, + builder: (context, unfavoriteFoodsController) { return CustomTextFormField( - controller: enterinformationController1, + controller: unfavoriteFoodsController, hintText: "enter_information".tr, textInputAction: TextInputAction.done, maxLines: 7); diff --git a/lib/presentation/favorite_foods_screen/models/favorite_foods_model.dart b/lib/presentation/favorite_foods_screen/models/favorite_foods_model.dart index 935c6d29..2084cade 100644 --- a/lib/presentation/favorite_foods_screen/models/favorite_foods_model.dart +++ b/lib/presentation/favorite_foods_screen/models/favorite_foods_model.dart @@ -1,16 +1,21 @@ // ignore_for_file: must_be_immutable import 'package:equatable/equatable.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; /// This class defines the variables used in the [favorite_foods_screen], /// and is typically used to hold data that is passed between different parts of the application. class FavoriteFoodsModel extends Equatable { - FavoriteFoodsModel(); + UserRegistrationSheet userRegistrationSheet; + FavoriteFoodsModel({required this.userRegistrationSheet}); FavoriteFoodsModel copyWith() { - return FavoriteFoodsModel(); + return FavoriteFoodsModel( + userRegistrationSheet: + userRegistrationSheet ?? this.userRegistrationSheet, + ); } @override - List get props => []; + List get props => [userRegistrationSheet]; } diff --git a/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart b/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart index eb047457..2d531bea 100644 --- a/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart +++ b/lib/presentation/favorite_sports_screen/favorite_sports_screen.dart @@ -13,9 +13,12 @@ class FavoriteSportsScreen extends StatefulWidget { const FavoriteSportsScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { + final sheet = + ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet; return BlocProvider( - create: (context) => FavoriteSportsBloc( - FavoriteSportsState(favoriteSportsModelObj: FavoriteSportsModel())) + create: (context) => FavoriteSportsBloc(FavoriteSportsState( + favoriteSportsModelObj: + FavoriteSportsModel(userRegistrationSheet: sheet))) ..add(FavoriteSportsInitialEvent()), child: FavoriteSportsScreen()); } @@ -61,12 +64,26 @@ class _FavoriteSportsScreenState extends State { Spacer(flex: 32), _buildTextFormFieldSection(context), Spacer(flex: 67), - NextStepButton( - text: "continue".tr.toUpperCase(), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: () { - navigateToFoods(context); - }), + 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 + .favoriteSportsModelObj! + .userRegistrationSheet; + sheet.aboutSportHobbies = + state.enterinformationController!.text; + Navigator.pushNamed( + context, + AppRoutes.favoriteFoodsScreen, + arguments: sheet, + ); + }); + }), SizedBox(height: 17.v), Text("skip".tr, style: theme.textTheme.bodyLarge), SizedBox(height: 4.v) @@ -108,11 +125,4 @@ class _FavoriteSportsScreenState extends State { onTapArrowLeft(BuildContext context) { NavigatorService.goBack(); } - - /// Navigates to the favoriteFoodsScreen when the action is triggered. - navigateToFoods(BuildContext context) { - NavigatorService.pushNamed( - AppRoutes.favoriteFoodsScreen, - ); - } } diff --git a/lib/presentation/favorite_sports_screen/models/favorite_sports_model.dart b/lib/presentation/favorite_sports_screen/models/favorite_sports_model.dart index 418fd75d..11a1e288 100644 --- a/lib/presentation/favorite_sports_screen/models/favorite_sports_model.dart +++ b/lib/presentation/favorite_sports_screen/models/favorite_sports_model.dart @@ -1,16 +1,21 @@ // ignore_for_file: must_be_immutable import 'package:equatable/equatable.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; /// This class defines the variables used in the [favorite_sports_screen], /// and is typically used to hold data that is passed between different parts of the application. class FavoriteSportsModel extends Equatable { - FavoriteSportsModel(); + UserRegistrationSheet userRegistrationSheet; + FavoriteSportsModel({required this.userRegistrationSheet}); FavoriteSportsModel copyWith() { - return FavoriteSportsModel(); + return FavoriteSportsModel( + userRegistrationSheet: + userRegistrationSheet ?? this.userRegistrationSheet, + ); } @override - List get props => []; + List get props => [userRegistrationSheet]; } diff --git a/lib/presentation/height_screen/height_screen.dart b/lib/presentation/height_screen/height_screen.dart index e258e465..17a5a9ab 100644 --- a/lib/presentation/height_screen/height_screen.dart +++ b/lib/presentation/height_screen/height_screen.dart @@ -98,7 +98,7 @@ class _HeightScreenState extends State { state.heightModelObj!.userRegistrationSheet; Navigator.pushNamed( context, - AppRoutes.heightScreen, + AppRoutes.allergiesScreen, arguments: sheet, ); }); diff --git a/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart b/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart index 9382e8d1..5b8fdb95 100644 --- a/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart +++ b/lib/presentation/medicine_intake_screen/medicine_intake_screen.dart @@ -6,15 +6,19 @@ 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/widgets/custom_text_form_field.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:flutter/material.dart'; class MedicineIntakeScreen extends StatefulWidget { const MedicineIntakeScreen({Key? key}) : super(key: key); static Widget builder(BuildContext context) { + final sheet = + ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet; return BlocProvider( - create: (context) => MedicineIntakeBloc( - MedicineIntakeState(medicineIntakeModelObj: MedicineIntakeModel())) + create: (context) => MedicineIntakeBloc(MedicineIntakeState( + medicineIntakeModelObj: + MedicineIntakeModel(userRegistrationSheet: sheet))) ..add(MedicineIntakeInitialEvent()), child: MedicineIntakeScreen()); } @@ -63,12 +67,25 @@ class _MedicineIntakeScreenState extends State { SizedBox(height: 86.v), _buildTextFormField(context), Spacer(), - NextStepButton( - text: "continue".tr.toUpperCase(), - buttonStyle: CustomButtonStyles.outlinePrimaryTL15, - onPressed: () { - navigateToPressure(context); - }), + 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 + .medicineIntakeModelObj!.userRegistrationSheet; + sheet.aboutTakingPils = + state.enterInformationController!.text; + Navigator.pushNamed( + context, + AppRoutes.bloodPressureScreen, + arguments: sheet, + ); + }); + }), SizedBox(height: 17.v), Text("skip".tr, style: theme.textTheme.bodyLarge) ])))); @@ -111,11 +128,4 @@ class _MedicineIntakeScreenState extends State { onTapArrowLeft(BuildContext context) { NavigatorService.goBack(); } - - /// Navigates to the bloodPressureScreen when the action is triggered. - navigateToPressure(BuildContext context) { - NavigatorService.pushNamed( - AppRoutes.bloodPressureScreen, - ); - } } diff --git a/lib/presentation/medicine_intake_screen/models/medicine_intake_model.dart b/lib/presentation/medicine_intake_screen/models/medicine_intake_model.dart index 5a095de4..9828f2d8 100644 --- a/lib/presentation/medicine_intake_screen/models/medicine_intake_model.dart +++ b/lib/presentation/medicine_intake_screen/models/medicine_intake_model.dart @@ -1,16 +1,21 @@ // ignore_for_file: must_be_immutable import 'package:equatable/equatable.dart'; +import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; /// This class defines the variables used in the [medicine_intake_screen], /// and is typically used to hold data that is passed between different parts of the application. class MedicineIntakeModel extends Equatable { - MedicineIntakeModel(); + UserRegistrationSheet userRegistrationSheet; + MedicineIntakeModel({required this.userRegistrationSheet}); MedicineIntakeModel copyWith() { - return MedicineIntakeModel(); + return MedicineIntakeModel( + userRegistrationSheet: + userRegistrationSheet ?? this.userRegistrationSheet, + ); } @override - List get props => []; + List get props => [userRegistrationSheet]; }