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="M30.8285 28.7574L23.7574 35.8284L22.3432 34.4142L29.4143 27.3432L30.8285 28.7574Z" fill="black"/>
<path d="M27.2929 37.9498L32.9498 32.2929L31.5356 30.8787L25.8787 36.5356L27.2929 37.9498Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M11 16.6155C9.95022 16.1163 9.04916 15.5363 8.36933 14.8753C7.55855 14.087 7 13.1167 7 12C7 10.7829 7.66135 9.74312 8.59395 8.91627C9.52772 8.08839 10.8218 7.38853 12.3352 6.82103C15.3692 5.68327 19.4936 5 24 5C28.5064 5 32.6308 5.68327 35.6648 6.82103C37.1782 7.38853 38.4723 8.08839 39.406 8.91627C40.3386 9.74312 41 10.7829 41 12C41 13.1167 40.4415 14.087 39.6307 14.8753C38.9508 15.5363 38.0498 16.1163 37 16.6155V37.5352L33.4299 39.9153C27.7196 43.7221 20.2804 43.7221 14.5701 39.9152L11 37.5352V16.6155ZM9 12C9 11.5603 9.23408 11.0216 9.92077 10.4128C10.6063 9.80501 11.6553 9.21198 13.0374 8.69369C15.7943 7.65987 19.6699 7 24 7C28.3301 7 32.2057 7.65987 34.9626 8.69369C36.3447 9.21198 37.3937 9.80501 38.0792 10.4128C38.7659 11.0216 39 11.5603 39 12C39 12.4049 38.8033 12.8902 38.2364 13.4414C37.9195 13.7495 37.5067 14.0572 37 14.3558V14C37 12.3431 35.6569 11 34 11H14C12.3431 11 11 12.3431 11 14V14.3558C10.4933 14.0572 10.0805 13.7495 9.76358 13.4414C9.19673 12.8902 9 12.4049 9 12ZM15.6795 38.2511L13 36.4648V17H35V36.4648L32.3205 38.2512C27.282 41.6101 20.718 41.6101 15.6795 38.2511Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );