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.36314 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.4579 34.3201 37.894 37.4269L34.4736 34.0067L33.0594 35.4209L36.5366 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.1967 35.6232L12.7825 34.209L9.86416 37.1274C7.44565 34.0662 6.00246 30.2022 6 26H10.0527V24H6.10881Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.5659 31.1361L24.4927 36.5687C24.8684 36.685 25.2735 36.6601 25.6321 36.4988L28.2208 35.1261C28.953 34.1406 29.066 33.6535 28.8014 32.6245L27.0819 30.2519C26.831 29.9492 26.4782 29.7484 26.0898 29.6873L12.1066 28.8865C10.1289 28.5756 9.6534 30.5441 11.5659 31.1361ZM25.6357 31.6646L16.7788 31.1574L24.9555 34.5938L26.8546 33.5867C26.8974 33.5175 26.9195 33.4745 26.9302 33.4515L25.6357 31.6646ZM26.9314 33.4814C26.9312 33.4811 26.9311 33.4779 26.9315 33.4721C26.9317 33.4787 26.9315 33.4816 26.9314 33.4814ZM11.6907 30.8535L11.6874 30.8538C11.6874 30.8538 11.6885 30.8537 11.6907 30.8535Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );