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="M24 40C24.4277 40 24.8515 39.9832 25.2708 39.9503C25.4361 40.6046 25.6961 41.2702 26.0995 41.8789C25.4108 41.9589 24.7102 42 24 42C14.0589 42 6 33.9411 6 24C6 14.0589 14.0589 6 24 6C33.9411 6 42 14.0589 42 24C42 24.586 41.972 25.1655 41.9173 25.7371C41.334 25.3681 40.6666 25.1263 39.9669 25.038C39.9888 24.6948 40 24.3487 40 24C40 15.1634 32.8366 8 24 8C15.1634 8 8 15.1634 8 24C8 32.8366 15.1634 40 24 40Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M25 35C27.7614 35 30 32.7614 30 30C30 27.2386 27.7614 25 25 25C22.2386 25 20 27.2386 20 30C20 32.7614 22.2386 35 25 35ZM25 33C26.6569 33 28 31.6569 28 30C28 28.3431 26.6569 27 25 27C23.3431 27 22 28.3431 22 30C22 31.6569 23.3431 33 25 33Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M39.6051 31.9846C38.4855 32.0927 37.307 31.6132 36.3915 31.0919C36.129 30.9424 35.8881 30.7895 35.6764 30.646C35.1078 30.2606 34.75 29.9433 34.75 29.9433C34.75 29.9433 35.0346 29.5681 35.5106 29.0856C35.6932 28.9005 35.904 28.6996 36.1377 28.498C36.9316 27.8134 37.99 27.1209 39.1069 27.0131C40.5606 26.8729 41.8505 27.8721 41.9881 29.245C42.1256 30.6178 41.0588 31.8444 39.6051 31.9846ZM39.299 29.0039C39.7635 28.9591 39.9808 29.2721 39.998 29.4444C40.0146 29.6097 39.873 29.9495 39.4131 29.9939C39.0317 30.0307 38.5106 29.9033 37.9233 29.6334C38.4407 29.2615 38.9212 29.0403 39.299 29.0039Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M27.1963 36.5C27.1963 36.5 27.0628 37.1288 27.016 37.9985C27.0075 38.1558 27.0019 38.321 27.0004 38.4918C26.9909 39.5811 27.1499 40.8975 27.8157 41.8459C28.666 43.0572 30.2844 43.3642 31.4305 42.5316C32.5765 41.6989 32.8162 40.042 31.9659 38.8307C31.3069 37.8919 30.1513 37.3139 29.1427 36.9683C28.9505 36.9024 28.7637 36.845 28.5866 36.7952C27.7932 36.5718 27.1963 36.5 27.1963 36.5ZM29.015 39.0612C29.0615 39.7815 29.2145 40.3577 29.4526 40.6968C29.7101 41.0636 30.0804 41.0403 30.2549 40.9135C30.4531 40.7695 30.5987 40.3641 30.3289 39.9798C30.0998 39.6534 29.6389 39.332 29.015 39.0612Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M40.1642 34.4119C41.9162 35.4293 42.5426 37.6211 41.5634 39.3074C40.5841 40.9937 38.37 41.536 36.618 40.5186C33.8422 38.9066 32.8396 34.2414 32.8396 34.2414C32.8396 34.2414 37.3885 32.8 40.1642 34.4119ZM39.1599 36.1414C40.0196 36.6407 40.2226 37.6337 39.8339 38.3031C39.4451 38.9725 38.4821 39.2883 37.6223 38.789C36.8044 38.314 36.0745 37.2424 35.5206 35.9747C35.4861 35.8959 35.453 35.8177 35.4211 35.7405C35.504 35.7299 35.5883 35.72 35.6739 35.7108C37.0494 35.5636 38.3419 35.6664 39.1599 36.1414Z" fill="black"/>
<path d="M17.2411 18.3488C17.5703 17.9651 18.1341 17.8875 18.5547 18.1679L21.5547 20.1679C21.8329 20.3534 22 20.6656 22 21C22 21.3344 21.8329 21.6466 21.5547 21.832L18.5547 23.8321C18.128 24.1165 17.5554 24.0321 17.2289 23.6367C16.9024 23.2413 16.9279 22.663 17.288 22.2978C17.6131 21.9682 18.0451 21.6391 18.3755 21.3875C18.4869 21.3026 18.5869 21.2264 18.6672 21.1621C18.7344 21.1083 18.7916 21.0606 18.8399 21.0183C18.7843 20.9697 18.7179 20.9144 18.6389 20.8512C18.5704 20.7963 18.4903 20.7344 18.4025 20.6665C18.0611 20.4024 17.6039 20.0489 17.2619 19.6747C16.9208 19.3015 16.9119 18.7325 17.2411 18.3488Z" fill="black"/>
<path d="M33.4453 18.1679C33.8659 17.8875 34.4297 17.9651 34.7589 18.3488C35.0881 18.7325 35.0792 19.3015 34.7381 19.6747C34.3961 20.0489 33.9389 20.4024 33.5975 20.6665C33.5097 20.7344 33.4296 20.7963 33.3611 20.8512C33.2821 20.9144 33.2157 20.9697 33.1601 21.0183C33.2084 21.0606 33.2656 21.1083 33.3328 21.1621C33.4131 21.2264 33.513 21.3025 33.6244 21.3874C33.9548 21.639 34.3869 21.9681 34.712 22.2978C35.0721 22.663 35.0976 23.2413 34.7711 23.6367C34.4446 24.0321 33.872 24.1165 33.4453 23.8321L30.4453 21.832C30.1671 21.6466 30 21.3344 30 21C30 20.6656 30.1671 20.3534 30.4453 20.1679L33.4453 18.1679Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );