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="M24.0013 6C24.5536 6 25.0013 6.44772 25.0013 7V13.5646C25.7316 14.1175 26.3665 15.2606 26.8263 16.7845L29.5 14.2381V11.3333C29.5 11.0597 29.6122 10.7979 29.8103 10.6092L33.3103 7.27586C33.7103 6.89498 34.3433 6.91041 34.7241 7.31034C35.105 7.71028 35.0896 8.34325 34.6897 8.72414L31.5 11.7619V14.6667C31.5 14.9403 31.3878 15.2021 31.1897 15.3908L27.6897 18.7241C27.5796 18.829 27.4518 18.9038 27.3165 18.9488C27.375 19.3092 27.4252 19.681 27.4664 20.0626L41.8917 22C42.3429 23.6667 41.6209 27 35.1227 27C30.6997 27 28.5346 24.8379 27.6028 22.7213C27.6001 23.6917 27.5416 24.6273 27.4355 25.5072L32.9373 30.6851C33.19 30.923 33.3013 31.2748 33.2314 31.6147L32.5121 35.1139L35.4259 36.4854C35.9256 36.7206 36.14 37.3163 35.9048 37.816C35.6696 38.3157 35.0738 38.5302 34.5741 38.295L30.9482 36.5883C30.5304 36.3916 30.3015 35.9345 30.3945 35.4821L31.16 31.7589L27.009 27.8522C26.8506 28.4818 26.6643 29.0588 26.4547 29.5709L28.3763 31.7523C28.614 32.0221 28.6885 32.3987 28.5716 32.7386L27.3144 36.3932L29.9913 40.4492C30.2955 40.9101 30.1684 41.5304 29.7075 41.8346C29.2466 42.1388 28.6263 42.0118 28.3221 41.5508L25.374 37.0842C25.2031 36.8252 25.1621 36.5015 25.263 36.208L26.4912 32.638L25.3843 31.3815C24.9585 31.8467 24.4914 32.1035 24.0014 32.1035C23.5109 32.1035 23.0432 31.8461 22.6171 31.3799L21.5088 32.638L22.737 36.208C22.8379 36.5015 22.7969 36.8252 22.626 37.0842L19.6779 41.5508C19.3737 42.0118 18.7534 42.1388 18.2925 41.8346C17.8316 41.5304 17.7045 40.9101 18.0087 40.4492L20.6856 36.3932L19.4284 32.7386C19.3115 32.3987 19.386 32.0221 19.6237 31.7523L21.5472 29.5688C21.3377 29.0566 21.1515 28.4797 20.9933 27.8501L16.84 31.7589L17.6055 35.4821C17.6985 35.9345 17.4696 36.3916 17.0518 36.5883L13.4259 38.295C12.9262 38.5302 12.3304 38.3157 12.0952 37.816C11.86 37.3163 12.0744 36.7206 12.5741 36.4854L15.4879 35.1139L14.7686 31.6147C14.6987 31.2748 14.81 30.923 15.0627 30.6851L20.567 25.5048C20.4608 24.6237 20.4024 23.6868 20.3999 22.715C19.4697 24.8337 17.3047 27 12.8773 27C6.3791 27 5.65708 23.6667 6.10834 22L20.5364 20.0623C20.5776 19.6811 20.6277 19.3097 20.6861 18.9497C20.5498 18.9048 20.4211 18.8297 20.3103 18.7241L16.8103 15.3908C16.6122 15.2021 16.5 14.9403 16.5 14.6667V11.7619L13.3103 8.72414C12.9104 8.34325 12.895 7.71028 13.2759 7.31035C13.6567 6.91042 14.2897 6.89498 14.6897 7.27586L18.1897 10.6092C18.3878 10.7979 18.5 11.0597 18.5 11.3333V14.2381L21.1759 16.7865C21.6357 15.2617 22.2708 14.1178 23.0013 13.5647V7C23.0013 6.44772 23.4491 6 24.0013 6ZM8.37416 23.788C8.78146 24.2411 9.92436 25 12.8773 25C15.591 25 17.0375 24.054 17.8406 23.0927C18.033 22.8625 18.197 22.6209 18.3357 22.3758L8.31741 23.7213C8.33542 23.7436 8.35432 23.7659 8.37416 23.788ZM39.6258 23.788C39.2185 24.2411 38.0756 25 35.1227 25C32.409 25 30.9625 24.054 30.1594 23.0927C29.967 22.8625 29.803 22.6209 29.6643 22.3758L39.6826 23.7213C39.6646 23.7436 39.6457 23.7659 39.6258 23.788ZM25.6029 22.6495C25.6029 25.0807 25.224 27.192 24.6791 28.6225C24.4396 29.2511 24.1973 29.6709 24.0014 29.9214C23.8055 29.6709 23.5632 29.2511 23.3237 28.6225C22.7787 27.192 22.3998 25.0807 22.3998 22.6495C22.3998 20.2182 22.7787 18.107 23.3237 16.6764C23.5632 16.0478 23.8055 15.628 24.0014 15.3776C24.1973 15.628 24.4396 16.0478 24.6791 16.6764C25.224 18.107 25.6029 20.2182 25.6029 22.6495Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );