forked from eatvio/eatvio_app
updated designe of aboute diet page
This commit is contained in:
43
lib/core/utils/localization_utils.dart
Normal file
43
lib/core/utils/localization_utils.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
|
||||
String getLocalizedMeasurementUnits(S s, Portion portion) {
|
||||
switch (portion) {
|
||||
case Portion.GRAMS:
|
||||
return s.gr;
|
||||
case Portion.MILLILITERS:
|
||||
return s.milliliter;
|
||||
case Portion.PCS:
|
||||
return s.pcs;
|
||||
}
|
||||
}
|
||||
|
||||
String getDayForm(int number, S s) {
|
||||
if (number % 100 >= 11 && number % 100 <= 14) {
|
||||
return s.days;
|
||||
}
|
||||
|
||||
int lastDigit = number % 10;
|
||||
if (lastDigit == 1) {
|
||||
return s.day.toLowerCase();
|
||||
} else if (lastDigit >= 2 && lastDigit <= 4) {
|
||||
return s.another_form_of_day;
|
||||
} else {
|
||||
return s.days;
|
||||
}
|
||||
}
|
||||
|
||||
String getCommentForm(int number, S s) {
|
||||
if (number % 100 >= 11 && number % 100 <= 14) {
|
||||
return s.comments_plural;
|
||||
}
|
||||
|
||||
int lastDigit = number % 10;
|
||||
if (lastDigit == 1) {
|
||||
return s.comment;
|
||||
} else if (lastDigit >= 2 && lastDigit <= 4) {
|
||||
return s.another_form_of_comment;
|
||||
} else {
|
||||
return s.comments_plural;
|
||||
}
|
||||
}
|
||||
9
lib/core/utils/string_extentions.dart
Normal file
9
lib/core/utils/string_extentions.dart
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
|
||||
extension Capitalization on String {
|
||||
|
||||
String capitalize() {
|
||||
return "${this[0].toUpperCase()}${substring(1).toLowerCase()}";
|
||||
}
|
||||
}
|
||||
15
lib/core/utils/toasts.dart
Normal file
15
lib/core/utils/toasts.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
import 'package:eatvio_app/theme/theme_helper.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
|
||||
const int _toastDuration = 2;
|
||||
|
||||
void showInfoToast(String message) {
|
||||
Fluttertoast.showToast(
|
||||
msg: message,
|
||||
toastLength: Toast.LENGTH_SHORT,
|
||||
gravity: ToastGravity.TOP,
|
||||
timeInSecForIosWeb: _toastDuration,
|
||||
backgroundColor: appTheme.blueA400,
|
||||
textColor: appTheme.whiteA700,
|
||||
fontSize: 16.0);
|
||||
}
|
||||
Reference in New Issue
Block a user