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="M27.4484 28.9019C27.932 28.664 28.1362 28.0688 27.9044 27.5724C27.0458 25.7337 25.5461 24.4826 23.7205 23.67C21.7617 22.7981 20.771 21.9358 20.2728 21.3016C19.8088 20.7109 19.6716 20.1952 19.647 19.726C19.5908 18.6557 20.0492 17.6395 20.5993 16.476L20.6001 16.4743C20.6671 16.3325 20.7355 16.1879 20.8016 16.0447C21.619 14.2756 20.8749 12.1688 19.1493 11.3377C17.4265 10.5079 15.3672 11.2591 14.5511 13.0253C14.5061 13.1228 14.4579 13.2189 14.4106 13.3153C13.9051 14.3439 12.5829 17.0342 12.744 20.1047C12.8326 21.7915 13.3497 23.551 14.5014 25.2114L8.68539 27.0504C8.17288 27.2124 7.88541 27.7702 8.0433 28.2963C8.2012 28.8223 8.74467 29.1173 9.25718 28.9553L16.4564 26.6788C16.7772 26.5774 17.0242 26.3132 17.1096 25.98C17.195 25.6469 17.1067 25.2921 16.8761 25.0417C16.7053 24.8563 16.5451 24.6681 16.3951 24.4772C15.2442 23.012 14.7603 21.4661 14.6833 19.9975C14.5515 17.4856 15.6566 15.2061 16.1575 14.1865L16.1618 14.1778C16.2146 14.0704 16.2661 13.9656 16.3059 13.8794C16.6611 13.1105 17.5642 12.776 18.3243 13.1421C19.0816 13.5069 19.4008 14.4247 19.0469 15.1907C18.9738 15.3489 18.897 15.5109 18.8154 15.6834C18.3076 16.7564 17.6223 18.2046 17.7077 19.8332C17.7531 20.6977 18.0275 21.619 18.7609 22.5527C19.5092 23.5052 20.7894 24.5379 22.9478 25.4986C24.4588 26.1712 25.5447 27.131 26.1531 28.4339C26.3849 28.9302 26.9648 29.1398 27.4484 28.9019Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M34 25C36.2091 25 38 23.2091 38 21C38 18.7909 36.2091 17 34 17C31.7909 17 30 18.7909 30 21C30 23.2091 31.7909 25 34 25ZM34 27C37.3137 27 40 24.3137 40 21C40 17.6863 37.3137 15 34 15C30.6863 15 28 17.6863 28 21C28 24.3137 30.6863 27 34 27Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.22184 37.379C4.57365 36.9461 5.21874 36.8733 5.66269 37.2163L7.28501 38.4697C8.18692 39.1666 9.47586 39.1158 10.3171 38.3502L10.4064 38.269C12.0381 36.7842 14.5701 36.7842 16.2017 38.269C17.0452 39.0365 18.3541 39.0365 19.1976 38.269C20.8293 36.7842 23.3612 36.7842 24.9929 38.269C25.8287 39.0296 27.1568 39.0261 28.008 38.2516C29.6105 36.7933 32.1282 36.7622 33.7461 38.2345L33.8162 38.2982C34.6201 39.0297 35.874 39.0087 36.6515 38.2505C38.1635 36.7764 40.5845 36.6858 42.208 38.0425L43.6418 39.2407C44.0719 39.6002 44.1217 40.2315 43.7531 40.6508C43.3844 41.0701 42.7369 41.1187 42.3069 40.7592L40.873 39.561C40.0634 38.8844 38.856 38.9296 38.102 39.6647C36.5428 41.1849 34.0286 41.2272 32.4166 39.7603L32.3465 39.6965C31.532 38.9554 30.2374 38.9585 29.4076 39.7136C27.7837 41.1914 25.2325 41.2228 23.5932 39.7311C22.7497 38.9635 21.4408 38.9635 20.5973 39.7311C18.9656 41.2158 16.4337 41.2158 14.802 39.7311C13.9585 38.9635 12.6496 38.9635 11.8061 39.7311L11.7168 39.8123C10.1337 41.2529 7.70818 41.3485 6.011 40.0372L4.38867 38.7838C3.94473 38.4408 3.87003 37.8118 4.22184 37.379Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.22184 31.379C4.57365 30.9461 5.21874 30.8733 5.66269 31.2163L7.28501 32.4697C8.18692 33.1666 9.47586 33.1158 10.3171 32.3502L10.4064 32.269C12.0381 30.7842 14.5701 30.7842 16.2017 32.269C17.0452 33.0365 18.3541 33.0365 19.1976 32.269C20.8293 30.7842 23.3612 30.7842 24.9929 32.269C25.8287 33.0296 27.1568 33.0261 28.008 32.2516C29.6105 30.7933 32.1282 30.7622 33.7461 32.2345L33.8162 32.2982C34.6201 33.0297 35.874 33.0087 36.6515 32.2505C38.1635 30.7764 40.5845 30.6858 42.208 32.0425L43.6418 33.2407C44.0719 33.6002 44.1217 34.2315 43.7531 34.6508C43.3844 35.0701 42.7369 35.1187 42.3069 34.7592L40.873 33.561C40.0634 32.8844 38.856 32.9296 38.102 33.6647C36.5428 35.1849 34.0286 35.2272 32.4166 33.7603L32.3465 33.6965C31.532 32.9554 30.2374 32.9585 29.4076 33.7136C27.7837 35.1914 25.2325 35.2228 23.5932 33.7311C22.7497 32.9635 21.4408 32.9635 20.5973 33.7311C18.9656 35.2158 16.4337 35.2158 14.802 33.7311C13.9585 32.9635 12.6496 32.9635 11.8061 33.7311L11.7168 33.8123C10.1337 35.2529 7.70818 35.3485 6.011 34.0372L4.38867 32.7838C3.94473 32.4408 3.87003 31.8118 4.22184 31.379Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );