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="M19.8896 12.0061C20.4385 11.9451 20.9329 12.3407 20.9939 12.8896L21.9939 21.8896C22.0549 22.4385 21.6593 22.9329 21.1104 22.9939C20.5615 23.0549 20.0671 22.6593 20.0061 22.1104L19.0061 13.1104C18.9451 12.5615 19.3407 12.0671 19.8896 12.0061Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.3878 11C13.5411 17.1072 15.5999 18.23 20.3265 19L20.027 16.0646L19.6143 15.0774C21.2267 14.4032 22.5854 14.0076 23.9941 14.0001C25.4075 13.9926 26.7714 14.3762 28.3984 15.0828L27.9733 16.0614L27.6735 19C32.4001 18.23 34.4589 17.1072 34.6122 11C41.1429 11 44 17.5 44 27C36.6672 25.1247 32.5 29.5 32.5 33.4H27L24 39L21 33.4H15.5C15.5 29.5 11.3328 25.1247 4 27C4 17.5 6.85714 11 13.3878 11Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M28.1104 12.0061C27.5615 11.9451 27.0671 12.3407 27.0061 12.8896L26.0061 21.8896C25.9451 22.4385 26.3407 22.9329 26.8896 22.9939C27.4385 23.0549 27.9329 22.6593 27.9939 22.1104L28.9939 13.1104C29.0549 12.5615 28.6593 12.0671 28.1104 12.0061Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );