build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Describes the part of the user interface represented by this widget.

Implementation

@override
Widget build(BuildContext context) {
  if (isLoading) {
    return Center(
      child: Text(
        '[ Loading Trace Data... ]',
        style: const Style(foreground: Colors.yellow),
      ),
    );
  }

  if (loadError != null) {
    return Center(
      child: Text(
        '[ $loadError ]',
        style: const Style(foreground: Colors.red),
      ),
    );
  }

  if (spans == null || spans!.isEmpty) {
    return Center(
      child: Text(
        '[ Error loading trace ]',
        style: const Style(foreground: Colors.red),
      ),
    );
  }

  final modeText = isCaliperMode
      ? 'Caliper'
      : isBoxSelectMode
      ? 'Box Zoom'
      : 'Pan';

  final modeStyle = isCaliperMode
      ? const Style(foreground: Colors.black, background: Colors.yellow)
      : isBoxSelectMode
      ? const Style(foreground: Colors.white, background: Colors.blue)
      : const Style(foreground: Colors.white, background: Color(60, 60, 60));

  return Column([
    buildHeader(modeText, modeStyle),
    buildRuler(),
    buildSeparator('Main Isolate'),
    Expanded(
      child: TimelineCanvas(
        spans: spans!,
        offsetX: offsetX,
        offsetY: offsetY,
        zoomLevel: zoomLevel,
        maxSpanDuration: maxSpanDuration,
        measureStartMs: measureStartMs,
        measureEndMs: measureEndMs,
        selectionStartUs: selectionStartUs,
        selectionEndUs: selectionEndUs,
        animatedSpan: _animatedSpan,
        animationProgress: _animationProgress,
        onHitGridUpdated: (grid) {
          _latestHitGrid = grid;
        },
      ),
    ),
    buildInspectorPanel(
      exportMessage,
      hoveredSpan,
      timeDisplayMode,
      baseTime,
    ),
  ], crossAxisAlignment: CrossAxisAlignment.stretch);
}