title: flutter Text doesnot update after showDatePicker date is selected
body: <p>I couldnot change a text of a Text widget after the date is selected. I have wrapped the Text Widget in a gesture detector and a tap the date picker will start but after selecting a date it wont apply the selected date to the Text field.</p>
  <p>The Text Widget is in an Alert Dialog, could that be the reason? Should the showDatePicker and the showDialog widget which wrapped the alert dialog be on the same context?</p>
  <p>below here is mu date picker function</p>
  <pre class="lang-dart prettyprint-override"><code>  void _showDatePicker() {
      showDatePicker(
              context: context,
              initialDate: DateTime.now(),
              firstDate: DateTime(2021),
              lastDate: DateTime(2023))
          .then((value) {
        setState(() {
          dateTime = value!;
        });
      });
    }
  
  </code></pre>
  <p>And use case inside widget</p>
  <pre class="lang-dart prettyprint-override"><code>GestureDetector(
    onTap: () {
      _showDatePicker();
    },
    child: Text(
      dateTime.toString(),
      style: const TextStyle(
        color: Colors.grey,
        fontSize: 18,
      ),
    ),
  ),
  </code></pre>