Merge branch 'new_design_sikander' into development_new_design_2.0

merge-update-with-lab-changes
Sikander Saleem 4 years ago
commit 4dca22bec1

@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.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:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -266,18 +267,19 @@ class _H2oSettingState extends State<H2oSetting> {
SizedBox(height: 12), SizedBox(height: 12),
_containerWidget( _containerWidget(
_commonDropDownView(TranslationBase.of(context).activityLevel, _activityLevelListEng[_selectedActiveLevel - 1], () { _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( showDialog(
context: context, context: context,
child: CommonRadioButtonDialog( child: RadioSelectionDialog(
list: _activityLevelListEng, listData: list,
title: TranslationBase.of(context).activityLevel, selectedIndex: _selectedActiveLevel,
onSelect: (index) { onValueSelected: (index) {
Navigator.pop(context); _selectedActiveLevel = index;
setState(() { setState(() {});
_selectedActiveLevel = index + 1;
});
}, },
selectedIndex: _selectedActiveLevel - 1,
), ),
); );
}), }),
@ -296,17 +298,19 @@ class _H2oSettingState extends State<H2oSetting> {
SizedBox(height: 12), SizedBox(height: 12),
_containerWidget( _containerWidget(
_commonDropDownView(TranslationBase.of(context).reminderTimesLabel, _remindedTimeListEng[_selectedRemindedTime], () { _commonDropDownView(TranslationBase.of(context).reminderTimesLabel, _remindedTimeListEng[_selectedRemindedTime], () {
List<RadioSelectionDialogModel> list = [
for (int i = 0; i < _remindedTimeListEng.length; i++) RadioSelectionDialogModel(_remindedTimeListEng[i], i),
];
showDialog( showDialog(
context: context, context: context,
child: CommonRadioButtonDialog( child: RadioSelectionDialog(
list: _remindedTimeListEng, listData: list,
onSelect: (index) {
Navigator.pop(context);
setState(() {
_selectedRemindedTime = index;
});
},
selectedIndex: _selectedRemindedTime, 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, 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) { if (tag) {
AppToast.showSuccessToast(message: TranslationBase.of(context).success); AppToast.showSuccessToast(message: TranslationBase.of(context).success);
await prefs.setString(H2O_UNIT, _isUnitML ? "ml" : "l"); 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) { if (_tempRemindTime != _selectedRemindedTime) {
await prefs.setInt(H2O_REMINDER, _selectedRemindedTime); await prefs.setInt(H2O_REMINDER, _selectedRemindedTime);
_addReminderToCalender(_selectedRemindedTime); _addReminderToCalender(_selectedRemindedTime);

Loading…
Cancel
Save