title: Is there a better way to write a nested if-else such as this?
body: <p>Below is a snippet of code for a flutter function returning a widget. It either returns a button or text widget depending on four different variables.</p>
  <pre class="lang-dart prettyprint-override"><code>Widget _renderReservationState() {
            if (reservationsDetailState.isFinished == false) {
              if (reservationsDetailState.rsvpStatus == &quot;Attending&quot;) {
                if (reservationsDetailState.attendanceStatus == &quot;Attended&quot;) {
                  return Center(
                      child: Text(&quot;Registration completed&quot;);)
                } else {
                  if (reservationsDetailState.isEditing == false) {
                    return SizedBox(
                        child: Button(
                            onPressed: () {
                              if (myReservationsDetailState.isEditing) {
                                _setEditMode(false);
                              } else {
                                _setEditMode(true);
                              }
                            },
                            title: &quot;Edit reservation&quot;),
                        width: double.infinity);
                  } else {
                    return SizedBox(
                        child: Button(
                            onPressed: () {
                              if (reservationsDetailState.isEditing) {
                                _confirmReservation(dateController.text,
                                    timeController.text, attendeeController.text);
                              } else {
                                _setEditMode(true);
                              }
                            },
                            title: &quot;Confirm reservation&quot;),
                        width: double.infinity);
                  }
                }
              } else {
                return SizedBox(
                    child: Button(
                        onPressed: () =&gt; {
                              _confirmReservation(dateController.text,
                                  timeController.text, attendeeController.text),
                            },
                        title: &quot;Make a reservation&quot;),
                    width: double.infinity);
              }
            } else {
              if (myReservationsDetailState.attendanceStatus == &quot;Attended&quot;) {
                return Center(
                  child: Text(&quot;Thank you for your visit&quot;)
                );
              } else {
                return Center(
                    child: Text(&quot;Please join next time&quot;);)
              }
            }
          }
  </code></pre>
  <p>The existing code was a nested if-else over a couple hundred lines. I've refactored it to be shorter but I'm not happy with this implementation either.</p>