didUpdateWidget method

  1. @override
void didUpdateWidget(
  1. covariant TraceViewerApp oldWidget
)
override

Called whenever the widget configuration changes.

Implementation

@override
void didUpdateWidget(TraceViewerApp oldWidget) {
  super.didUpdateWidget(oldWidget);
  if (widget.spans != oldWidget.spans ||
      widget.minTs != oldWidget.minTs ||
      widget.maxTs != oldWidget.maxTs) {
    setState(() {
      spans = widget.spans;
      minTs = widget.minTs;
      maxTs = widget.maxTs;
      final duration = maxTs! - minTs!;
      zoomLevel = duration > 0 ? duration / 80.0 : 1.0;
      offsetX = minTs!.toDouble();
      _undoStack.clear();
      _redoStack.clear();
      selectionStartUs = null;
      selectionEndUs = null;
    });
  }
}