build method

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

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

The framework calls this method when this widget is inserted into the tree in a given BuildContext and when the dependencies of this widget change (e.g., an InheritedWidget referenced by this widget changes). This method can potentially be called in every frame and should not have any side effects beyond building a widget.

The framework replaces the subtree below this widget with the widget returned by this method, either by updating the existing subtree or by removing the subtree and inflating a new subtree, depending on whether the widget returned by this method can update the root of the existing subtree, as determined by calling Widget.canUpdate.

Typically implementations return a newly created constellation of widgets that are configured with information from this widget's constructor and from the given BuildContext.

The given BuildContext contains information about the location in the tree at which this widget is being built. For example, the context provides the set of inherited widgets for this location in the tree. A given widget might be built with multiple different BuildContext arguments over time if the widget is moved around the tree or if the widget is inserted into the tree in multiple places at once.

The implementation of this method must only depend on:

If a widget's build method is to depend on anything else, use a StatefulWidget instead.

See also:

  • StatelessWidget, which contains the discussion on performance considerations.

Implementation

@override
widgets.Widget build(widgets.BuildContext context) => SvgPicture.string(
      '''
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M11.5372 10.2929C11.9277 10.6834 11.9277 11.3166 11.5372 11.7071L10.2442 13.0001H37.7557L36.4628 11.7072C36.0723 11.3167 36.0723 10.6835 36.4628 10.293C36.8533 9.90244 37.4865 9.90244 37.877 10.293L39.9983 12.4143C40.7794 13.1953 40.7794 14.4617 39.9983 15.2427L37.877 17.364C37.4865 17.7546 36.8533 17.7546 36.4628 17.364C36.0723 16.9735 36.0723 16.3403 36.4628 15.9498L37.4125 15.0001H10.5875L11.5372 15.9497C11.9277 16.3403 11.9277 16.9734 11.5372 17.364C11.1467 17.7545 10.5135 17.7545 10.123 17.364L8.00165 15.2426C7.2206 14.4616 7.2206 13.1953 8.00165 12.4142L10.123 10.2929C10.5135 9.90237 11.1467 9.90237 11.5372 10.2929Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M15 25.5001C15 27.4338 13.4338 29.0001 11.5 29.0001C9.56625 29.0001 8 27.4338 8 25.5001C8 23.5663 9.56625 22.0001 11.5 22.0001C13.4338 22.0001 15 23.5663 15 25.5001ZM11.5 27.0001C12.3292 27.0001 13 26.3293 13 25.5001C13 24.6709 12.3292 24.0001 11.5 24.0001C10.6708 24.0001 10 24.6709 10 25.5001C10 26.3293 10.6708 27.0001 11.5 27.0001Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 34.2668C4 31.4294 8.99687 30.0001 11.5 30.0001C14.0031 30.0001 19 31.4294 19 34.2668V38.0001H4V34.2668ZM6 34.2668C6 34.1404 6.16831 33.5605 7.64082 32.8893C8.94299 32.2958 10.5352 32.0001 11.5 32.0001C12.4648 32.0001 14.057 32.2958 15.3592 32.8893C16.8317 33.5605 17 34.1404 17 34.2668V36.0001H6V34.2668Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M40 25.5001C40 27.4338 38.4338 29.0001 36.5 29.0001C34.5662 29.0001 33 27.4338 33 25.5001C33 23.5663 34.5662 22.0001 36.5 22.0001C38.4338 22.0001 40 23.5663 40 25.5001ZM36.5 27.0001C37.3292 27.0001 38 26.3293 38 25.5001C38 24.6709 37.3292 24.0001 36.5 24.0001C35.6708 24.0001 35 24.6709 35 25.5001C35 26.3293 35.6708 27.0001 36.5 27.0001Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M29 34.2668C29 31.4294 33.9969 30.0001 36.5 30.0001C39.0031 30.0001 44 31.4294 44 34.2668V38.0001H29V34.2668ZM31 34.2668C31 34.1404 31.1683 33.5605 32.6408 32.8893C33.943 32.2958 35.5352 32.0001 36.5 32.0001C37.4648 32.0001 39.057 32.2958 40.3592 32.8893C41.8317 33.5605 42 34.1404 42 34.2668V36.0001H31V34.2668Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );