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="M28.3495 27.6061C28.4731 27.8577 28.3706 28.1619 28.1198 28.2873L27.4483 28.6231C26.4431 29.1256 25.26 29.1256 24.2549 28.6231L22.9118 27.9515C22.1938 27.5925 21.3487 27.5925 20.6308 27.9515L19.2876 28.6231C18.2825 29.1256 17.0994 29.1256 16.0943 28.6231L13.5391 27.3455L8.61026 28.3309C8.34322 28.3843 8.08135 28.2185 8.0154 27.9543C7.94946 27.69 8.10272 27.4206 8.36353 27.3423L15.3192 25.2528L15.274 25.1986C13.8213 23.4417 13.1907 21.5532 13.0911 19.7508C12.9254 16.752 14.2938 14.1065 14.8321 13.0656L14.8398 13.0508C14.9014 12.9317 14.9484 12.8406 14.9823 12.771C15.7359 11.2213 17.6278 10.5728 19.204 11.294C20.7881 12.0188 21.483 13.8664 20.725 15.4251C20.655 15.5691 20.5824 15.7149 20.5101 15.8602C19.9298 17.0264 19.3688 18.1782 19.4373 19.4176C19.4691 19.9935 19.6519 20.6209 20.2222 21.3106C20.8243 22.0388 21.9667 22.9626 24.1249 23.8752C25.9961 24.6665 27.4944 25.8664 28.3495 27.6061Z" fill="black"/>
<path d="M34.012 16.6099C36.8289 16.6099 39.1124 18.8935 39.1124 21.7103C39.1124 24.5272 36.8289 26.8107 34.012 26.8107C31.1951 26.8107 28.9116 24.5272 28.9116 21.7103C28.9116 18.8935 31.1951 16.6099 34.012 16.6099Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.22184 37.379C4.57365 36.9462 5.21874 36.8734 5.66269 37.2164L7.28501 38.4698C8.18692 39.1667 9.47586 39.1159 10.3171 38.3503L10.4064 38.2691C12.0381 36.7843 14.5701 36.7843 16.2017 38.2691C17.0452 39.0366 18.3541 39.0366 19.1976 38.2691C20.8293 36.7843 23.3612 36.7843 24.9929 38.2691C25.8287 39.0297 27.1568 39.0262 28.008 38.2516C29.6105 36.7933 32.1282 36.7622 33.7461 38.2345L33.8162 38.2983C34.6201 39.0298 35.874 39.0088 36.6515 38.2506C38.1635 36.7765 40.5845 36.6859 42.208 38.0426L43.6418 39.2408C44.0719 39.6003 44.1217 40.2315 43.7531 40.6509C43.3844 41.0702 42.7369 41.1187 42.3069 40.7593L40.873 39.5611C40.0634 38.8845 38.856 38.9297 38.102 39.6648C36.5428 41.185 34.0286 41.2273 32.4166 39.7604L32.3465 39.6966C31.532 38.9555 30.2374 38.9586 29.4076 39.7137C27.7837 41.1915 25.2325 41.2229 23.5932 39.7311C22.7497 38.9636 21.4408 38.9636 20.5973 39.7311C18.9656 41.2159 16.4337 41.2159 14.802 39.7311C13.9585 38.9636 12.6496 38.9636 11.8061 39.7311L11.7168 39.8124C10.1337 41.253 7.70818 41.3486 6.011 40.0373L4.38867 38.7838C3.94473 38.4408 3.87003 37.8119 4.22184 37.379Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.22184 31.379C4.57365 30.9462 5.21874 30.8734 5.66269 31.2164L7.28501 32.4698C8.18692 33.1667 9.47586 33.1159 10.3171 32.3503L10.4064 32.2691C12.0381 30.7843 14.5701 30.7843 16.2017 32.2691C17.0452 33.0366 18.3541 33.0366 19.1976 32.2691C20.8293 30.7843 23.3612 30.7843 24.9929 32.2691C25.8287 33.0297 27.1568 33.0262 28.008 32.2516C29.6105 30.7933 32.1282 30.7622 33.7461 32.2345L33.8162 32.2983C34.6201 33.0298 35.874 33.0088 36.6515 32.2506C38.1635 30.7765 40.5845 30.6859 42.208 32.0426L43.6418 33.2408C44.0719 33.6003 44.1217 34.2315 43.7531 34.6509C43.3844 35.0702 42.7369 35.1187 42.3069 34.7593L40.873 33.5611C40.0634 32.8845 38.856 32.9297 38.102 33.6648C36.5428 35.185 34.0286 35.2273 32.4166 33.7604L32.3465 33.6966C31.532 32.9555 30.2374 32.9586 29.4076 33.7137C27.7837 35.1915 25.2325 35.2229 23.5932 33.7311C22.7497 32.9636 21.4408 32.9636 20.5973 33.7311C18.9656 35.2159 16.4337 35.2159 14.802 33.7311C13.9585 32.9636 12.6496 32.9636 11.8061 33.7311L11.7168 33.8124C10.1337 35.253 7.70818 35.3486 6.011 34.0373L4.38867 32.7838C3.94473 32.4408 3.87003 31.8119 4.22184 31.379Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );