push method

void push(
  1. Widget page, {
  2. bool fullscreen = false,
})

Pushes a new page onto the navigation stack.

Adds the given page to the navigation history and updates the selected index to the new page.

The page parameter should be a widget that represents the content to be displayed.

Implementation

void push(Widget page, {bool fullscreen = false}) {
  setState(() {
    if (_fullscreen || fullscreen) {
      _dynamicHistory.add(page);
      _fullscreen = true;
    }
    if (_dynamicHistory.isEmpty) {
      _fullscreen = false;
    }
    _navRailKey.currentState?.setSecondaryActions([]);
    _history.add(page);
    _selectedIndex = _history.length - 1;
  });
}