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 fill-rule="evenodd" clip-rule="evenodd" d="M30.5 14C29.1193 14 28 15.1193 28 16.5C28 17.8807 29.1193 19 30.5 19C31.6547 19 32.6266 18.2171 32.9138 17.1532C33.165 18.3325 34.2131 19.2166 35.4671 19.2155C36.9077 19.2144 38.0746 18.0456 38.0734 16.605C38.0722 15.1644 36.9034 13.9975 35.4628 13.9987C34.2494 13.9997 33.2302 14.829 32.9396 15.9515C32.6896 14.8346 31.6923 14 30.5 14ZM30 16.5C30 16.2239 30.2239 16 30.5 16C30.7761 16 31 16.2239 31 16.5C31 16.7761 30.7761 17 30.5 17C30.2239 17 30 16.7761 30 16.5ZM35.4645 15.9987C35.1284 15.999 34.8563 16.2716 34.8565 16.6076C34.8568 16.9436 35.1294 17.2158 35.4655 17.2155C35.8015 17.2153 36.0737 16.9426 36.0734 16.6066C36.0731 16.2706 35.8005 15.9984 35.4645 15.9987Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M27.4615 21.8347C27 21.8347 25.6154 21.3825 25.6154 19.3476C25.6154 18.5425 25.3625 18.1622 25.0569 17.7024C24.59 17.0001 24 16.1125 24 13.243C24 3.58566 42 3.58566 42 13.243C42 16.1125 41.41 17.0001 40.9431 17.7024C40.6375 18.1622 40.3846 18.5425 40.3846 19.3476C40.3846 21.3825 38.5769 21.8347 38.5385 21.8347C38.5 21.8347 37.9231 23.1912 37.9231 24.0956C37.9231 25 35.3077 25 33 25C30.6923 25 28.0769 25 28.0769 24.0956C28.0769 23.1912 27.9231 21.8347 27.4615 21.8347ZM27.6849 19.8248L27.689 19.8344L27.6944 19.8459C28.7743 19.9517 29.3246 20.7757 29.4964 21.0817C29.7214 21.4825 29.8347 21.9096 29.8986 22.21C29.947 22.438 29.9837 22.6761 30.0107 22.9125C30.7989 22.9971 31.8542 23 33 23C34.1836 23 35.2706 22.9969 36.0664 22.9038C36.1431 22.5546 36.2377 22.2402 36.3169 21.9999C36.4077 21.7243 36.5021 21.4764 36.5828 21.2847C36.6217 21.1923 36.6662 21.092 36.7126 20.9993C36.7324 20.9598 36.7731 20.8801 36.8285 20.7913C36.8512 20.755 36.9154 20.6532 37.0136 20.5384C37.0596 20.4847 37.1647 20.3664 37.3236 20.2452C37.3971 20.1892 37.6558 19.9932 38.0558 19.8937L38.0621 19.891C38.1078 19.8716 38.1685 19.8392 38.2224 19.7958C38.2721 19.7559 38.3039 19.7168 38.3254 19.6752C38.3431 19.641 38.3846 19.548 38.3846 19.3476C38.3846 17.8638 39.0422 16.9175 39.3528 16.4705C39.4041 16.3966 39.446 16.3364 39.4738 16.2896C39.6474 15.9981 40 15.3589 40 13.243C40 11.5415 39.2439 10.3101 38.0239 9.4374C36.7446 8.52225 34.9261 8 33 8C31.0739 8 29.2554 8.52225 27.9761 9.4374C26.7561 10.3101 26 11.5415 26 13.243C26 15.3589 26.3526 15.9981 26.5262 16.2896C26.554 16.3364 26.5958 16.3966 26.6472 16.4704C26.9578 16.9174 27.6154 17.8638 27.6154 19.3476C27.6154 19.6272 27.6623 19.7707 27.6849 19.8248Z" fill="black"/>
<path d="M6 41C6 41.5523 6.44772 42 7 42H42V40H8V18H8.87117C10.8868 18 12.8924 18.6123 14.7353 19.8148C16.5811 21.0192 18.2174 22.7864 19.5 25.0011C20.9186 27.4509 22.7615 29.4633 24.9025 30.8604C27.0465 32.2593 29.4283 33.0002 31.8597 33H38.3663L35.2927 36.0748C34.9023 36.4654 34.9024 37.0986 35.293 37.489C35.6836 37.8795 36.3168 37.8793 36.7073 37.4887L41.4873 32.7067C41.8776 32.3162 41.8776 31.6833 41.4873 31.2928L36.7073 26.5108C36.3168 26.1202 35.6836 26.1201 35.293 26.5105C34.9024 26.901 34.9023 27.5341 35.2927 27.9247L38.3667 31H31.8596C29.844 31.0001 27.8383 30.3879 25.9954 29.1854C24.1496 27.981 22.5133 26.2137 21.2308 23.9988C19.8121 21.5492 17.9693 19.5368 15.8282 18.1398C13.6843 16.7409 11.3026 16 8.87115 16H8V6H6V41Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );