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="M33 12C35.2091 12 37 10.2091 37 8C37 5.79086 35.2091 4 33 4C30.7908 4 29 5.79086 29 8C29 10.2091 30.7908 12 33 12Z" fill="black"/>
<path d="M11.4694 9.66171C10.9817 9.40248 10.3762 9.58766 10.117 10.0753C9.85777 10.563 10.043 11.1685 10.5306 11.4277L14.2449 13.4021L12.574 14.1017C12.2202 14.2498 11.9823 14.5872 11.9616 14.9702C11.9409 15.3532 12.1411 15.7143 12.4769 15.8996L17.4136 18.6243C17.8971 18.8912 18.5054 18.7155 18.7723 18.232C19.0392 17.7485 18.8635 17.1402 18.38 16.8733L15.2539 15.1479L16.9638 14.4321C17.3203 14.2828 17.5588 13.9416 17.5766 13.5557C17.5944 13.1697 17.3882 12.808 17.047 12.6266L11.4694 9.66171Z" fill="black"/>
<path d="M21.179 17.6861C22.7468 15.1192 25.3262 13.0933 29 13.0933C29.9157 13.0933 30.7144 13.7151 30.9389 14.6028L32.689 21.5215L36.7428 23.143C37.7683 23.5533 38.2672 24.7172 37.8569 25.7428C37.4467 26.7683 36.2828 27.2672 35.2572 26.857L30.2572 24.857C29.6627 24.6192 29.2181 24.1112 29.0611 23.4905L28.3045 20.4994C28.0765 21.0523 27.8522 21.6439 27.6378 22.2691C26.7441 24.8753 26.0743 27.9158 25.999 30.937C25.9997 30.9579 26 30.9789 26 31V42C26 43.1046 25.1046 44 24 44C22.8954 44 22 43.1046 22 42V32.219L21.9478 32.1524C21.6462 31.7659 21.2403 31.2237 20.8305 30.6073C20.4249 29.9974 19.9904 29.2774 19.6507 28.5394C19.3301 27.8428 19 26.9337 19 26C19 23.2998 19.6492 20.1907 21.179 17.6861Z" fill="black"/>
<path d="M32 30.8333C32 29.1765 33.3431 27.8333 35 27.8333C36.6568 27.8333 38 29.1765 38 30.8333V43C38 43.5523 37.5523 44 37 44C36.4477 44 36 43.5523 36 43V30.8333C36 30.2811 35.5523 29.8333 35 29.8333C34.4477 29.8333 34 30.2811 34 30.8333V31.0556C34 31.6078 33.5523 32.0556 33 32.0556C32.4477 32.0556 32 31.6078 32 31.0556V30.8333Z" fill="black"/>
<path d="M9.83169 19.9783C9.94247 19.4179 10.4551 19.051 10.9766 19.159L14.6432 19.9181C14.9946 19.9909 15.2755 20.2673 15.3723 20.6357C15.4691 21.004 15.3657 21.4033 15.1041 21.6721L14.3066 22.4913L16.2447 22.9955C16.7604 23.1297 17.069 23.6882 16.9338 24.2429C16.7987 24.7977 16.271 25.1387 15.7553 25.0045L12.1302 24.0614C11.7905 23.9731 11.526 23.6933 11.4394 23.3309C11.3527 22.9685 11.4577 22.5805 11.7134 22.3178L12.4374 21.5741L10.5754 21.1886C10.0539 21.0806 9.72091 20.5388 9.83169 19.9783Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );