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="M6.10881 24C6.55678 19.9303 8.36313 16.2691 11.065 13.4793L14.1214 16.5355L15.5356 15.1213L12.5348 12.1207C15.4086 9.74502 19.0332 8.24437 23 8.02729L23 13L25 13L25 8.02729C28.9668 8.24436 32.5915 9.74505 35.4653 12.1208L32.5858 14.9999L33.9999 16.4142L36.9351 13.4794C39.6369 16.2692 41.4432 19.9303 41.8912 24H37.6843V26H42C41.9975 30.3403 40.4578 34.3201 37.8939 37.427L34.4735 34.0067L33.0593 35.4209L36.5365 38.898L36.5239 38.9103L37.9152 40.3471C41.6663 36.7148 44 31.6236 44 25.9892C44 14.949 35.0452 6 24 6C12.9548 6 4 14.949 4 25.9892C4 31.4741 6.21161 36.4446 9.78969 40.0553L11.2103 38.6475C11.204 38.6412 11.1978 38.6349 11.1915 38.6285L14.1968 35.6232L12.7825 34.209L9.86419 37.1275C7.44566 34.0662 6.00246 30.2022 6 26H10.0527V24H6.10881Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M22.9961 23.8839L20.6265 37.7042C20.5982 38.0964 20.714 38.4854 20.9522 38.7983L22.8746 41.0096C24.0001 41.5001 24.5001 41.5001 25.4427 41.0096L27.3651 38.7983C27.6033 38.4854 27.7191 38.0964 27.6908 37.7042L25.3096 23.9021C25.1654 21.9052 23.1404 21.8871 22.9961 23.8839ZM25.662 37.7089L24.1538 28.9666L22.6549 37.7085L24.0653 39.3308C24.1424 39.3568 24.1893 39.3686 24.2141 39.3738L25.662 37.7089ZM24.1853 39.3817C24.1854 39.3815 24.1886 39.3807 24.1943 39.3798C24.1879 39.3815 24.1851 39.3819 24.1853 39.3817ZM23.2995 23.9416L23.2985 23.9385C23.2985 23.9384 23.2989 23.9394 23.2995 23.9416Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );