|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_detail_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/H2O_service.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart';
|
|
|
|
@ -13,6 +14,7 @@ import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/painting.dart';
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
import 'package:flutter/widgets.dart';
|
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
|
|
|
|
|
|
import 'Dialog/setting_page_radio_button_list_dialog.dart';
|
|
|
|
|
|
|
|
|
@ -31,7 +33,7 @@ class _H2oSettingState extends State<H2oSetting> {
|
|
|
|
|
TextEditingController _nameController = TextEditingController();
|
|
|
|
|
TextEditingController _heightController = TextEditingController();
|
|
|
|
|
TextEditingController _weightController = TextEditingController();
|
|
|
|
|
bool _isUnitML = false;
|
|
|
|
|
bool _isUnitML = true;
|
|
|
|
|
bool _isGenderMale = false;
|
|
|
|
|
bool _isHeightCM = false;
|
|
|
|
|
bool _isWeightKG = false;
|
|
|
|
@ -61,6 +63,14 @@ class _H2oSettingState extends State<H2oSetting> {
|
|
|
|
|
_isGenderMale = _userDetailModel.gender == "M" ? true : false;
|
|
|
|
|
_dobDate = DateUtil.convertStringToDate(_userDetailModel.dOB);
|
|
|
|
|
_selectedActiveLevel = _userDetailModel.activityID ?? 1;
|
|
|
|
|
readPrefs();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SharedPreferences prefs;
|
|
|
|
|
void readPrefs() async {
|
|
|
|
|
prefs = await SharedPreferences.getInstance();
|
|
|
|
|
_isUnitML = (prefs.getString(H2O_UNIT) ?? "ml") == "ml" ? true : false;
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@ -68,19 +78,9 @@ class _H2oSettingState extends State<H2oSetting> {
|
|
|
|
|
// TODO: implement didChangeDependencies
|
|
|
|
|
super.didChangeDependencies();
|
|
|
|
|
|
|
|
|
|
_activityLevelListEng = [
|
|
|
|
|
TranslationBase.of(context).notActive,
|
|
|
|
|
TranslationBase.of(context).lightActive,
|
|
|
|
|
TranslationBase.of(context).modActive,
|
|
|
|
|
TranslationBase.of(context).active
|
|
|
|
|
];
|
|
|
|
|
_activityLevelListEng = [TranslationBase.of(context).notActive, TranslationBase.of(context).lightActive, TranslationBase.of(context).modActive, TranslationBase.of(context).active];
|
|
|
|
|
|
|
|
|
|
_remindedTimeListEng = [
|
|
|
|
|
"1 ${TranslationBase.of(context).time}",
|
|
|
|
|
"2 ${TranslationBase.of(context).times}",
|
|
|
|
|
"3 ${TranslationBase.of(context).times}",
|
|
|
|
|
"4 ${TranslationBase.of(context).times}"
|
|
|
|
|
];
|
|
|
|
|
_remindedTimeListEng = ["1 ${TranslationBase.of(context).time}", "2 ${TranslationBase.of(context).times}", "3 ${TranslationBase.of(context).times}", "4 ${TranslationBase.of(context).times}"];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@ -339,8 +339,7 @@ class _H2oSettingState extends State<H2oSetting> {
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _commonSlidersRow(
|
|
|
|
|
_controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange) {
|
|
|
|
|
Widget _commonSlidersRow(_controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange) {
|
|
|
|
|
return Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 6),
|
|
|
|
|
padding: EdgeInsets.all(6),
|
|
|
|
@ -451,6 +450,7 @@ class _H2oSettingState extends State<H2oSetting> {
|
|
|
|
|
_userDetailModel.dOB = tempDate;
|
|
|
|
|
_userDetailModel.activityID = _selectedActiveLevel;
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await prefs.setString(H2O_UNIT, _isUnitML ? "ml" : "l");
|
|
|
|
|
await widget.viewModel.updateUserDetail(_userDetailModel, (tag) {
|
|
|
|
|
if (tag) {
|
|
|
|
|
AppToast.showSuccessToast(message: TranslationBase.of(context).success);
|
|
|
|
|