|
|
|
|
@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
@ -266,18 +267,19 @@ class _H2oSettingState extends State<H2oSetting> {
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
_containerWidget(
|
|
|
|
|
_commonDropDownView(TranslationBase.of(context).activityLevel, _activityLevelListEng[_selectedActiveLevel - 1], () {
|
|
|
|
|
List<RadioSelectionDialogModel> list = [
|
|
|
|
|
for (int i = 0; i < _activityLevelListEng.length; i++) RadioSelectionDialogModel(_activityLevelListEng[i], i + 1),
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
child: CommonRadioButtonDialog(
|
|
|
|
|
list: _activityLevelListEng,
|
|
|
|
|
title: TranslationBase.of(context).activityLevel,
|
|
|
|
|
onSelect: (index) {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedActiveLevel = index + 1;
|
|
|
|
|
});
|
|
|
|
|
child: RadioSelectionDialog(
|
|
|
|
|
listData: list,
|
|
|
|
|
selectedIndex: _selectedActiveLevel,
|
|
|
|
|
onValueSelected: (index) {
|
|
|
|
|
_selectedActiveLevel = index;
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
selectedIndex: _selectedActiveLevel - 1,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
@ -296,17 +298,19 @@ class _H2oSettingState extends State<H2oSetting> {
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
_containerWidget(
|
|
|
|
|
_commonDropDownView(TranslationBase.of(context).reminderTimesLabel, _remindedTimeListEng[_selectedRemindedTime], () {
|
|
|
|
|
List<RadioSelectionDialogModel> list = [
|
|
|
|
|
for (int i = 0; i < _remindedTimeListEng.length; i++) RadioSelectionDialogModel(_remindedTimeListEng[i], i),
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
child: CommonRadioButtonDialog(
|
|
|
|
|
list: _remindedTimeListEng,
|
|
|
|
|
onSelect: (index) {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedRemindedTime = index;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: RadioSelectionDialog(
|
|
|
|
|
listData: list,
|
|
|
|
|
selectedIndex: _selectedRemindedTime,
|
|
|
|
|
onValueSelected: (index) {
|
|
|
|
|
_selectedRemindedTime = index;
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
@ -493,36 +497,6 @@ class _H2oSettingState extends State<H2oSetting> {
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return Row(children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
height: 40,
|
|
|
|
|
child: RaisedButton(
|
|
|
|
|
color: checkParam ? Theme.of(context).appBarTheme.color : Colors.white,
|
|
|
|
|
child: Text(
|
|
|
|
|
rightText,
|
|
|
|
|
style: TextStyle(color: checkParam ? Colors.white : Theme.of(context).appBarTheme.color, fontWeight: FontWeight.w600),
|
|
|
|
|
),
|
|
|
|
|
onPressed: () => callBack(true),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(width: 12),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
height: 40,
|
|
|
|
|
child: RaisedButton(
|
|
|
|
|
color: !checkParam ? Theme.of(context).appBarTheme.color : Colors.white,
|
|
|
|
|
child: Text(
|
|
|
|
|
leftText,
|
|
|
|
|
style: TextStyle(color: !checkParam ? Colors.white : Theme.of(context).appBarTheme.color, fontWeight: FontWeight.w600),
|
|
|
|
|
),
|
|
|
|
|
onPressed: () => callBack(false),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _commonInputAndUnitRow(_title, _controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange, String unitTitle,
|
|
|
|
|
@ -624,7 +598,7 @@ class _H2oSettingState extends State<H2oSetting> {
|
|
|
|
|
if (tag) {
|
|
|
|
|
AppToast.showSuccessToast(message: TranslationBase.of(context).success);
|
|
|
|
|
await prefs.setString(H2O_UNIT, _isUnitML ? "ml" : "l");
|
|
|
|
|
int _tempRemindTime = prefs.getInt(H2O_REMINDER) ?? _selectedRemindedTime;
|
|
|
|
|
int _tempRemindTime = prefs.getInt(H2O_REMINDER) ?? 0;
|
|
|
|
|
if (_tempRemindTime != _selectedRemindedTime) {
|
|
|
|
|
await prefs.setInt(H2O_REMINDER, _selectedRemindedTime);
|
|
|
|
|
_addReminderToCalender(_selectedRemindedTime);
|
|
|
|
|
|