|
|
|
|
@ -1,9 +1,6 @@
|
|
|
|
|
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';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
|
@ -23,6 +20,7 @@ import 'Dialog/setting_page_radio_button_list_dialog.dart';
|
|
|
|
|
class H2oSetting extends StatefulWidget {
|
|
|
|
|
final UserDetailModel userDetailModel;
|
|
|
|
|
final H2OViewModel viewModel;
|
|
|
|
|
|
|
|
|
|
H2oSetting({Key key, this.userDetailModel, this.viewModel}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@ -35,6 +33,9 @@ class _H2oSettingState extends State<H2oSetting> {
|
|
|
|
|
TextEditingController _nameController = TextEditingController();
|
|
|
|
|
TextEditingController _heightController = TextEditingController();
|
|
|
|
|
TextEditingController _weightController = TextEditingController();
|
|
|
|
|
List<PopupMenuItem> _weightPopupList = List();
|
|
|
|
|
List<PopupMenuItem> _heightPopupList = List();
|
|
|
|
|
|
|
|
|
|
bool _isUnitML = true;
|
|
|
|
|
bool _isGenderMale = false;
|
|
|
|
|
bool _isHeightCM = false;
|
|
|
|
|
@ -69,6 +70,7 @@ class _H2oSettingState extends State<H2oSetting> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SharedPreferences prefs;
|
|
|
|
|
|
|
|
|
|
void readPrefs() async {
|
|
|
|
|
prefs = await SharedPreferences.getInstance();
|
|
|
|
|
_isUnitML = (prefs.getString(H2O_UNIT) ?? "ml") == "ml" ? true : false;
|
|
|
|
|
@ -93,6 +95,9 @@ class _H2oSettingState extends State<H2oSetting> {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
_weightPopupList = <PopupMenuItem>[PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)];
|
|
|
|
|
_heightPopupList = <PopupMenuItem>[PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)];
|
|
|
|
|
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
appBarTitle: TranslationBase.of(context).h2o,
|
|
|
|
|
@ -109,30 +114,31 @@ class _H2oSettingState extends State<H2oSetting> {
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
inputWidget(TranslationBase.of(context).enterNameHere, TranslationBase.of(context).enterNameHere, _nameController),
|
|
|
|
|
// TextField(
|
|
|
|
|
// controller: _nameController,
|
|
|
|
|
// decoration: InputDecoration(
|
|
|
|
|
// labelText: TranslationBase.of(context).enterNameHere,
|
|
|
|
|
// labelStyle: TextStyle(color: Colors.black87),
|
|
|
|
|
// fillColor: Colors.white,
|
|
|
|
|
// filled: true,
|
|
|
|
|
// border: UnderlineInputBorder(
|
|
|
|
|
// borderSide: BorderSide(
|
|
|
|
|
// width: 0,
|
|
|
|
|
// style: BorderStyle.none,
|
|
|
|
|
// ),
|
|
|
|
|
// borderRadius: BorderRadius.circular(6.0),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).enterDetailBelow,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 19,
|
|
|
|
|
height: 23 / 19,
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
color: Color(0xff2E303A),
|
|
|
|
|
letterSpacing: -1.14,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
_containerWidget(inputWidget(TranslationBase.of(context).enterNameHere, TranslationBase.of(context).name, _nameController)),
|
|
|
|
|
SizedBox(height: 16),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).preferredunit,
|
|
|
|
|
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
height: 21 / 14,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Color(0xff2B353E),
|
|
|
|
|
letterSpacing: -0.44,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
_commonButtonsRow(TranslationBase.of(context).ml, TranslationBase.of(context).l, _isUnitML, (value) {
|
|
|
|
|
_commonRadioButtonsRow(TranslationBase.of(context).mililitre, TranslationBase.of(context).litre, _isUnitML, (value) {
|
|
|
|
|
if (_isUnitML != value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_isUnitML = value;
|
|
|
|
|
@ -142,175 +148,157 @@ class _H2oSettingState extends State<H2oSetting> {
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).pleaseSelectGender,
|
|
|
|
|
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
height: 21 / 14,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Color(0xff2B353E),
|
|
|
|
|
letterSpacing: -0.44,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
_commonButtonsRow(TranslationBase.of(context).male, TranslationBase.of(context).female, _isGenderMale, (value) {
|
|
|
|
|
_commonRadioButtonsRow(TranslationBase.of(context).male, TranslationBase.of(context).female, _isGenderMale, (value) {
|
|
|
|
|
if (_isGenderMale != value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_isGenderMale = value;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
Text(TranslationBase.of(context).height),
|
|
|
|
|
_commonSlidersRow(_heightController, 1, 270, _heightValue, (text) {
|
|
|
|
|
_heightController.text = text;
|
|
|
|
|
}, (value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_heightValue = value;
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
SizedBox(height: 8),
|
|
|
|
|
Text(TranslationBase.of(context).heightUnit),
|
|
|
|
|
SizedBox(height: 8),
|
|
|
|
|
_commonButtonsRow(TranslationBase.of(context).cm, TranslationBase.of(context).ft, _isHeightCM, (value) {
|
|
|
|
|
if (_isHeightCM != value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_isHeightCM = value;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
SizedBox(height: 8),
|
|
|
|
|
_commonSlidersRow(_weightController, 1, 250, _weightValue, (text) {
|
|
|
|
|
_weightController.text = text;
|
|
|
|
|
}, (value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_weightValue = value;
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
SizedBox(height: 8),
|
|
|
|
|
Text(TranslationBase.of(context).weightUnit),
|
|
|
|
|
SizedBox(height: 8),
|
|
|
|
|
_commonButtonsRow(TranslationBase.of(context).kg, TranslationBase.of(context).lb, _isWeightKG, (value) {
|
|
|
|
|
if (_isWeightKG != value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_isWeightKG = value;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(top: 8.0, bottom: 8.0),
|
|
|
|
|
child: Divider(height: 1.5, color: Colors.black54),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.all(8),
|
|
|
|
|
width: MediaQuery.of(context).size.width,
|
|
|
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(8), color: Colors.white),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text("${TranslationBase.of(context).birth_date}:"),
|
|
|
|
|
SizedBox(height: 8),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
showModalBottomSheet(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (context) {
|
|
|
|
|
return Container(
|
|
|
|
|
height: 250,
|
|
|
|
|
padding: EdgeInsets.all(8),
|
|
|
|
|
child: Column(children: [
|
|
|
|
|
Container(
|
|
|
|
|
height: 40,
|
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
|
child: Row(mainAxisSize: MainAxisSize.min, children: [
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () => Navigator.pop(context),
|
|
|
|
|
child: Container(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
padding: EdgeInsets.fromLTRB(8, 4, 8, 4),
|
|
|
|
|
child: Text(TranslationBase.of(context).cancel),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(width: 8),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
setState(() {
|
|
|
|
|
_dobDate = _tempDate;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
padding: EdgeInsets.fromLTRB(8, 4, 8, 4),
|
|
|
|
|
child: Text(TranslationBase.of(context).ok),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width,
|
|
|
|
|
child: CupertinoDatePicker(
|
|
|
|
|
initialDateTime: _dobDate,
|
|
|
|
|
mode: CupertinoDatePickerMode.date,
|
|
|
|
|
onDateTimeChanged: (_date) {
|
|
|
|
|
_tempDate = _date;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
]),
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}, // implement cupertino dialog to select date
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [Text(DateUtil.getFormattedDate(_dobDate, "yyyy-MM-dd")), Icon(Icons.arrow_drop_down_outlined)]),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 8),
|
|
|
|
|
_commonDialogSelectorRow(TranslationBase.of(context).activityLevel, _activityLevelListEng[_selectedActiveLevel - 1], () {
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
child: CommonRadioButtonDialog(
|
|
|
|
|
list: _activityLevelListEng,
|
|
|
|
|
title: TranslationBase.of(context).activityLevel,
|
|
|
|
|
onSelect: (index) {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
SizedBox(height: 18),
|
|
|
|
|
_commonInputAndUnitRow(
|
|
|
|
|
TranslationBase.of(context).height,
|
|
|
|
|
_heightController,
|
|
|
|
|
1,
|
|
|
|
|
270,
|
|
|
|
|
_heightValue,
|
|
|
|
|
(text) {
|
|
|
|
|
_heightController.text = text;
|
|
|
|
|
},
|
|
|
|
|
(value) {
|
|
|
|
|
_heightValue = value;
|
|
|
|
|
},
|
|
|
|
|
_isHeightCM ? TranslationBase.of(context).cm : TranslationBase.of(context).ft,
|
|
|
|
|
(value) {
|
|
|
|
|
if (_isHeightCM != value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedActiveLevel = index + 1;
|
|
|
|
|
_isHeightCM = value;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
selectedIndex: _selectedActiveLevel - 1,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
SizedBox(height: 8),
|
|
|
|
|
_commonDialogSelectorRow(TranslationBase.of(context).reminderLabel, _remindedTimeListEng[_selectedRemindedTime], () {
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
child: CommonRadioButtonDialog(
|
|
|
|
|
list: _remindedTimeListEng,
|
|
|
|
|
onSelect: (index) {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
_heightPopupList),
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
_commonInputAndUnitRow(
|
|
|
|
|
TranslationBase.of(context).weight,
|
|
|
|
|
_weightController,
|
|
|
|
|
1,
|
|
|
|
|
250,
|
|
|
|
|
_weightValue,
|
|
|
|
|
(text) {
|
|
|
|
|
_heightController.text = text;
|
|
|
|
|
},
|
|
|
|
|
(value) {
|
|
|
|
|
_weightValue = value;
|
|
|
|
|
},
|
|
|
|
|
_isWeightKG ? TranslationBase.of(context).kg : TranslationBase.of(context).lb,
|
|
|
|
|
(value) {
|
|
|
|
|
if (_isWeightKG != value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedRemindedTime = index;
|
|
|
|
|
_isWeightKG = value;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
selectedIndex: _selectedRemindedTime,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
SizedBox(height: 16),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 50,
|
|
|
|
|
width: MediaQuery.of(context).size.width,
|
|
|
|
|
child: FlatButton(
|
|
|
|
|
color: Theme.of(context).appBarTheme.color,
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
|
|
|
),
|
|
|
|
|
onPressed: _updateUserDetails,
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).save,
|
|
|
|
|
style: TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.w600),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
_weightPopupList),
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
_containerWidget(
|
|
|
|
|
_commonDropDownView(TranslationBase.of(context).dateOfBirth, DateUtil.getFormattedDate(_dobDate, "dd MMMM, yyyy"), () {
|
|
|
|
|
showModalBottomSheet(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (context) {
|
|
|
|
|
return Container(
|
|
|
|
|
height: 250,
|
|
|
|
|
padding: EdgeInsets.all(8),
|
|
|
|
|
child: Column(children: [
|
|
|
|
|
Container(
|
|
|
|
|
height: 40,
|
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
|
child: Row(mainAxisSize: MainAxisSize.min, children: [
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () => Navigator.pop(context),
|
|
|
|
|
child: Container(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
padding: EdgeInsets.fromLTRB(8, 4, 8, 4),
|
|
|
|
|
child: Text(TranslationBase.of(context).cancel),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(width: 8),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
setState(() {
|
|
|
|
|
_dobDate = _tempDate;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
padding: EdgeInsets.fromLTRB(8, 4, 8, 4),
|
|
|
|
|
child: Text(TranslationBase.of(context).ok),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width,
|
|
|
|
|
child: CupertinoDatePicker(
|
|
|
|
|
initialDateTime: _dobDate,
|
|
|
|
|
mode: CupertinoDatePickerMode.date,
|
|
|
|
|
onDateTimeChanged: (_date) {
|
|
|
|
|
_tempDate = _date;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
]),
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}, iconData: Icons.calendar_today),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
_containerWidget(
|
|
|
|
|
_commonDropDownView(TranslationBase.of(context).activityLevel, _activityLevelListEng[_selectedActiveLevel - 1], () {
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
child: CommonRadioButtonDialog(
|
|
|
|
|
list: _activityLevelListEng,
|
|
|
|
|
title: TranslationBase.of(context).activityLevel,
|
|
|
|
|
onSelect: (index) {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedActiveLevel = index + 1;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
selectedIndex: _selectedActiveLevel - 1,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
_containerWidget(
|
|
|
|
|
_commonDropDownView(TranslationBase.of(context).reminderLabel, _remindedTimeListEng[_selectedRemindedTime], () {
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
child: CommonRadioButtonDialog(
|
|
|
|
|
list: _remindedTimeListEng,
|
|
|
|
|
onSelect: (index) {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedRemindedTime = index;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
selectedIndex: _selectedRemindedTime,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -330,7 +318,7 @@ class _H2oSettingState extends State<H2oSetting> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) {
|
|
|
|
|
Widget _containerWidget(Widget child) {
|
|
|
|
|
return Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
@ -342,89 +330,159 @@ class _H2oSettingState extends State<H2oSetting> {
|
|
|
|
|
width: 1,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: hasSelection ? () {} : null,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
_labelText,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 11,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Color(0xff2B353E),
|
|
|
|
|
letterSpacing: -0.44,
|
|
|
|
|
),
|
|
|
|
|
child: child,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _commonDropDownView(String title, String value, VoidCallback callback, {IconData iconData}) {
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: callback,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
|
|
|
|
Text(
|
|
|
|
|
title,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Color(0xff2E303A),
|
|
|
|
|
letterSpacing: -0.44,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
value,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
color: Color(0xff575757),
|
|
|
|
|
letterSpacing: -0.56,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
Icon(
|
|
|
|
|
iconData ?? Icons.keyboard_arrow_down_sharp,
|
|
|
|
|
color: Color(0xff2E303A),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) {
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: hasSelection ? () {} : null,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
_labelText,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Color(0xff2E303A),
|
|
|
|
|
letterSpacing: -0.44,
|
|
|
|
|
),
|
|
|
|
|
TextField(
|
|
|
|
|
enabled: isEnable,
|
|
|
|
|
scrollPadding: EdgeInsets.zero,
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
controller: _controller,
|
|
|
|
|
onChanged: (value) => {
|
|
|
|
|
// validateForm()
|
|
|
|
|
},
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
),
|
|
|
|
|
TextField(
|
|
|
|
|
enabled: isEnable,
|
|
|
|
|
scrollPadding: EdgeInsets.zero,
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
controller: _controller,
|
|
|
|
|
onChanged: (value) => {
|
|
|
|
|
// validateForm()
|
|
|
|
|
},
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
height: 21 / 14,
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
color: Color(0xff575757),
|
|
|
|
|
letterSpacing: -0.56,
|
|
|
|
|
),
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
isDense: true,
|
|
|
|
|
hintText: _hintText,
|
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
height: 21 / 14,
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
color: Color(0xff2B353E),
|
|
|
|
|
letterSpacing: -0.44,
|
|
|
|
|
color: Color(0xff575757),
|
|
|
|
|
letterSpacing: -0.56,
|
|
|
|
|
),
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
isDense: true,
|
|
|
|
|
hintText: _hintText,
|
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
height: 21 / 14,
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
color: Color(0xff575757),
|
|
|
|
|
letterSpacing: -0.56,
|
|
|
|
|
),
|
|
|
|
|
prefixIconConstraints: BoxConstraints(minWidth: 50),
|
|
|
|
|
prefixIcon: prefix == null
|
|
|
|
|
? null
|
|
|
|
|
: Text(
|
|
|
|
|
"+" + prefix,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
height: 21 / 14,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
color: Color(0xff2E303A),
|
|
|
|
|
letterSpacing: -0.56,
|
|
|
|
|
),
|
|
|
|
|
prefixIconConstraints: BoxConstraints(minWidth: 50),
|
|
|
|
|
prefixIcon: prefix == null
|
|
|
|
|
? null
|
|
|
|
|
: Text(
|
|
|
|
|
"+" + prefix,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
height: 21 / 14,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
color: Color(0xff2E303A),
|
|
|
|
|
letterSpacing: -0.56,
|
|
|
|
|
),
|
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
|
border: InputBorder.none,
|
|
|
|
|
focusedBorder: InputBorder.none,
|
|
|
|
|
enabledBorder: InputBorder.none,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
|
border: InputBorder.none,
|
|
|
|
|
focusedBorder: InputBorder.none,
|
|
|
|
|
enabledBorder: InputBorder.none,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _commonButtonsRow(String rightText, String leftText, bool checkParam, Function(bool) callBack) {
|
|
|
|
|
|
|
|
|
|
Widget _commonRadioButtonsRow(String rightText, String leftText, bool checkParam, Function(bool) callBack) {
|
|
|
|
|
return Row(
|
|
|
|
|
children: [
|
|
|
|
|
Row(children: [
|
|
|
|
|
Checkbox(value: null, onChanged: null)
|
|
|
|
|
],)
|
|
|
|
|
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(width: 22, height: 22, child: Radio(value: true, groupValue: checkParam, onChanged: callBack)),
|
|
|
|
|
SizedBox(width: 8),
|
|
|
|
|
Text(
|
|
|
|
|
rightText,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
height: 21 / 14,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Color(0xff575757),
|
|
|
|
|
letterSpacing: -0.44,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(width: 12),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(width: 22, height: 22, child: Radio(value: false, groupValue: checkParam, onChanged: callBack)),
|
|
|
|
|
SizedBox(width: 8),
|
|
|
|
|
Text(
|
|
|
|
|
leftText,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
height: 21 / 14,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Color(0xff575757),
|
|
|
|
|
letterSpacing: -0.44,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Row(children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
@ -456,7 +514,99 @@ class _H2oSettingState extends State<H2oSetting> {
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _commonSlidersRow(_controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange) {
|
|
|
|
|
Widget _commonInputAndUnitRow(_title, _controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange, String unitTitle,
|
|
|
|
|
Function(bool) onUnitTap, _list) {
|
|
|
|
|
return _containerWidget(
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 3,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
_title,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Color(0xff2E303A),
|
|
|
|
|
letterSpacing: -0.44,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
TextField(
|
|
|
|
|
controller: _controller,
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
double _value = double.parse(value);
|
|
|
|
|
if (_value > _maxValue) {
|
|
|
|
|
onTextValueChange(_maxValue.toStringAsFixed(0));
|
|
|
|
|
onValueChange(_maxValue);
|
|
|
|
|
return;
|
|
|
|
|
} else if (_value < _minValue) {
|
|
|
|
|
onTextValueChange(_minValue.toStringAsFixed(0));
|
|
|
|
|
onValueChange(_minValue);
|
|
|
|
|
return;
|
|
|
|
|
} else if (_value >= _minValue && _value <= _maxValue) {
|
|
|
|
|
onValueChange(_value);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
inputFormatters: [
|
|
|
|
|
FilteringTextInputFormatter.allow(RegExp(r'[0-9]')),
|
|
|
|
|
],
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Color(0xff575757),
|
|
|
|
|
letterSpacing: -0.56,
|
|
|
|
|
),
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
isDense: true,
|
|
|
|
|
hintText: "0",
|
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
height: 21 / 14,
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
color: Color(0xff575757),
|
|
|
|
|
letterSpacing: -0.56,
|
|
|
|
|
),
|
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
|
border: InputBorder.none,
|
|
|
|
|
focusedBorder: InputBorder.none,
|
|
|
|
|
enabledBorder: InputBorder.none,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(height: 34, width: 1, color: Color(0xffE0E0E0), margin: EdgeInsets.only(left: 12, right: 12)),
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: PopupMenuButton(
|
|
|
|
|
child: _commonDropDownView(TranslationBase.of(context).unit, unitTitle, null),
|
|
|
|
|
onSelected: (value) {
|
|
|
|
|
onUnitTap(value);
|
|
|
|
|
},
|
|
|
|
|
itemBuilder: (context) => _list),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _commonSlidersRow(_title, _controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange) {
|
|
|
|
|
// if (_valueOrg < 174) {
|
|
|
|
|
// return _containerWidget(Row(
|
|
|
|
|
// children: [
|
|
|
|
|
// Expanded(flex: 3, child: inputWidget(_title, "$_valueOrg", _controller)),
|
|
|
|
|
// Container(height: 34,width: 1,color:Color(0xffE0E0E0),margin: EdgeInsets.only(left: 12,right: 12)),
|
|
|
|
|
// Expanded(
|
|
|
|
|
// flex: 1,
|
|
|
|
|
// child: _commonDropDownView(TranslationBase.of(context).unit, _isWeightKG ? TranslationBase.of(context).kg : TranslationBase.of(context).lb, () {}),
|
|
|
|
|
// )
|
|
|
|
|
// ],
|
|
|
|
|
// ));
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
return Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 6),
|
|
|
|
|
padding: EdgeInsets.all(6),
|
|
|
|
|
@ -584,6 +734,7 @@ class _H2oSettingState extends State<H2oSetting> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final CalendarPlugin _myPlugin = CalendarPlugin();
|
|
|
|
|
|
|
|
|
|
void _addReminderToCalender(int _selectedRemindedTime) async {
|
|
|
|
|
bool _calendarPermission = await _myPlugin.hasPermissions();
|
|
|
|
|
if (_calendarPermission) {
|
|
|
|
|
|