forked from eatvio/eatvio_app
Merge pull request 'registration_refactor_fix' (#22) from maxxkim/eatvio_app:registration_refactor_fix into main
Reviewed-on: eatvio/eatvio_app#22 Reviewed-by: apoloz <anatoliy.poloz@gmail.com>
This commit is contained in:
4
.env
4
.env
@@ -1,2 +1,2 @@
|
||||
SERVER_ROOT='https://ohngeeri3ien-dev3.eatvio.ru/api'
|
||||
STORAGE_URL='https://ohngeeri3ien-dev3.eatvio.ru/storage/'
|
||||
SERVER_ROOT='https://mobile-stage.eatvio.ru/api'
|
||||
STORAGE_URL='https://mobile-stage.eatvio.ru/storage/'
|
||||
@@ -77,7 +77,7 @@ class AuthScreen extends StatelessWidget {
|
||||
margin:
|
||||
EdgeInsets.only(left: 16.h, right: 16.h, bottom: 50.v),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: onTapAuth(state, context));
|
||||
onPressed: () => onTapAuth(state, context));
|
||||
}),
|
||||
])));
|
||||
}
|
||||
|
||||
@@ -76,19 +76,24 @@ class AdditionalInformationScreen extends StatelessWidget {
|
||||
UserRegistrationSheet sheet =
|
||||
state.additionalInformationModelObj!.userRegistrationSheet;
|
||||
sheet.additionalInfo = state.editTextController!.text;
|
||||
//print(json.encode(sheet.toJson()));
|
||||
final response = await http.post(
|
||||
Uri.parse(dotenv.env['SERVER_ROOT']! + '/register'),
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: json.encode(sheet),
|
||||
);
|
||||
var res = await jsonDecode(response.body);
|
||||
final box = await Hive.openBox('token');
|
||||
final token = res['token'];
|
||||
box.put('token', token);
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
AppRoutes.myProfile,
|
||||
body: jsonEncode(sheet.toJson()),
|
||||
);
|
||||
print(response.statusCode);
|
||||
print(response.body);
|
||||
if (response.statusCode == 200) {
|
||||
var res = await jsonDecode(response.body);
|
||||
final box = await Hive.openBox('token');
|
||||
final token = res['token'];
|
||||
box.put('token', token);
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
AppRoutes.myProfile,
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
|
||||
body: Container(
|
||||
width: double.maxFinite,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
|
||||
child: ListView(children: [
|
||||
child: Column(children: [
|
||||
SizedBox(height: 7.v),
|
||||
Container(
|
||||
height: 16.v,
|
||||
@@ -68,7 +68,7 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
|
||||
_buildTextFormFieldFav(context),
|
||||
SizedBox(height: 12.v),
|
||||
_buildTextFormFieldUnfav(context),
|
||||
SizedBox(height: 17.v),
|
||||
Spacer(),
|
||||
BlocBuilder<FavoriteFoodsBloc, FavoriteFoodsState>(
|
||||
builder: (context, state) {
|
||||
return NextStepButton(
|
||||
|
||||
@@ -11,10 +11,10 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class NameScreen extends StatelessWidget {
|
||||
const NameScreen({Key? key}) : super(key: key);
|
||||
|
||||
static Widget builder(BuildContext context) {
|
||||
final sheet =
|
||||
ModalRoute.of(context)!.settings.arguments as UserRegistrationSheet;
|
||||
|
||||
return BlocProvider<NameBloc>(
|
||||
create: (context) => NameBloc(
|
||||
NameState(
|
||||
@@ -34,7 +34,7 @@ class NameScreen extends StatelessWidget {
|
||||
body: Container(
|
||||
width: double.maxFinite,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
|
||||
child: ListView(children: [
|
||||
child: Column(children: [
|
||||
SizedBox(height: 7.v),
|
||||
Container(
|
||||
height: 16.v,
|
||||
@@ -74,14 +74,16 @@ class NameScreen extends StatelessWidget {
|
||||
controller: lastNameController,
|
||||
);
|
||||
}),
|
||||
SizedBox(height: 21.v),
|
||||
Spacer(),
|
||||
BlocBuilder<NameBloc, NameState>(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: _onTapNext(context, state));
|
||||
text: "continue".tr.toUpperCase(),
|
||||
margin: EdgeInsets.only(
|
||||
left: 16.h, right: 16.h, bottom: 50.v),
|
||||
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
||||
onPressed: () => _onTapNext(
|
||||
context, state), // Assign callback function here
|
||||
);
|
||||
}),
|
||||
]))));
|
||||
}
|
||||
@@ -93,7 +95,7 @@ class NameScreen extends StatelessWidget {
|
||||
leading: AppbarLeadingImage(
|
||||
imagePath: ImageConstant.imgArrowLeft,
|
||||
margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v),
|
||||
onTap: onTapArrowLeft(context)),
|
||||
onTap: () => onTapArrowLeft(context)),
|
||||
centerTitle: true,
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class _WeightScreenState extends State<WeightScreen> {
|
||||
body: Container(
|
||||
width: double.maxFinite,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
|
||||
child: ListView(children: [
|
||||
child: Column(children: [
|
||||
SizedBox(height: 7.v),
|
||||
Container(
|
||||
height: 16.v,
|
||||
@@ -81,6 +81,7 @@ class _WeightScreenState extends State<WeightScreen> {
|
||||
})
|
||||
])
|
||||
]),
|
||||
Spacer(),
|
||||
BlocBuilder<WeightBloc, WeightState>(
|
||||
builder: (context, state) {
|
||||
return NextStepButton(
|
||||
@@ -100,7 +101,7 @@ class _WeightScreenState extends State<WeightScreen> {
|
||||
leading: AppbarLeadingImage(
|
||||
imagePath: ImageConstant.imgArrowLeft,
|
||||
margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v),
|
||||
onTap: onTapArrowLeft(context)),
|
||||
onTap: () => onTapArrowLeft(context)),
|
||||
centerTitle: true,
|
||||
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user