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="M8 6C8 11.1689 13.5442 17.0268 22.0905 17.803L23 17.8856V31.5C22.9974 33.5586 22.9677 35.7857 22.6434 37.5469C22.4693 38.4921 22.175 39.5242 21.5962 40.3622C20.9503 41.2972 19.9277 42 18.5628 42C17.4272 42 16.2781 41.5045 15.3253 40.9176C14.3195 40.2981 13.2994 39.433 12.3854 38.3951C10.5741 36.3382 9 33.3892 9 30.0075C9 27.0416 9.51599 24.2613 10.4301 22.1477C10.8857 21.0942 11.4797 20.1148 12.241 19.3702C12.9699 18.6574 13.9434 18.0801 15.1188 18.02C9.59075 15.5043 6 10.7866 6 6H8Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M25.9095 17.803C34.4558 17.0268 40 11.1689 40 6H42C42 10.7866 38.4092 15.5043 32.8812 18.02C34.0566 18.0802 35.0301 18.6574 35.759 19.3702C36.5203 20.1148 37.1143 21.0942 37.5699 22.1477C38.484 24.2613 39 27.0416 39 30.0075C39 33.3892 37.4259 36.3382 35.6146 38.3951C34.7006 39.433 33.6805 40.2981 32.6747 40.9176C31.7219 41.5045 30.5728 42 29.4372 42C28.0723 42 27.0497 41.2972 26.4038 40.3622C25.825 39.5242 25.5307 38.4921 25.3566 37.5469C25.0323 35.7857 25.0028 33.5586 25.0002 31.5L25 17.8856L25.9095 17.803ZM37 30.0075C37 30.0075 37 30.0075 37 30.0075V30.0075Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );