I'm trying to find / understand a simple flutter concept. I have a form that contains a date picker, the date picker is a stateful widget and opens the select date menu when tapped. I would like it to also open when the user taps "next" on the keyboard (to go to the next field, which is the date picker).
...
TextFormField(
  ...
  textInputAction: TextInputAction.next,
  focusNode: _focusNodeItem,
  onFieldSubmitted: (value) {
    _focusNodeItem.unfocus();
    // TODO: open datePicker from here
  },
  ...
),
DatePicker(
  date: _reminder.expires,
  selectDate: (date) {
    setState(() {
      _reminder =
          _reminder.copy(expires: date.toString());
    });
  },
)
...
Datepicker widget is something like this:
class DatePicker extends StatefulWidget {
  final String date;
  final ValueChanged<DateTime> selectDate;
  DatePicker({Key key, this.date, this.selectDate}) : super(key: key);
  @override
  _DatePickerState createState() => _DatePickerState();
}
class _DatePickerState extends State<DatePicker> {
...
void openDatePicker() {
    showCupertinoModalPopup<void>(
      context: context,
      builder: (BuildContext context) {
        return _buildBottomPicker(
          CupertinoDatePicker(
            mode: CupertinoDatePickerMode.date,
            initialDateTime: date,
            onDateTimeChanged: (DateTime newDateTime) {
              setState(() {
                date = newDateTime;
                widget.selectDate(newDateTime);
              });
            },
          ),
        );
      },
    );
  }
...
}
I get that widgets should not "mess" with each other, but what about simple cases like this?
Is there a simple (and correct) way to call openDatePicker() from the parent widget?
