setDimension method

Future<void> setDimension(
  1. NmGalaxyDimension dimension, {
  2. bool animate = true,
})

Change the current dimension with optional animation

Implementation

Future<void> setDimension(NmGalaxyDimension dimension, {bool animate = true}) async {
  if (_dimension == dimension) return;

  if (animate) {
    _previousPositions = List.from(_positions);
    _isTransitioning = true;
    _transitionProgress = 0.0;
    notifyListeners();
  }

  _dimension = dimension;
  _currentLayout = NmGalaxyLayouts.create(dimension, colors);
  _recalculatePositions();

  if (!animate) {
    notifyListeners();
  }
}