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="M39.9886 38H35.9774C35.9775 37.8505 35.9438 37.6987 35.8727 37.5556L31.642 29.0509L44 29.9311V34C44 36.2091 42.204 38 39.9886 38ZM36.8199 33.8021C37.3737 33.8021 37.8227 33.3544 37.8227 32.8021C37.8227 32.2498 37.3737 31.8021 36.8199 31.8021C36.266 31.8021 35.817 32.2498 35.817 32.8021C35.817 33.3544 36.266 33.8021 36.8199 33.8021Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M33.2097 20.0273L31.2535 27.0182L44 27.926V19.093L33.8071 19.9978L33.2097 20.0273ZM35.817 24.8021C35.817 25.3544 35.368 25.8021 34.8141 25.8021C34.2603 25.8021 33.8113 25.3544 33.8113 24.8021C33.8113 24.2498 34.2603 23.8021 34.8141 23.8021C35.368 23.8021 35.817 24.2498 35.817 24.8021Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.1397 27.8758L29.142 27.1223L31.0982 20.1314L16.1785 20.8672L18.1397 27.8758ZM23.7827 25.8021C24.3366 25.8021 24.7856 25.3544 24.7856 24.8021C24.7856 24.2498 24.3366 23.8021 23.7827 23.8021C23.2288 23.8021 22.7798 24.2498 22.7798 24.8021C22.7798 25.3544 23.2288 25.8021 23.7827 25.8021Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M29.4311 29.1073L18.232 29.8742L15.9583 38H33.8548L29.4311 29.1073ZM25.606 34C26.1599 34 26.6089 33.5523 26.6089 33C26.6089 32.4477 26.1599 32 25.606 32C25.0522 32 24.6032 32.4477 24.6032 33C24.6032 33.5523 25.0522 34 25.606 34Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.1246 20.9685L16.0856 27.9768L4 27.0801V19.0456L13.3816 21.0051L14.1246 20.9685ZM10.9081 24.2023C10.9081 24.7546 10.4591 25.2023 9.90526 25.2023C9.3514 25.2023 8.9024 24.7546 8.9024 24.2023C8.9024 23.65 9.3514 23.2023 9.90526 23.2023C10.4591 23.2023 10.9081 23.65 10.9081 24.2023Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.1187 29.9848L4 29.0857V34C4 36.2091 5.79598 38 8.01143 38H13.914C13.914 37.9112 13.926 37.8209 13.9511 37.7312L16.1187 29.9848ZM11.9085 34.3668C12.4624 34.3668 12.9114 33.9191 12.9114 33.3668C12.9114 32.8145 12.4624 32.3668 11.9085 32.3668C11.3547 32.3668 10.9057 32.8145 10.9057 33.3668C10.9057 33.9191 11.3547 34.3668 11.9085 34.3668Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M44 17.0851L33.6686 18.0022L33.2461 18.023L31.0011 10H39.9886C42.204 10 44 11.7909 44 14V17.0851ZM38.8256 14.8021C38.8256 15.3544 38.3766 15.8021 37.8227 15.8021C37.2689 15.8021 36.8199 15.3544 36.8199 14.8021C36.8199 14.2498 37.2689 13.8021 37.8227 13.8021C38.3766 13.8021 38.8256 14.2498 38.8256 14.8021Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M31.1921 18.1243L28.994 10.2688C28.9689 10.1791 28.9569 10.0888 28.9569 10H20.9345C20.9346 10.1495 20.901 10.3013 20.8298 10.4444L16.6527 18.8414L31.1921 18.1243ZM27.7941 14.8021C27.7941 15.3544 27.3451 15.8021 26.7913 15.8021C26.2374 15.8021 25.7884 15.3544 25.7884 14.8021C25.7884 14.2498 26.2374 13.8021 26.7913 13.8021C27.3451 13.8021 27.7941 14.2498 27.7941 14.8021Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.3575 18.9546L18.8119 10H8.01143C5.79598 10 4 11.7909 4 14V17.0065C4.03034 17.01 4.06079 17.0149 4.09127 17.0212L13.5402 18.9949L14.3575 18.9546ZM12.7513 15.8021C13.3051 15.8021 13.7541 15.3544 13.7541 14.8021C13.7541 14.2498 13.3051 13.8021 12.7513 13.8021C12.1974 13.8021 11.7484 14.2498 11.7484 14.8021C11.7484 15.3544 12.1974 15.8021 12.7513 15.8021Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );