forked from eatvio/eatvio_app
New switches for hyper and hypo
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user