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="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.547C22.4693 38.4922 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.9177C14.3195 40.2981 13.2994 39.433 12.3854 38.3951C10.5741 36.3382 9 33.3892 9 30.0075C9 27.0417 9.51599 24.2614 10.4301 22.1477C10.8857 21.0942 11.4797 20.1148 12.241 19.3703C12.9699 18.6574 13.9434 18.0801 15.1189 18.02C9.59079 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.7865 38.4093 15.5042 32.8814 18.0199C34.0567 18.0801 35.0301 18.6573 35.759 19.3701C36.5203 20.1147 37.1143 21.0941 37.5699 22.1476C38.484 24.2612 39 27.0416 39 30.0074C39 33.3891 37.4259 36.3381 35.6146 38.395C34.7006 39.4329 33.6805 40.298 32.6747 40.9175C31.7219 41.5044 30.5728 41.9999 29.4372 41.9999C28.0723 41.9999 27.0497 41.2971 26.4038 40.3621C25.825 39.5241 25.5307 38.492 25.3566 37.5469C25.0323 35.7856 25.0028 33.5585 25.0002 31.5L25 17.8856L25.9095 17.803ZM27 30.9999C27 35.4924 27.0504 39.9999 29.4372 39.9999C29.9185 39.9999 30.5132 39.818 31.156 39.4823C30.5207 39.3086 29.9279 38.8991 29.5538 38.3132C28.927 37.3314 29.1311 36.1934 29.9849 35.6347C29.8743 35.0941 29.8446 34.5485 29.9017 34.0153C28.9839 33.2891 28.6626 32.1024 29.1952 31.2305C29.7278 30.3586 30.9303 30.1028 31.9954 30.5878C32.4437 30.2937 32.9426 30.0711 33.4741 29.9227C33.5815 28.908 34.5008 28.207 35.6605 28.3165C36.1385 28.3616 36.5893 28.538 36.9689 28.803C36.7117 23.8521 34.8889 20.0147 32.6784 20.0147L32.6269 20.0147C31.0187 20.0145 27 20.0139 27 21.9924V30.9999Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );