forked from eatvio/eatvio_app
Merge pull request 'refactor(registration): Autocomplete for city, numeric inputs for weight & height, examples for sports and add info' (#35) from maxxkim/eatvio_app:fix_metrics into main
Reviewed-on: eatvio/eatvio_app#35 Reviewed-by: apoloz <anatoliy.poloz@gmail.com>
This commit is contained in:
@@ -122,7 +122,7 @@ class AdditionalInformationScreen extends StatelessWidget {
|
||||
/// Section Widget
|
||||
_buildTextFormField(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: 257.v,
|
||||
height: 315.v,
|
||||
width: 343.h,
|
||||
child: Stack(alignment: Alignment.center, children: [
|
||||
Align(
|
||||
@@ -143,7 +143,10 @@ class AdditionalInformationScreen extends StatelessWidget {
|
||||
builder: (context, editTextController) {
|
||||
return CustomTextFormField(
|
||||
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) {
|
||||
on<CityOfLivingInitialEvent>(_onInitialize);
|
||||
on<ChangeDropDownEvent>(_changeDropDown);
|
||||
on<ChangeDropDown1Event>(_changeDropDown1);
|
||||
}
|
||||
|
||||
_onInitialize(
|
||||
@@ -19,8 +18,8 @@ class CityOfLivingBloc extends Bloc<CityOfLivingEvent, CityOfLivingState> {
|
||||
) async {
|
||||
emit(state.copyWith(
|
||||
cityOfLivingModelObj: state.cityOfLivingModelObj?.copyWith(
|
||||
dropdownItemList: fillDropdownItemList(),
|
||||
dropdownItemList1: fillDropdownItemList1())));
|
||||
dropdownItemList: fillDropdownItemList(),
|
||||
)));
|
||||
}
|
||||
|
||||
_changeDropDown(
|
||||
@@ -32,50 +31,7 @@ class CityOfLivingBloc extends Bloc<CityOfLivingEvent, CityOfLivingState> {
|
||||
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() {
|
||||
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,
|
||||
];
|
||||
}
|
||||
|
||||
///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 {
|
||||
CityOfLivingState({
|
||||
this.selectedDropDownValue,
|
||||
this.selectedDropDownValue1,
|
||||
this.cityController,
|
||||
this.cityOfLivingModelObj,
|
||||
});
|
||||
|
||||
SelectionPopupModel? selectedDropDownValue;
|
||||
|
||||
SelectionPopupModel? selectedDropDownValue1;
|
||||
TextEditingController? cityController;
|
||||
|
||||
CityOfLivingModel? cityOfLivingModelObj;
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
selectedDropDownValue,
|
||||
selectedDropDownValue1,
|
||||
cityController,
|
||||
cityOfLivingModelObj,
|
||||
];
|
||||
CityOfLivingState copyWith({
|
||||
@@ -30,8 +30,7 @@ class CityOfLivingState extends Equatable {
|
||||
return CityOfLivingState(
|
||||
selectedDropDownValue:
|
||||
selectedDropDownValue ?? this.selectedDropDownValue,
|
||||
selectedDropDownValue1:
|
||||
selectedDropDownValue1 ?? this.selectedDropDownValue1,
|
||||
cityController: cityController ?? this.cityController,
|
||||
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) {
|
||||
return CustomTextFormField(
|
||||
controller: enterinformationController,
|
||||
hintText: "enter_information".tr,
|
||||
hintText:
|
||||
"Я занимаюсь плаванием , почти каждый вечер прогулки на свежем воздухе, пару раз в месяц играю в волейбол. Стараюсь не сидеть на месте!",
|
||||
textInputAction: TextInputAction.done,
|
||||
maxLines: 8);
|
||||
})
|
||||
|
||||
@@ -28,6 +28,7 @@ class CustomTextFormField extends StatelessWidget {
|
||||
this.filled = true,
|
||||
this.validator,
|
||||
this.keyboardType,
|
||||
this.onFieldSubmitted,
|
||||
this.onSaved,
|
||||
}) : super(
|
||||
key: key,
|
||||
@@ -56,6 +57,7 @@ class CustomTextFormField extends StatelessWidget {
|
||||
final bool? filled;
|
||||
final TextInputType? keyboardType;
|
||||
final FormFieldValidator<String>? validator;
|
||||
final Function(String)? onFieldSubmitted;
|
||||
final void Function(String?)? onSaved;
|
||||
|
||||
@override
|
||||
@@ -73,6 +75,7 @@ class CustomTextFormField extends StatelessWidget {
|
||||
obscureText: obscureText!,
|
||||
textInputAction: textInputAction,
|
||||
maxLines: maxLines ?? 1,
|
||||
onFieldSubmitted: onFieldSubmitted,
|
||||
decoration: InputDecoration(
|
||||
hintText: hintText ?? "",
|
||||
hintStyle: hintStyle ?? theme.textTheme.bodyLarge,
|
||||
|
||||
Reference in New Issue
Block a user