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="M5.79274 7.70718L7.20695 6.29297L21.1706 20.2567C21.2809 20.2014 21.4016 20.1439 21.5312 20.0863C22.1497 19.8114 23.0483 19.5001 23.9998 19.5001C24.9514 19.5001 25.85 19.8114 26.4685 20.0863C26.5981 20.1439 26.7188 20.2014 26.8291 20.2566L40.7927 6.29297L42.207 7.70718L27.1273 22.7869L26.4471 22.3334L26.4458 22.3326L26.4405 22.3291C26.4335 22.3246 26.4213 22.3168 26.4042 22.3062C26.3698 22.2848 26.3161 22.2522 26.2459 22.2121C26.1047 22.1314 25.9007 22.0226 25.6562 21.9139C25.1497 21.6888 24.5483 21.5001 23.9998 21.5001C23.4514 21.5001 22.85 21.6888 22.3435 21.9139C22.099 22.0226 21.8949 22.1314 21.7538 22.2121C21.6836 22.2522 21.6299 22.2848 21.5955 22.3062C21.5784 22.3168 21.5662 22.3246 21.5592 22.3291L21.5533 22.3329L21.5524 22.3335L20.8724 22.7869L5.79274 7.70718Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M23.4274 29.5555C23.1954 29.8121 23.0998 30.0983 23.0998 30.2645C23.0998 30.418 23.1844 30.6607 23.3986 30.8786C23.6049 31.0884 23.8585 31.2 24.0998 31.2C24.3411 31.2 24.5947 31.0884 24.801 30.8786C25.0152 30.6607 25.0998 30.418 25.0998 30.2645C25.0998 30.0983 25.0042 29.8121 24.7722 29.5555C24.5473 29.3067 24.2994 29.2 24.0998 29.2C23.9002 29.2 23.6523 29.3067 23.4274 29.5555ZM21.9438 28.2142C22.4427 27.6624 23.1948 27.2 24.0998 27.2C25.0047 27.2 25.7569 27.6624 26.2558 28.2142C26.7477 28.7584 27.0998 29.5044 27.0998 30.2645C27.0998 31.0375 26.7367 31.7625 26.227 32.2808C25.7095 32.8072 24.9631 33.2 24.0998 33.2C23.2365 33.2 22.4901 32.8072 21.9726 32.2808C21.4629 31.7625 21.0998 31.0375 21.0998 30.2645C21.0998 29.5044 21.4519 28.7584 21.9438 28.2142Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.0427 37.2108C26.558 40.4218 30.2564 41.4628 33.934 40.3308C37.9619 39.0911 41.8053 35.3082 44.1311 29.3645L42.2686 28.6357C40.0944 34.192 36.6278 37.4091 33.3456 38.4193C30.1369 39.407 26.9541 38.347 24.9373 34.9856L24.1243 33.6306L23.2477 34.9454C20.9811 38.3454 17.6225 39.4087 14.382 38.4187C11.0847 37.4114 7.72049 34.2091 5.79439 28.6716L3.9054 29.3286C5.9793 35.2911 9.72999 39.0888 13.7977 40.3314C17.5074 41.4648 21.3238 40.4165 24.0427 37.2108Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );