forked from eatvio/eatvio_app
refactor(registration): Autocomplete for city, numeric inputs for weight & height, examples for sports and add info
This commit is contained in:
@@ -122,7 +122,7 @@ class AdditionalInformationScreen extends StatelessWidget {
|
|||||||
/// Section Widget
|
/// Section Widget
|
||||||
_buildTextFormField(BuildContext context) {
|
_buildTextFormField(BuildContext context) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: 257.v,
|
height: 289.v,
|
||||||
width: 343.h,
|
width: 343.h,
|
||||||
child: Stack(alignment: Alignment.center, children: [
|
child: Stack(alignment: Alignment.center, children: [
|
||||||
Align(
|
Align(
|
||||||
@@ -143,7 +143,10 @@ class AdditionalInformationScreen extends StatelessWidget {
|
|||||||
builder: (context, editTextController) {
|
builder: (context, editTextController) {
|
||||||
return CustomTextFormField(
|
return CustomTextFormField(
|
||||||
controller: editTextController,
|
controller: editTextController,
|
||||||
textInputAction: TextInputAction.done);
|
hintText:
|
||||||
|
"У меня крепкое здоровье, но последнее время часто утомляюсь, однако, это мне не мешает радоваться жизни",
|
||||||
|
textInputAction: TextInputAction.done,
|
||||||
|
maxLines: 8);
|
||||||
})
|
})
|
||||||
]))
|
]))
|
||||||
]));
|
]));
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ class CityOfLivingBloc extends Bloc<CityOfLivingEvent, CityOfLivingState> {
|
|||||||
CityOfLivingBloc(CityOfLivingState initialState) : super(initialState) {
|
CityOfLivingBloc(CityOfLivingState initialState) : super(initialState) {
|
||||||
on<CityOfLivingInitialEvent>(_onInitialize);
|
on<CityOfLivingInitialEvent>(_onInitialize);
|
||||||
on<ChangeDropDownEvent>(_changeDropDown);
|
on<ChangeDropDownEvent>(_changeDropDown);
|
||||||
on<ChangeDropDown1Event>(_changeDropDown1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_onInitialize(
|
_onInitialize(
|
||||||
@@ -19,8 +18,8 @@ class CityOfLivingBloc extends Bloc<CityOfLivingEvent, CityOfLivingState> {
|
|||||||
) async {
|
) async {
|
||||||
emit(state.copyWith(
|
emit(state.copyWith(
|
||||||
cityOfLivingModelObj: state.cityOfLivingModelObj?.copyWith(
|
cityOfLivingModelObj: state.cityOfLivingModelObj?.copyWith(
|
||||||
dropdownItemList: fillDropdownItemList(),
|
dropdownItemList: fillDropdownItemList(),
|
||||||
dropdownItemList1: fillDropdownItemList1())));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
_changeDropDown(
|
_changeDropDown(
|
||||||
@@ -32,50 +31,7 @@ class CityOfLivingBloc extends Bloc<CityOfLivingEvent, CityOfLivingState> {
|
|||||||
event.value.title;
|
event.value.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
_changeDropDown1(
|
|
||||||
ChangeDropDown1Event event,
|
|
||||||
Emitter<CityOfLivingState> emit,
|
|
||||||
) {
|
|
||||||
emit(state.copyWith(selectedDropDownValue1: event.value));
|
|
||||||
state.cityOfLivingModelObj?.userRegistrationSheet.city = event.value.title;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<SelectionPopupModel> fillDropdownItemList() {
|
List<SelectionPopupModel> fillDropdownItemList() {
|
||||||
return [SelectionPopupModel(id: 1, title: "Россия", isSelected: true)];
|
return [SelectionPopupModel(id: 1, title: "Россия", isSelected: true)];
|
||||||
}
|
}
|
||||||
|
|
||||||
List<SelectionPopupModel> fillDropdownItemList1() {
|
|
||||||
return [
|
|
||||||
SelectionPopupModel(id: 1, title: "Москва", isSelected: true),
|
|
||||||
SelectionPopupModel(id: 2, title: "Санкт-Петербург"),
|
|
||||||
SelectionPopupModel(id: 3, title: "Новосибирск"),
|
|
||||||
SelectionPopupModel(id: 4, title: "Екатеринбург"),
|
|
||||||
SelectionPopupModel(id: 5, title: "Нижний Новгород"),
|
|
||||||
SelectionPopupModel(id: 6, title: "Казань"),
|
|
||||||
SelectionPopupModel(id: 7, title: "Самара"),
|
|
||||||
SelectionPopupModel(id: 8, title: "Омск"),
|
|
||||||
SelectionPopupModel(id: 9, title: "Челябинск"),
|
|
||||||
SelectionPopupModel(id: 10, title: "Ростов-на-Дону"),
|
|
||||||
SelectionPopupModel(id: 11, title: "Уфа"),
|
|
||||||
SelectionPopupModel(id: 12, title: "Волгоград"),
|
|
||||||
SelectionPopupModel(id: 13, title: "Пермь"),
|
|
||||||
SelectionPopupModel(id: 14, title: "Красноярск"),
|
|
||||||
SelectionPopupModel(id: 15, title: "Воронеж"),
|
|
||||||
SelectionPopupModel(id: 16, title: "Саратов"),
|
|
||||||
SelectionPopupModel(id: 17, title: "Краснодар"),
|
|
||||||
SelectionPopupModel(id: 18, title: "Тольятти"),
|
|
||||||
SelectionPopupModel(id: 19, title: "Барнаул"),
|
|
||||||
SelectionPopupModel(id: 20, title: "Ижевск"),
|
|
||||||
SelectionPopupModel(id: 21, title: "Ульяновск"),
|
|
||||||
SelectionPopupModel(id: 22, title: "Тюмень"),
|
|
||||||
SelectionPopupModel(id: 23, title: "Иркутск"),
|
|
||||||
SelectionPopupModel(id: 24, title: "Хабаровск"),
|
|
||||||
SelectionPopupModel(id: 25, title: "Ярославль"),
|
|
||||||
SelectionPopupModel(id: 26, title: "Кемерово"),
|
|
||||||
SelectionPopupModel(id: 27, title: "Магнитогорск"),
|
|
||||||
SelectionPopupModel(id: 28, title: "Новокузнецк"),
|
|
||||||
SelectionPopupModel(id: 29, title: "Томск"),
|
|
||||||
SelectionPopupModel(id: 30, title: "Астрахань")
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,15 +26,3 @@ class ChangeDropDownEvent extends CityOfLivingEvent {
|
|||||||
value,
|
value,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
///event for dropdown selection
|
|
||||||
class ChangeDropDown1Event extends CityOfLivingEvent {
|
|
||||||
ChangeDropDown1Event({required this.value});
|
|
||||||
|
|
||||||
SelectionPopupModel value;
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<Object?> get props => [
|
|
||||||
value,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -6,20 +6,20 @@ part of 'city_of_living_bloc.dart';
|
|||||||
class CityOfLivingState extends Equatable {
|
class CityOfLivingState extends Equatable {
|
||||||
CityOfLivingState({
|
CityOfLivingState({
|
||||||
this.selectedDropDownValue,
|
this.selectedDropDownValue,
|
||||||
this.selectedDropDownValue1,
|
this.cityController,
|
||||||
this.cityOfLivingModelObj,
|
this.cityOfLivingModelObj,
|
||||||
});
|
});
|
||||||
|
|
||||||
SelectionPopupModel? selectedDropDownValue;
|
SelectionPopupModel? selectedDropDownValue;
|
||||||
|
|
||||||
SelectionPopupModel? selectedDropDownValue1;
|
TextEditingController? cityController;
|
||||||
|
|
||||||
CityOfLivingModel? cityOfLivingModelObj;
|
CityOfLivingModel? cityOfLivingModelObj;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object?> get props => [
|
List<Object?> get props => [
|
||||||
selectedDropDownValue,
|
selectedDropDownValue,
|
||||||
selectedDropDownValue1,
|
cityController,
|
||||||
cityOfLivingModelObj,
|
cityOfLivingModelObj,
|
||||||
];
|
];
|
||||||
CityOfLivingState copyWith({
|
CityOfLivingState copyWith({
|
||||||
@@ -30,8 +30,7 @@ class CityOfLivingState extends Equatable {
|
|||||||
return CityOfLivingState(
|
return CityOfLivingState(
|
||||||
selectedDropDownValue:
|
selectedDropDownValue:
|
||||||
selectedDropDownValue ?? this.selectedDropDownValue,
|
selectedDropDownValue ?? this.selectedDropDownValue,
|
||||||
selectedDropDownValue1:
|
cityController: cityController ?? this.cityController,
|
||||||
selectedDropDownValue1 ?? this.selectedDropDownValue1,
|
|
||||||
cityOfLivingModelObj: cityOfLivingModelObj ?? this.cityOfLivingModelObj,
|
cityOfLivingModelObj: cityOfLivingModelObj ?? this.cityOfLivingModelObj,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -138,7 +138,8 @@ class _FavoriteSportsScreenState extends State<FavoriteSportsScreen> {
|
|||||||
builder: (context, enterinformationController) {
|
builder: (context, enterinformationController) {
|
||||||
return CustomTextFormField(
|
return CustomTextFormField(
|
||||||
controller: enterinformationController,
|
controller: enterinformationController,
|
||||||
hintText: "enter_information".tr,
|
hintText:
|
||||||
|
"Я занимаюсь плаванием , почти каждый вечер прогулки на свежем воздухе, пару раз в месяц играю в волейбол. Стараюсь не сидеть на месте!",
|
||||||
textInputAction: TextInputAction.done,
|
textInputAction: TextInputAction.done,
|
||||||
maxLines: 8);
|
maxLines: 8);
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ class CustomTextFormField extends StatelessWidget {
|
|||||||
this.filled = true,
|
this.filled = true,
|
||||||
this.validator,
|
this.validator,
|
||||||
this.keyboardType,
|
this.keyboardType,
|
||||||
|
this.onFieldSubmitted,
|
||||||
this.onSaved,
|
this.onSaved,
|
||||||
}) : super(
|
}) : super(
|
||||||
key: key,
|
key: key,
|
||||||
@@ -56,6 +57,7 @@ class CustomTextFormField extends StatelessWidget {
|
|||||||
final bool? filled;
|
final bool? filled;
|
||||||
final TextInputType? keyboardType;
|
final TextInputType? keyboardType;
|
||||||
final FormFieldValidator<String>? validator;
|
final FormFieldValidator<String>? validator;
|
||||||
|
final Function(String)? onFieldSubmitted;
|
||||||
final void Function(String?)? onSaved;
|
final void Function(String?)? onSaved;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -73,6 +75,7 @@ class CustomTextFormField extends StatelessWidget {
|
|||||||
obscureText: obscureText!,
|
obscureText: obscureText!,
|
||||||
textInputAction: textInputAction,
|
textInputAction: textInputAction,
|
||||||
maxLines: maxLines ?? 1,
|
maxLines: maxLines ?? 1,
|
||||||
|
onFieldSubmitted: onFieldSubmitted,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: hintText ?? "",
|
hintText: hintText ?? "",
|
||||||
hintStyle: hintStyle ?? theme.textTheme.bodyLarge,
|
hintStyle: hintStyle ?? theme.textTheme.bodyLarge,
|
||||||
|
|||||||
Reference in New Issue
Block a user