0

I am struggling to hide SpeedDialChild, when my noDoctorReply == false. I can't use if else conditions. I tried to code like below.

noDoctorReply == false
                  ? SpeedDialChild(
                      child: Icon(Icons.stop_screen_share_outlined),
                      backgroundColor: Colors.green,
                      label: 'Complete Conversation',
                      labelStyle: TextStyle(fontSize: 18.0),
                      onTap: () {
                        _completeDialog();
                      },
                    )
                  : SpeedDialChild(),

But it got me to here. Screenshot of above code result

Is there any way to hide this? Thank you.

EDIT: I used package called flutter_speed_dial.

1 Answers1

1

You can use just if conditional state. While else is never needed to show up.

if(noDoctorReply) showMyWidget()

You can also check Visibility widget.

Md. Yeasin Sheikh
  • 54,221
  • 7
  • 29
  • 56
  • Thank you, yes I can use that but when the condition true (noDoctorReply == true) I need to show that SpeedDialChild. When using if condition like that It won't show. – Kavinda Lochana May 20 '22 at 04:39
  • While you are using `if(value)` , means it will only show up when `value` is true. Is there something else happened after doing this? – Md. Yeasin Sheikh May 20 '22 at 04:43
  • yes. I use doctor and patient. When patient send message to the doctor, doctor can reply. And doctor has ability to complete conversation. If doctor complete the conversation patient can't send new messages. So I need to disable complete conversation button If doctor not replied at least one time to the patient. So I am checking if doctor replied to the patient, if so condition false (noDoctorReply = false). If doctor not replied noDoctorReply = true. So I need to work this both ways. – Kavinda Lochana May 20 '22 at 04:51
  • check this one https://stackoverflow.com/a/68267115 – Sarthak Raval May 20 '22 at 04:58
  • Can you update the question including full widget that will reproduce the same issue? – Md. Yeasin Sheikh May 20 '22 at 06:18