|
|
|
|
@ -42,37 +42,27 @@ class _CarbsState extends State<Carbs> {
|
|
|
|
|
double? fCalMeal;
|
|
|
|
|
|
|
|
|
|
void calculateDietRatios() {
|
|
|
|
|
if (dropdownValue == TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.dietVeryLow) {
|
|
|
|
|
if (dropdownValue == TranslationBase.of(context).dietVeryLow) {
|
|
|
|
|
meals = 3;
|
|
|
|
|
protein = 45;
|
|
|
|
|
carbs = 10;
|
|
|
|
|
fat = 45;
|
|
|
|
|
} else if (dropdownValue == TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.dietLow) {
|
|
|
|
|
} else if (dropdownValue == TranslationBase.of(context).dietLow) {
|
|
|
|
|
meals = 3;
|
|
|
|
|
protein = 40;
|
|
|
|
|
carbs = 30;
|
|
|
|
|
fat = 30;
|
|
|
|
|
} else if (dropdownValue == TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.dietModerate) {
|
|
|
|
|
} else if (dropdownValue == TranslationBase.of(context).dietModerate) {
|
|
|
|
|
meals = 3;
|
|
|
|
|
protein = 25;
|
|
|
|
|
carbs = 50;
|
|
|
|
|
fat = 25;
|
|
|
|
|
} else if (dropdownValue == TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.dietUSDA) {
|
|
|
|
|
} else if (dropdownValue == TranslationBase.of(context).dietUSDA) {
|
|
|
|
|
meals = 3;
|
|
|
|
|
protein = 15;
|
|
|
|
|
carbs = 55;
|
|
|
|
|
fat = 30;
|
|
|
|
|
} else if (dropdownValue == TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.dietZone) {
|
|
|
|
|
} else if (dropdownValue == TranslationBase.of(context).dietZone) {
|
|
|
|
|
meals = 3;
|
|
|
|
|
protein = 30;
|
|
|
|
|
carbs = 40;
|
|
|
|
|
@ -98,17 +88,13 @@ class _CarbsState extends State<Carbs> {
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
|
|
|
|
|
|
dropdownValue = TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.dietVeryLow;
|
|
|
|
|
dropdownValue = TranslationBase.of(context).dietVeryLow;
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
isShowDecPage: false,
|
|
|
|
|
showNewAppBarTitle: true,
|
|
|
|
|
showNewAppBar: true,
|
|
|
|
|
appBarTitle: TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.carbohydrate,
|
|
|
|
|
appBarTitle: TranslationBase.of(context).carbohydrate,
|
|
|
|
|
appBarIcons: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 7.0),
|
|
|
|
|
@ -128,9 +114,7 @@ class _CarbsState extends State<Carbs> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.carbProteinDesc,
|
|
|
|
|
TranslationBase.of(context).carbProteinDesc,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
@ -145,9 +129,7 @@ class _CarbsState extends State<Carbs> {
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
inputWidget(TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.calDay, "0", textController),
|
|
|
|
|
inputWidget(TranslationBase.of(context).calDay, "0", textController),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
@ -158,14 +140,8 @@ class _CarbsState extends State<Carbs> {
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(12.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.notSure,
|
|
|
|
|
style: TextStyle(fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
letterSpacing: -0.56,
|
|
|
|
|
color: CustomColors.accentColor,
|
|
|
|
|
decoration: TextDecoration.underline),
|
|
|
|
|
TranslationBase.of(context).notSure,
|
|
|
|
|
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.56, color: CustomColors.accentColor, decoration: TextDecoration.underline),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
@ -190,9 +166,7 @@ class _CarbsState extends State<Carbs> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.selectDiet,
|
|
|
|
|
TranslationBase.of(context).selectDiet,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 11,
|
|
|
|
|
letterSpacing: -0.44,
|
|
|
|
|
@ -221,21 +195,11 @@ class _CarbsState extends State<Carbs> {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
items: <String>[
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.dietVeryLow,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.dietLow,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.dietModerate,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.dietUSDA,
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.dietZone
|
|
|
|
|
TranslationBase.of(context).dietVeryLow,
|
|
|
|
|
TranslationBase.of(context).dietLow,
|
|
|
|
|
TranslationBase.of(context).dietModerate,
|
|
|
|
|
TranslationBase.of(context).dietUSDA,
|
|
|
|
|
TranslationBase.of(context).dietZone
|
|
|
|
|
].map<DropdownMenuItem<String>>((String value) {
|
|
|
|
|
return DropdownMenuItem<String>(
|
|
|
|
|
value: value,
|
|
|
|
|
@ -269,9 +233,7 @@ class _CarbsState extends State<Carbs> {
|
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: SecondaryButton(
|
|
|
|
|
label: TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.calculate,
|
|
|
|
|
label: TranslationBase.of(context).calculate,
|
|
|
|
|
color: CustomColors.accentColor,
|
|
|
|
|
onTap: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
@ -346,7 +308,8 @@ class _CarbsState extends State<Carbs> {
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget inputWidget(String _labelText,
|
|
|
|
|
Widget inputWidget(
|
|
|
|
|
String _labelText,
|
|
|
|
|
String _hintText,
|
|
|
|
|
TextEditingController? _controller, {
|
|
|
|
|
Function(String?)? onChange,
|
|
|
|
|
@ -369,7 +332,7 @@ Widget inputWidget(String _labelText,
|
|
|
|
|
Function(bool)? onCalendarTypeChanged,
|
|
|
|
|
EdgeInsetsGeometry? padding,
|
|
|
|
|
String lang = 'en',
|
|
|
|
|
}) {
|
|
|
|
|
}) {
|
|
|
|
|
return Builder(
|
|
|
|
|
builder: (context) {
|
|
|
|
|
final isRtl = Directionality.of(context) == TextDirection.rtl;
|
|
|
|
|
@ -446,8 +409,7 @@ Widget inputWidget(String _labelText,
|
|
|
|
|
),
|
|
|
|
|
items: dropdownItems
|
|
|
|
|
?.map(
|
|
|
|
|
(e) =>
|
|
|
|
|
PopupMenuItem<String>(
|
|
|
|
|
(e) => PopupMenuItem<String>(
|
|
|
|
|
value: e,
|
|
|
|
|
child: Text(e),
|
|
|
|
|
),
|
|
|
|
|
@ -630,25 +592,20 @@ Widget newInputWidget(
|
|
|
|
|
bool autoFocus = false,
|
|
|
|
|
Function(Country)? onCountryChange,
|
|
|
|
|
Key? key,
|
|
|
|
|
}) {
|
|
|
|
|
}) {
|
|
|
|
|
return Builder(
|
|
|
|
|
builder: (context) {
|
|
|
|
|
// final isRtl = Directionality.of(context) == TextDirection.ltr;
|
|
|
|
|
return Container(
|
|
|
|
|
padding: padding,
|
|
|
|
|
// padding: removePadding && isAllowLeadingIcon && prefix == null
|
|
|
|
|
// ? const EdgeInsets.only(top: 8, bottom: 8, left: 8, right: 8)
|
|
|
|
|
// : removePadding && !hasSelection
|
|
|
|
|
// ? const EdgeInsets.only(top: 8, bottom: 8, left: 0, right: 0)
|
|
|
|
|
// : removePadding && hasSelection
|
|
|
|
|
// ? null
|
|
|
|
|
// : const EdgeInsets.symmetric(horizontal: 16, vertical: 15),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: isAllowRadius ? BorderRadius.circular(15) : null,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
border: isBorderAllowed ? Border.all(color: const Color(0xffefefef), width: 1) : null,
|
|
|
|
|
),
|
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
|
// borderRadius: isAllowRadius ? BorderRadius.circular(15) : null,
|
|
|
|
|
// color: Colors.white,
|
|
|
|
|
// border: isBorderAllowed ? Border.all(color: const Color(0xffefefef), width: 1) : null,
|
|
|
|
|
// ),
|
|
|
|
|
decoration: RoundedRectangleBorder()
|
|
|
|
|
.toSmoothCornerDecoration(color: Colors.white, borderRadius: isAllowRadius ? 15 : null, side: isBorderAllowed ? BorderSide(color: const Color(0xffefefef), width: 1) : null),
|
|
|
|
|
child: Row(
|
|
|
|
|
textDirection: Directionality.of(context),
|
|
|
|
|
children: [
|
|
|
|
|
@ -776,6 +733,7 @@ Widget newInputWidget(
|
|
|
|
|
: null,
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Text((selectedValue == null || selectedValue.isEmpty) ? _hintText : selectedValue,
|
|
|
|
|
@ -1107,8 +1065,7 @@ Widget newInputWidget(
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
extension BorderedContainer on Widget {
|
|
|
|
|
Widget get withBorderedContainer =>
|
|
|
|
|
Container(
|
|
|
|
|
Widget get withBorderedContainer => Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
@ -1181,8 +1138,7 @@ class __CustomCountryDropdownState extends State<_CustomCountryDropdown> {
|
|
|
|
|
Offset offset = renderBox.localToGlobal(Offset.zero);
|
|
|
|
|
|
|
|
|
|
_overlayEntry = OverlayEntry(
|
|
|
|
|
builder: (context) =>
|
|
|
|
|
Stack(
|
|
|
|
|
builder: (context) => Stack(
|
|
|
|
|
children: [
|
|
|
|
|
// Dismiss dropdown when tapping outside
|
|
|
|
|
Positioned.fill(
|
|
|
|
|
@ -1211,8 +1167,7 @@ class __CustomCountryDropdownState extends State<_CustomCountryDropdown> {
|
|
|
|
|
child: Column(
|
|
|
|
|
children: widget.countryList
|
|
|
|
|
.map(
|
|
|
|
|
(country) =>
|
|
|
|
|
GestureDetector(
|
|
|
|
|
(country) => GestureDetector(
|
|
|
|
|
onTap: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
selectedCountry = country;
|
|
|
|
|
@ -1481,8 +1436,7 @@ class _NewInputFieldState extends State<NewInputField> {
|
|
|
|
|
),
|
|
|
|
|
items: widget.dropdownItems
|
|
|
|
|
?.map(
|
|
|
|
|
(e) =>
|
|
|
|
|
PopupMenuItem<String>(
|
|
|
|
|
(e) => PopupMenuItem<String>(
|
|
|
|
|
value: e,
|
|
|
|
|
child: Text(e),
|
|
|
|
|
),
|
|
|
|
|
@ -1570,7 +1524,7 @@ class _NewInputFieldState extends State<NewInputField> {
|
|
|
|
|
textAlignVertical: TextAlignVertical.top,
|
|
|
|
|
textAlign: TextAlign.left,
|
|
|
|
|
textDirection: TextDirection.ltr,
|
|
|
|
|
onChanged:_handleOnChange,
|
|
|
|
|
onChanged: _handleOnChange,
|
|
|
|
|
focusNode: _internalFocusNode,
|
|
|
|
|
autofocus: widget.autoFocus,
|
|
|
|
|
style: context.dynamicTextStyle(
|
|
|
|
|
@ -1617,4 +1571,3 @@ class _NewInputFieldState extends State<NewInputField> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|