forked from eatvio/eatvio_app
feat(order info): added order info screen
This commit is contained in:
@@ -15,7 +15,7 @@ class RegistrationCubit extends Cubit<RegistrationState> {
|
||||
RegistrationCubit({
|
||||
required this.registrationRepository,
|
||||
}) : super(
|
||||
RegistrationState(
|
||||
const RegistrationState(
|
||||
sheet: UserRegistrationSheet(
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
|
||||
@@ -12,8 +12,7 @@ part of 'registration_state.dart';
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
/// @nodoc
|
||||
mixin _$RegistrationState {
|
||||
@@ -29,9 +28,8 @@ mixin _$RegistrationState {
|
||||
/// @nodoc
|
||||
abstract class $RegistrationStateCopyWith<$Res> {
|
||||
factory $RegistrationStateCopyWith(
|
||||
RegistrationState value,
|
||||
$Res Function(RegistrationState) then,
|
||||
) = _$RegistrationStateCopyWithImpl<$Res, RegistrationState>;
|
||||
RegistrationState value, $Res Function(RegistrationState) then) =
|
||||
_$RegistrationStateCopyWithImpl<$Res, RegistrationState>;
|
||||
@useResult
|
||||
$Res call({UserRegistrationSheet sheet});
|
||||
|
||||
@@ -52,17 +50,15 @@ class _$RegistrationStateCopyWithImpl<$Res, $Val extends RegistrationState>
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? sheet = null}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
sheet:
|
||||
null == sheet
|
||||
? _value.sheet
|
||||
: sheet // ignore: cast_nullable_to_non_nullable
|
||||
as UserRegistrationSheet,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
$Res call({
|
||||
Object? sheet = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
sheet: null == sheet
|
||||
? _value.sheet
|
||||
: sheet // ignore: cast_nullable_to_non_nullable
|
||||
as UserRegistrationSheet,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
/// Create a copy of RegistrationState
|
||||
@@ -79,10 +75,9 @@ class _$RegistrationStateCopyWithImpl<$Res, $Val extends RegistrationState>
|
||||
/// @nodoc
|
||||
abstract class _$$RegistrationStateImplCopyWith<$Res>
|
||||
implements $RegistrationStateCopyWith<$Res> {
|
||||
factory _$$RegistrationStateImplCopyWith(
|
||||
_$RegistrationStateImpl value,
|
||||
$Res Function(_$RegistrationStateImpl) then,
|
||||
) = __$$RegistrationStateImplCopyWithImpl<$Res>;
|
||||
factory _$$RegistrationStateImplCopyWith(_$RegistrationStateImpl value,
|
||||
$Res Function(_$RegistrationStateImpl) then) =
|
||||
__$$RegistrationStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({UserRegistrationSheet sheet});
|
||||
@@ -95,25 +90,23 @@ abstract class _$$RegistrationStateImplCopyWith<$Res>
|
||||
class __$$RegistrationStateImplCopyWithImpl<$Res>
|
||||
extends _$RegistrationStateCopyWithImpl<$Res, _$RegistrationStateImpl>
|
||||
implements _$$RegistrationStateImplCopyWith<$Res> {
|
||||
__$$RegistrationStateImplCopyWithImpl(
|
||||
_$RegistrationStateImpl _value,
|
||||
$Res Function(_$RegistrationStateImpl) _then,
|
||||
) : super(_value, _then);
|
||||
__$$RegistrationStateImplCopyWithImpl(_$RegistrationStateImpl _value,
|
||||
$Res Function(_$RegistrationStateImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of RegistrationState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? sheet = null}) {
|
||||
return _then(
|
||||
_$RegistrationStateImpl(
|
||||
sheet:
|
||||
null == sheet
|
||||
? _value.sheet
|
||||
: sheet // ignore: cast_nullable_to_non_nullable
|
||||
as UserRegistrationSheet,
|
||||
),
|
||||
);
|
||||
$Res call({
|
||||
Object? sheet = null,
|
||||
}) {
|
||||
return _then(_$RegistrationStateImpl(
|
||||
sheet: null == sheet
|
||||
? _value.sheet
|
||||
: sheet // ignore: cast_nullable_to_non_nullable
|
||||
as UserRegistrationSheet,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,15 +141,12 @@ class _$RegistrationStateImpl implements _RegistrationState {
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$RegistrationStateImplCopyWith<_$RegistrationStateImpl> get copyWith =>
|
||||
__$$RegistrationStateImplCopyWithImpl<_$RegistrationStateImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _RegistrationState implements RegistrationState {
|
||||
const factory _RegistrationState({
|
||||
required final UserRegistrationSheet sheet,
|
||||
}) = _$RegistrationStateImpl;
|
||||
const factory _RegistrationState(
|
||||
{required final UserRegistrationSheet sheet}) = _$RegistrationStateImpl;
|
||||
|
||||
@override
|
||||
UserRegistrationSheet get sheet;
|
||||
|
||||
@@ -28,23 +28,23 @@ class _AdditionalInformationScreenState extends State<AdditionalInformationScree
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
padding: EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16),
|
||||
padding: const EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
const Text(
|
||||
'Дополнительная информация (не обязательно)',
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
controller: editTextController,
|
||||
textInputAction: TextInputAction.done,
|
||||
maxLines: 8,
|
||||
inputFormatters: [
|
||||
new LengthLimitingTextInputFormatter(250),
|
||||
LengthLimitingTextInputFormatter(250),
|
||||
],
|
||||
focusNode: editFocusNode,
|
||||
autofocus: true,
|
||||
|
||||
@@ -29,12 +29,12 @@ class _AllergiesScreenState extends State<AllergiesScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
return SingleChildScrollView(
|
||||
padding: EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16),
|
||||
padding: const EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.allergies_presence + ' (не обязательно)'),
|
||||
SizedBox(height: 4),
|
||||
Text('${s.allergies_presence} (не обязательно)'),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
controller: enterInformationController,
|
||||
hintText: 'Например: орехи, мёд и т.д.',
|
||||
|
||||
@@ -20,11 +20,11 @@ class BloodPressureScreen extends StatefulWidget {
|
||||
|
||||
class _BloodPressureScreenState extends State<BloodPressureScreen> {
|
||||
final List<SelectionPopupModel> selectionPopupList = [
|
||||
SelectionPopupModel(
|
||||
const SelectionPopupModel(
|
||||
id: 1,
|
||||
title: "Да",
|
||||
),
|
||||
SelectionPopupModel(
|
||||
const SelectionPopupModel(
|
||||
id: 0,
|
||||
title: "Нет",
|
||||
),
|
||||
@@ -54,12 +54,12 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
return SingleChildScrollView(
|
||||
padding: EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16),
|
||||
padding: const EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.up_pressure + ' (не обязательно)'),
|
||||
SizedBox(height: 4),
|
||||
Text('${s.up_pressure} (не обязательно)'),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
inputFormatters: [digitsOnly],
|
||||
controller: upPressureController,
|
||||
@@ -71,9 +71,9 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
|
||||
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(bloodPressureUp: int.parse(newValue)));
|
||||
},
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Text(s.down_pressure + ' (не обязательно)'),
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 16),
|
||||
Text('${s.down_pressure} (не обязательно)'),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
inputFormatters: [digitsOnly],
|
||||
controller: downPressureController,
|
||||
@@ -83,12 +83,12 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
|
||||
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(bloodPressureDown: int.parse(newValue)));
|
||||
},
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Text(s.do_you_have_hypotension_tendency + ' (не обязательно)'),
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 16),
|
||||
Text('${s.do_you_have_hypotension_tendency} (не обязательно)'),
|
||||
const SizedBox(height: 4),
|
||||
CustomDropDown(
|
||||
icon: Container(
|
||||
margin: EdgeInsets.all(16),
|
||||
margin: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
@@ -109,12 +109,12 @@ class _BloodPressureScreenState extends State<BloodPressureScreen> {
|
||||
});
|
||||
},
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Text(s.do_you_have_hypertension_tendency + ' (не обязательно)'),
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 16),
|
||||
Text('${s.do_you_have_hypertension_tendency} (не обязательно)'),
|
||||
const SizedBox(height: 4),
|
||||
CustomDropDown(
|
||||
icon: Container(
|
||||
margin: EdgeInsets.all(16),
|
||||
margin: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
|
||||
@@ -35,12 +35,12 @@ class _BodyCircumferencesScreenState extends State<BodyCircumferencesScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
return SingleChildScrollView(
|
||||
padding: EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16),
|
||||
padding: const EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.chest_circumference + ' (не обязательно)'),
|
||||
SizedBox(height: 4),
|
||||
Text('${s.chest_circumference} (не обязательно)'),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
inputFormatters: [digitsOnly],
|
||||
autofocus: true,
|
||||
@@ -52,9 +52,9 @@ class _BodyCircumferencesScreenState extends State<BodyCircumferencesScreen> {
|
||||
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(chestCircumference: int.parse(value)));
|
||||
},
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Text(s.waist_circumference + ' (не обязательно)'),
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 16),
|
||||
Text('${s.waist_circumference} (не обязательно)'),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
inputFormatters: [digitsOnly],
|
||||
controller: waistCircumferenceController,
|
||||
@@ -64,9 +64,9 @@ class _BodyCircumferencesScreenState extends State<BodyCircumferencesScreen> {
|
||||
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(waistCircumference: int.parse(value)));
|
||||
},
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Text(s.hip_circumference + ' (не обязательно)'),
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 16),
|
||||
Text('${s.hip_circumference} (не обязательно)'),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
inputFormatters: [digitsOnly],
|
||||
controller: hipCircumferenceController,
|
||||
|
||||
@@ -18,7 +18,7 @@ class CityOfLivingScreen extends StatefulWidget {
|
||||
|
||||
class _CityOfLivingScreenState extends State<CityOfLivingScreen> {
|
||||
final dropdownItemList = [
|
||||
SelectionPopupModel(id: 1, title: "Россия", isSelected: true),
|
||||
const SelectionPopupModel(id: 1, title: "Россия", isSelected: true),
|
||||
];
|
||||
|
||||
late SelectionPopupModel selectedItem;
|
||||
@@ -37,18 +37,18 @@ class _CityOfLivingScreenState extends State<CityOfLivingScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
padding: EdgeInsets.only(bottom: 80, right: 16, left: 16, top: 16),
|
||||
padding: const EdgeInsets.only(bottom: 80, right: 16, left: 16, top: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Местоположение"),
|
||||
SizedBox(height: 4),
|
||||
const Text("Местоположение"),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width - 32,
|
||||
child: TypeAheadField(
|
||||
debounceDuration: Duration(milliseconds: 300),
|
||||
debounceDuration: const Duration(milliseconds: 300),
|
||||
controller: cityController,
|
||||
suggestionsController: suggestionsController,
|
||||
builder: (context, controller, focus) => CustomTextFormField(
|
||||
@@ -60,7 +60,7 @@ class _CityOfLivingScreenState extends State<CityOfLivingScreen> {
|
||||
final registrationCubit = context.read<RegistrationCubit>();
|
||||
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(location: value));
|
||||
},
|
||||
textStyle: TextStyle(
|
||||
textStyle: const TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.black,
|
||||
),
|
||||
|
||||
@@ -36,13 +36,13 @@ class _CredentialsScreenState extends State<CredentialsScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
return SingleChildScrollView(
|
||||
padding: EdgeInsets.only(bottom: 80, top: 16, left: 16, right: 16),
|
||||
padding: const EdgeInsets.only(bottom: 80, top: 16, left: 16, right: 16),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.email),
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
controller: emailController,
|
||||
focusNode: emailFocusNode,
|
||||
@@ -56,9 +56,9 @@ class _CredentialsScreenState extends State<CredentialsScreen> {
|
||||
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(email: newValue));
|
||||
},
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
Text(s.password),
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
obscureText: hidePassword,
|
||||
controller: passwordController,
|
||||
@@ -80,9 +80,9 @@ class _CredentialsScreenState extends State<CredentialsScreen> {
|
||||
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(password: newValue));
|
||||
},
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
Text(s.password_confirmation),
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
obscureText: hidePassword,
|
||||
controller: passwordConfirmationController,
|
||||
|
||||
@@ -37,16 +37,16 @@ class _DateOfBirthScreenState extends State<DateOfBirthScreen> {
|
||||
final s = S.of(context);
|
||||
|
||||
return SingleChildScrollView(
|
||||
padding: EdgeInsets.only(bottom: 80, top: 16, left: 16, right: 16),
|
||||
padding: const EdgeInsets.only(bottom: 80, top: 16, left: 16, right: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.date_of_birth),
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
ListTile(
|
||||
onTap: onTapCalendar(context),
|
||||
leading: Icon(Icons.calendar_month_rounded, color: appTheme.blueA400),
|
||||
trailing: Icon(Icons.keyboard_arrow_down_rounded),
|
||||
trailing: const Icon(Icons.keyboard_arrow_down_rounded),
|
||||
title: Text(selectedDate.format('dd MMMM yyyy', 'ru')),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
@@ -112,7 +112,7 @@ class _DateOfBirthScreenState extends State<DateOfBirthScreen> {
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
color: appTheme.blueA400,
|
||||
),
|
||||
child: Center(
|
||||
child: const Center(
|
||||
child: Text(
|
||||
'Сохранить',
|
||||
style: TextStyle(
|
||||
|
||||
@@ -31,12 +31,12 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
return SingleChildScrollView(
|
||||
padding: EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16),
|
||||
padding: const EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.favorite_foods + ' (не обязательно)'),
|
||||
SizedBox(height: 4),
|
||||
Text('${s.favorite_foods} (не обязательно)'),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
controller: favoriteFoodsController,
|
||||
hintText: s.enter_information,
|
||||
@@ -49,9 +49,9 @@ class _FavoriteFoodsScreenState extends State<FavoriteFoodsScreen> {
|
||||
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(favoriteFoods: newValue));
|
||||
},
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
Text(s.unfavorite_foods + ' (не обязательно)'),
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 16),
|
||||
Text('${s.unfavorite_foods} (не обязательно)'),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
controller: unFavoriteFoodsController,
|
||||
hintText: s.enter_information,
|
||||
|
||||
@@ -29,12 +29,12 @@ class _FavoriteSportsScreenState extends State<FavoriteSportsScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
return SingleChildScrollView(
|
||||
padding: EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16),
|
||||
padding: const EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.your_favorite_sports + ' (не обязательно)'),
|
||||
SizedBox(height: 4),
|
||||
Text('${s.your_favorite_sports} (не обязательно)'),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
controller: enterInformationController,
|
||||
focusNode: infoFocusNode,
|
||||
|
||||
@@ -24,7 +24,7 @@ class _GenderScreenState extends State<GenderScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
padding: EdgeInsets.only(bottom: 80, top: 16, left: 16, right: 16),
|
||||
padding: const EdgeInsets.only(bottom: 80, top: 16, left: 16, right: 16),
|
||||
child: Column(
|
||||
children: [
|
||||
RadioListTile(
|
||||
@@ -32,7 +32,7 @@ class _GenderScreenState extends State<GenderScreen> {
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
title: Text('Мужской'),
|
||||
title: const Text('Мужской'),
|
||||
value: 'male',
|
||||
groupValue: currentValue,
|
||||
onChanged: (newValue) {
|
||||
@@ -48,13 +48,13 @@ class _GenderScreenState extends State<GenderScreen> {
|
||||
height: 40,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
RadioListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
title: Text('Женский'),
|
||||
title: const Text('Женский'),
|
||||
value: 'female',
|
||||
groupValue: currentValue,
|
||||
onChanged: (newValue) {
|
||||
|
||||
@@ -30,12 +30,12 @@ class _HeightScreenState extends State<HeightScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
return SingleChildScrollView(
|
||||
padding: EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16),
|
||||
padding: const EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.your_height),
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
textInputAction: TextInputAction.done,
|
||||
autofocus: true,
|
||||
|
||||
@@ -17,7 +17,7 @@ class LanguageSelectScreen extends StatefulWidget {
|
||||
|
||||
class _LanguageSelectScreenState extends State<LanguageSelectScreen> {
|
||||
final List<SelectionPopupModel> dropdownItemList = [
|
||||
SelectionPopupModel(id: 1, title: "Русский", isSelected: true),
|
||||
const SelectionPopupModel(id: 1, title: "Русский", isSelected: true),
|
||||
];
|
||||
|
||||
late SelectionPopupModel value;
|
||||
@@ -38,7 +38,7 @@ class _LanguageSelectScreenState extends State<LanguageSelectScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
return SingleChildScrollView(
|
||||
padding: EdgeInsets.only(bottom: 80, right: 16, left: 16, top: 16),
|
||||
padding: const EdgeInsets.only(bottom: 80, right: 16, left: 16, top: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
@@ -29,12 +29,12 @@ class _MedicineIntakeScreenState extends State<MedicineIntakeScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
return SingleChildScrollView(
|
||||
padding: EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16),
|
||||
padding: const EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.do_you_take_pills + ' (не обязательно)'),
|
||||
SizedBox(height: 4),
|
||||
Text('${s.do_you_take_pills} (не обязательно)'),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
controller: enterInformationController,
|
||||
hintText: s.enter_information,
|
||||
|
||||
@@ -31,12 +31,12 @@ class _NameScreenState extends State<NameScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
return SingleChildScrollView(
|
||||
padding: EdgeInsets.only(bottom: 80, top: 16, left: 16, right: 16),
|
||||
padding: const EdgeInsets.only(bottom: 80, top: 16, left: 16, right: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.first_name),
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
controller: firstNameController,
|
||||
focusNode: nameFocus,
|
||||
@@ -47,9 +47,9 @@ class _NameScreenState extends State<NameScreen> {
|
||||
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(firstName: newValue));
|
||||
},
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
Text(s.last_name),
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
controller: lastNameController,
|
||||
textInputAction: TextInputAction.done,
|
||||
|
||||
@@ -36,12 +36,12 @@ class _PhoneScreenState extends State<PhoneScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
padding: EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16),
|
||||
padding: const EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Номер телефона'),
|
||||
SizedBox(height: 4),
|
||||
const Text('Номер телефона'),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
textInputAction: TextInputAction.done,
|
||||
autofocus: true,
|
||||
|
||||
@@ -52,7 +52,7 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
|
||||
Container(
|
||||
height: 48,
|
||||
width: MediaQuery.of(context).size.width * 0.2,
|
||||
padding: EdgeInsets.only(left: 16, right: 4),
|
||||
padding: const EdgeInsets.only(left: 16, right: 4),
|
||||
child: FloatingActionButton.extended(
|
||||
heroTag: 'backButtonRegistration',
|
||||
highlightElevation: 0,
|
||||
@@ -61,7 +61,7 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
backgroundColor: Color(0xFFEAF2FD),
|
||||
backgroundColor: const Color(0xFFEAF2FD),
|
||||
onPressed: () async {
|
||||
setState(() {
|
||||
pageController.previousPage(
|
||||
@@ -79,7 +79,7 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
|
||||
Container(
|
||||
height: 48,
|
||||
width: MediaQuery.of(context).size.width * 0.8,
|
||||
padding: EdgeInsets.only(left: 4, right: 16),
|
||||
padding: const EdgeInsets.only(left: 4, right: 16),
|
||||
child: FloatingActionButton.extended(
|
||||
heroTag: 'nextButtonRegistration',
|
||||
highlightElevation: 0,
|
||||
@@ -90,7 +90,7 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
|
||||
),
|
||||
backgroundColor: appTheme.blueA400,
|
||||
onPressed: () async {
|
||||
if (await canGoNext(state)) {
|
||||
if (await canGoNext(state, context)) {
|
||||
setState(() {
|
||||
pageController.nextPage(
|
||||
duration: const Duration(milliseconds: 350),
|
||||
@@ -111,7 +111,7 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
|
||||
automaticallyImplyLeading: false,
|
||||
leading: Builder(
|
||||
builder: (context) => IconButton(
|
||||
icon: Icon(Icons.close_rounded),
|
||||
icon: const Icon(Icons.close_rounded),
|
||||
onPressed: () => GoRouter.of(context).pop(),
|
||||
),
|
||||
),
|
||||
@@ -150,7 +150,7 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
|
||||
),
|
||||
),
|
||||
body: PageView(
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
controller: pageController,
|
||||
onPageChanged: (index) {
|
||||
setState(() {
|
||||
@@ -183,19 +183,19 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<bool> canGoNext(RegistrationState state) async {
|
||||
Future<bool> canGoNext(RegistrationState state, BuildContext context) async {
|
||||
switch (step) {
|
||||
case 1:
|
||||
if (state.sheet.phone.length != 18) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text('Ошибка'),
|
||||
content: Text('Введите корректный номер телефона'),
|
||||
title: const Text('Ошибка'),
|
||||
content: const Text('Введите корректный номер телефона'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: Text('OK'),
|
||||
child: const Text('OK'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -217,18 +217,18 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
|
||||
String errorMessage = '';
|
||||
|
||||
for (var error in errors) {
|
||||
errorMessage += error + '\n\n';
|
||||
errorMessage += '$error\n\n';
|
||||
}
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text('Ошибка'),
|
||||
title: const Text('Ошибка'),
|
||||
content: Text(errorMessage),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: Text('OK'),
|
||||
child: const Text('OK'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -247,18 +247,18 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
|
||||
String errorMessage = '';
|
||||
|
||||
for (var error in errors) {
|
||||
errorMessage += error + '\n\n';
|
||||
errorMessage += '$error\n\n';
|
||||
}
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text('Ошибка'),
|
||||
title: const Text('Ошибка'),
|
||||
content: Text(errorMessage),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: Text('OK'),
|
||||
child: const Text('OK'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -266,18 +266,18 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
|
||||
return false;
|
||||
}
|
||||
case 4:
|
||||
if (state.sheet.gender.isNotEmpty)
|
||||
if (state.sheet.gender.isNotEmpty) {
|
||||
return true;
|
||||
else {
|
||||
} else {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text('Ошибка'),
|
||||
content: Text('Выберете пол'),
|
||||
title: const Text('Ошибка'),
|
||||
content: const Text('Выберете пол'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: Text('OK'),
|
||||
child: const Text('OK'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -285,18 +285,18 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
|
||||
return false;
|
||||
}
|
||||
case 6:
|
||||
if (state.sheet.location.isNotEmpty)
|
||||
if (state.sheet.location.isNotEmpty) {
|
||||
return true;
|
||||
else {
|
||||
} else {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text('Ошибка'),
|
||||
content: Text('Заполните все поля'),
|
||||
title: const Text('Ошибка'),
|
||||
content: const Text('Заполните все поля'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: Text('OK'),
|
||||
child: const Text('OK'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -316,18 +316,18 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
|
||||
String errorMessage = '';
|
||||
|
||||
for (var error in errors) {
|
||||
errorMessage += error + '\n\n';
|
||||
errorMessage += '$error\n\n';
|
||||
}
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text('Ошибка'),
|
||||
title: const Text('Ошибка'),
|
||||
content: Text(errorMessage),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: Text('OK'),
|
||||
child: const Text('OK'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -340,21 +340,25 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
|
||||
barrierDismissible: false,
|
||||
useSafeArea: false,
|
||||
context: context,
|
||||
builder: (context) => PopScope(
|
||||
builder: (context) => const PopScope(
|
||||
canPop: false,
|
||||
child: const Loader(),
|
||||
child: Loader(),
|
||||
),
|
||||
);
|
||||
await registrationCubit.tryRegistration();
|
||||
Navigator.pop(context);
|
||||
if (context.mounted) {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
} catch (e) {
|
||||
Navigator.pop(context);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text('Ошибка при попытке регистрации'),
|
||||
),
|
||||
);
|
||||
if (context.mounted) {
|
||||
Navigator.pop(context);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => const AlertDialog(
|
||||
title: Text('Ошибка при попытке регистрации'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
default:
|
||||
@@ -423,7 +427,7 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
|
||||
errors.add('First name cannot be empty');
|
||||
}
|
||||
|
||||
if (firstName.length < 1) {
|
||||
if (firstName.isEmpty) {
|
||||
errors.add('First name is too short');
|
||||
}
|
||||
|
||||
@@ -431,7 +435,7 @@ class _RegistrationScreenState extends State<RegistrationScreen> {
|
||||
errors.add('Last name cannot be empty');
|
||||
}
|
||||
|
||||
if (lastName.length < 1) {
|
||||
if (lastName.isEmpty) {
|
||||
errors.add('Last name is too short');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:eatvio_app/core/const.dart';
|
||||
import 'package:eatvio_app/core/locator_service.dart';
|
||||
@@ -7,7 +8,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
class WebViewRegistrationScreen extends StatefulWidget {
|
||||
const WebViewRegistrationScreen();
|
||||
const WebViewRegistrationScreen({super.key});
|
||||
|
||||
@override
|
||||
State<WebViewRegistrationScreen> createState() => _WebViewRegistrationScreenState();
|
||||
@@ -31,10 +32,10 @@ class _WebViewRegistrationScreenState extends State<WebViewRegistrationScreen> {
|
||||
final data = jsonDecode(message.message);
|
||||
if (data['type'] == 'email') {
|
||||
email = data['value'];
|
||||
print("Email: $email");
|
||||
log("Email: $email");
|
||||
} else if (data['type'] == 'password') {
|
||||
password = data['value'];
|
||||
print("Password: $password");
|
||||
log("Password: $password");
|
||||
}
|
||||
},
|
||||
)
|
||||
@@ -51,13 +52,13 @@ class _WebViewRegistrationScreenState extends State<WebViewRegistrationScreen> {
|
||||
},
|
||||
),
|
||||
)
|
||||
..loadRequest(Uri.parse(baseUrl + '/registration/step1'));
|
||||
..loadRequest(Uri.parse('$baseUrl/registration/step1'));
|
||||
|
||||
_injectJavaScript();
|
||||
}
|
||||
|
||||
void _injectJavaScript() async {
|
||||
await Future.delayed(Duration(seconds: 2));
|
||||
await Future.delayed(const Duration(seconds: 2));
|
||||
_controller.runJavaScript('''
|
||||
function sendMessageToFlutter(data) {
|
||||
window.flutter_inject.postMessage(JSON.stringify(data));
|
||||
|
||||
@@ -30,12 +30,12 @@ class _WeightScreenState extends State<WeightScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
final s = S.of(context);
|
||||
return SingleChildScrollView(
|
||||
padding: EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16),
|
||||
padding: const EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(s.your_weight),
|
||||
SizedBox(height: 4),
|
||||
const SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
autofocus: true,
|
||||
hintText: 'кг',
|
||||
|
||||
Reference in New Issue
Block a user