New switches for hyper and hypo

This commit is contained in:
2024-02-01 11:15:02 +03:00
parent defb82b4f3
commit c846a0c8ca
2 changed files with 50 additions and 7 deletions

View File

@@ -78,6 +78,8 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
additionalFormController: currentState.additionalFormController,
sportsFormController: currentState.sportsFormController,
dateFormController: currentState.dateFormController,
hypoFormController: currentState.hypoFormController,
hyperFormController: currentState.hyperFormController,
));
} else {
print(data['userDetails']);
@@ -89,6 +91,8 @@ class MyProfileBloc extends Bloc<MyProfileEvent, MyProfileState> {
userDetails: data['userDetails'],
plans: data['plans'],
token: token,
hypoFormController: data['userDetails']['has_hypo'].toString(),
hyperFormController: data['userDetails']['has_hyper'].toString(),
chestCircumferenceFormController: TextEditingController(
text: data['userDetails']['chest_circumference']?.toString()),
waistCircumferenceFormController: TextEditingController(

View File

@@ -201,16 +201,55 @@ class _NotificationSwitchState extends State<NotificationSwitch> {
}
}
class HypoHyperSwitch extends StatefulWidget {
class HyperSwitch extends StatefulWidget {
final String title;
HypoHyperSwitch(this.title);
MyProfileLoadedState? state;
HyperSwitch(this.title, this.state);
@override
_HypoHyperState createState() => _HypoHyperState();
_HyperState createState() => _HyperState();
}
class _HypoHyperState extends State<HypoHyperSwitch> {
class _HyperState extends State<HyperSwitch> {
bool switchValue = false;
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
widget.title,
style: TextStyle(
color: Colors.black, fontSize: 14, fontWeight: FontWeight.bold),
),
Switch(
value: switchValue,
onChanged: (value) {
setState(() {
switchValue = value;
});
},
inactiveThumbColor: appTheme.blueA400,
inactiveTrackColor: Colors.white,
activeTrackColor: appTheme.blueA400,
activeColor: Colors.white,
),
],
);
}
}
class HypoSwitch extends StatefulWidget {
final String title;
HypoSwitch(this.title);
@override
_HypoState createState() => _HypoState();
}
class _HypoState extends State<HypoSwitch> {
bool switchValue = false;
@override
@@ -465,12 +504,12 @@ class _ExpandableListState extends State<ExpandableList> {
),
Row(
children: [
HypoHyperSwitch('do_you_have_hypotension_tendency'.tr),
HypoSwitch('do_you_have_hypotension_tendency'.tr, state),
],
),
Row(
children: [
HypoHyperSwitch('do_you_have_hypertension_tendency'.tr),
HypoSwitch('do_you_have_hypertension_tendency'.tr, state),
],
),
NextStepButton(