refactor: add intl localization

This commit is contained in:
mso7nueh
2024-09-11 17:39:00 +03:00
parent 69472f422e
commit 6c69bbbf41
29 changed files with 1468 additions and 312 deletions

View File

@@ -2,7 +2,7 @@ import 'dart:convert';
import 'package:eatvio_app/core/const.dart';
import 'package:eatvio_app/core/token_storage.dart';
import 'package:eatvio_app/localization/app_localization.dart';
import 'package:eatvio_app/generated/l10n.dart';
import 'package:eatvio_app/old/profile/my_profile_screen/bloc/my_profile_bloc.dart';
import 'package:eatvio_app/theme/custom_button_style.dart';
import 'package:eatvio_app/widgets/custom_hyper_switch.dart';
@@ -87,6 +87,7 @@ class _ExpandableListState extends State<ExpandableList> {
}
_buildForm(BuildContext context, MyProfileLoadedState state) {
final s = S.of(context);
List<String> cities = [
'Москва',
'Санкт-Петербург',
@@ -134,14 +135,14 @@ class _ExpandableListState extends State<ExpandableList> {
children: [
TextField(
controller: state.firstNameFormController,
decoration: InputDecoration(labelText: 'first_name'.tr),
decoration: InputDecoration(labelText: s.first_name),
),
TextField(
controller: state.lastNameFormController,
decoration: InputDecoration(labelText: 'last_name'.tr),
decoration: InputDecoration(labelText: s.last_name),
),
TextField(
decoration: InputDecoration(labelText: 'date_of_birth'.tr),
decoration: InputDecoration(labelText: s.date_of_birth),
controller: state.dateFormController,
onTap: inputTime(context, state),
),
@@ -155,7 +156,7 @@ class _ExpandableListState extends State<ExpandableList> {
child: Text(value),
);
}).toList(),
decoration: InputDecoration(labelText: 'country'.tr),
decoration: InputDecoration(labelText: s.country),
),
DropdownButtonFormField<String>(
hint: Text(state.selectedCity ?? "Не выбрано"),
@@ -167,78 +168,78 @@ class _ExpandableListState extends State<ExpandableList> {
child: Text(value),
);
}).toList(),
decoration: InputDecoration(labelText: 'city_of_living'.tr),
decoration: InputDecoration(labelText: s.city_of_living),
),
TextField(
controller: state.weightFormController,
decoration: InputDecoration(labelText: 'weight_measurements'.tr),
decoration: InputDecoration(labelText: s.weight_measurements),
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[digitsOnly],
),
TextField(
controller: state.heightFormController,
decoration: InputDecoration(labelText: 'height_measurements'.tr),
decoration: InputDecoration(labelText: s.height_measurements),
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[digitsOnly],
),
TextField(
controller: state.chestCircumferenceFormController,
decoration: InputDecoration(labelText: 'chest_circumference'.tr),
decoration: InputDecoration(labelText: s.chest_circumference),
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[digitsOnly],
),
TextField(
controller: state.waistCircumferenceFormController,
decoration: InputDecoration(labelText: 'waist_circumference'.tr),
decoration: InputDecoration(labelText: s.waist_circumference),
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[digitsOnly],
),
TextField(
controller: state.hipCircumferenceFormController,
decoration: InputDecoration(labelText: 'hip_circumference'.tr),
decoration: InputDecoration(labelText: s.hip_circumference),
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[digitsOnly],
),
TextField(
controller: state.upPressureFormController,
decoration: InputDecoration(labelText: 'up_pressure'.tr),
decoration: InputDecoration(labelText: s.up_pressure),
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[digitsOnly],
),
TextField(
controller: state.downPressureFormController,
decoration: InputDecoration(labelText: 'down_pressure'.tr),
decoration: InputDecoration(labelText: s.down_pressure),
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[digitsOnly],
),
TextField(
controller: state.allergiesFormController,
decoration: InputDecoration(labelText: 'allergies_presence'.tr),
decoration: InputDecoration(labelText: s.allergies_presence),
maxLines: null,
),
TextField(
controller: state.pillsFormController,
decoration: InputDecoration(labelText: 'do_you_take_pills'.tr),
decoration: InputDecoration(labelText: s.do_you_take_pills),
maxLines: null,
),
TextField(
controller: state.sportsFormController,
decoration: InputDecoration(labelText: 'your_favorite_sports'.tr),
decoration: InputDecoration(labelText: s.your_favorite_sports),
maxLines: null,
),
TextField(
controller: state.favoriteFormController,
decoration: InputDecoration(labelText: 'favorite_foods'.tr),
decoration: InputDecoration(labelText: s.favorite_foods),
maxLines: null,
),
TextField(
controller: state.unfavoriteFormController,
decoration: InputDecoration(labelText: 'unfavorite_foods'.tr),
decoration: InputDecoration(labelText: s.unfavorite_foods),
maxLines: null,
),
TextField(
controller: state.additionalFormController,
decoration: InputDecoration(labelText: 'additional_information'.tr),
decoration: InputDecoration(labelText: s.additional_information),
maxLines: null,
),
DropdownButtonFormField<String>(
@@ -261,18 +262,18 @@ class _ExpandableListState extends State<ExpandableList> {
),
Row(
children: [
HypoSwitch('do_you_have_hypotension_tendency'.tr, state),
HypoSwitch(s.do_you_have_hypotension_tendency, state),
],
),
Row(
children: [
HyperSwitch('do_you_have_hypertension_tendency'.tr, state),
HyperSwitch(s.do_you_have_hypertension_tendency, state),
],
),
NextStepButton(
onPressed: () => sendProfileData(state),
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
text: "save".tr.toUpperCase(),
text: s.save.toUpperCase(),
margin: EdgeInsets.only(top: 20, bottom: 20),
),
],