Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ class _OnboardingSecondPageBodyState extends State<OnboardingSecondPageBody> {
),
),
keyboardType: TextInputType.number,
inputFormatters: [FilteringTextInputFormatter.digitsOnly]),
inputFormatters: [FilteringTextInputFormatter.allow(
RegExp(r'^\d+([.,]\d{0,1})?$'))]),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
Expand Down Expand Up @@ -179,10 +180,16 @@ class _OnboardingSecondPageBodyState extends State<OnboardingSecondPageBody> {
}
}

// receive the user input
String? validateWeight(String? value) {
// if the user input is null, return the error message: Enter correct weight
if (value == null) return S.of(context).onboardingWrongWeightLabel;
if (value.isEmpty || !RegExp(r'^[0-9]').hasMatch(value)) {
return S.of(context).onboardingWrongHeightLabel;
// if the user input is empty, return the error message: Enter correct weight
// if the user input dont start with a number, return the error message: Enter correct weight
if (value.isEmpty || !RegExp(r'^[0-9]+([.,][0-9])?$').hasMatch(value)) {
return S.of(context).onboardingWrongWeightLabel;
} else if (value == '0') {
return S.of(context).onboardingWrongWeightLabelZero;
} else {
return null;
}
Expand Down
2 changes: 2 additions & 0 deletions lib/generated/intl/messages_de.dart
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ class MessageLookup extends MessageLookupByLibrary {
"Geben Sie eine korrekte Größe ein"),
"onboardingWrongWeightLabel": MessageLookupByLibrary.simpleMessage(
"Geben Sie ein korrekte Gewicht ein"),
"onboardingWrongWeightLabelZero":
MessageLookupByLibrary.simpleMessage("Gewicht mag niet 0 zijn"),
"onboardingYourGoalLabel":
MessageLookupByLibrary.simpleMessage("Ihr Kalorienziel:"),
"onboardingYourMacrosGoalLabel": MessageLookupByLibrary.simpleMessage(
Expand Down
2 changes: 2 additions & 0 deletions lib/generated/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Enter correct height"),
"onboardingWrongWeightLabel":
MessageLookupByLibrary.simpleMessage("Enter correct weight"),
"onboardingWrongWeightLabelZero":
MessageLookupByLibrary.simpleMessage("Weight can not be 0"),
"onboardingYourGoalLabel":
MessageLookupByLibrary.simpleMessage("Your calorie goal:"),
"onboardingYourMacrosGoalLabel":
Expand Down
2 changes: 2 additions & 0 deletions lib/generated/intl/messages_tr.dart
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Doğru boy girin"),
"onboardingWrongWeightLabel":
MessageLookupByLibrary.simpleMessage("Doğru kilo girin"),
"onboardingWrongWeightLabelZero":
MessageLookupByLibrary.simpleMessage("Ağırlık 0 olamaz"),
"onboardingYourGoalLabel":
MessageLookupByLibrary.simpleMessage("Kalori hedefiniz:"),
"onboardingYourMacrosGoalLabel":
Expand Down
10 changes: 10 additions & 0 deletions lib/generated/l10n.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/l10n/intl_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"onboardingWeightQuestionSubtitle": "Wie viel wiegen Sie derzeit?",
"onboardingWrongHeightLabel": "Geben Sie eine korrekte Größe ein",
"onboardingWrongWeightLabel": "Geben Sie ein korrekte Gewicht ein",
"onboardingWrongWeightLabelZero": "Gewicht mag niet 0 zijn",
"onboardingWeightExampleHintKg": "z. B. 60",
"onboardingHeightExampleHintCm": "z. B. 170",
"onboardingActivityQuestionSubtitle": "Wie aktiv sind Sie? (Ohne Trainingseinheiten)",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"onboardingWeightQuestionSubtitle": "Whats your current weight?",
"onboardingWrongHeightLabel": "Enter correct height",
"onboardingWrongWeightLabel": "Enter correct weight",
"onboardingWrongWeightLabelZero": "Weight can not be 0",
"onboardingWeightExampleHintKg": "e.g. 60",
"onboardingWeightExampleHintLbs": "e.g. 132",
"onboardingHeightExampleHintCm": "e.g. 170",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/intl_tr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"onboardingWeightQuestionSubtitle": "Mevcut kilonuz nedir?",
"onboardingWrongHeightLabel": "Doğru boy girin",
"onboardingWrongWeightLabel": "Doğru kilo girin",
"onboardingWrongWeightLabelZero": "Ağırlık 0 olamaz",
"onboardingWeightExampleHintKg": "ör. 60",
"onboardingWeightExampleHintLbs": "ör. 132",
"onboardingHeightExampleHintCm": "ör. 170",
Expand Down
Loading
Loading