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="M24 14C15.9066 14 9.84121 18.5478 6.62527 22.1883C5.69864 23.2372 5.69864 24.7628 6.62527 25.8117C9.84121 29.4522 15.9066 34 24 34C32.0933 34 38.1587 29.4522 41.3746 25.8117C42.3013 24.7628 42.3013 23.2372 41.3746 22.1883C38.1587 18.5478 32.0933 14 24 14ZM5.12635 20.8642C8.56639 16.97 15.134 12 24 12C32.8659 12 39.4335 16.97 42.8736 20.8642C44.4683 22.6695 44.4683 25.3305 42.8736 27.1358C39.4335 31.03 32.8659 36 24 36C15.134 36 8.56639 31.03 5.12635 27.1358C3.53161 25.3305 3.53161 22.6695 5.12635 20.8642Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M31.0491 16.9071C27.1317 13.014 20.8001 13.0336 16.907 16.951L15.4884 15.5412C20.1601 10.8404 27.7581 10.8167 32.4589 15.4885C37.1597 20.1602 37.1833 27.7581 32.5116 32.4589L31.093 31.0491C34.9861 27.1318 34.9664 20.8001 31.0491 16.9071Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.29285 9.29289C9.68337 8.90237 10.3165 8.90237 10.7071 9.29289L38.7071 37.2929C39.0976 37.6834 39.0976 38.3166 38.7071 38.7071C38.3165 39.0976 37.6834 39.0976 37.2928 38.7071L9.29285 10.7071C8.90232 10.3166 8.90232 9.68342 9.29285 9.29289Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M29.4154 21.4129C29.0534 21.7756 28.5529 22 27.9999 22C27.7958 22 27.5987 21.9694 27.4132 21.9125C28.3636 23.4635 28.1583 25.519 26.8067 26.85L28.2101 28.275C30.083 26.4305 30.4885 23.6587 29.4154 21.4129ZM26.587 18.5845C24.3722 17.5267 21.6398 17.9033 19.79 19.725L21.1933 21.15C22.5297 19.8339 24.557 19.6492 26.0874 20.5867C26.0305 20.4012 25.9999 20.2042 25.9999 20C25.9999 19.4471 26.2243 18.9466 26.587 18.5845Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M28 19C27.4477 19 27 19.4477 27 20C27 20.5523 27.4477 21 28 21C28.5522 21 29 20.5523 29 20C29 19.4477 28.5522 19 28 19ZM25 20C25 18.3431 26.3431 17 28 17C29.6568 17 31 18.3431 31 20C31 21.6569 29.6568 23 28 23C26.3431 23 25 21.6569 25 20Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 16C12 15.4477 12.4477 15 13 15L16 15C16.5522 15 17 15.4477 17 16C17 16.5523 16.5522 17 16 17H13C12.4477 17 12 16.5523 12 16Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.99996 28C6.99996 27.4477 7.44767 27 7.99996 27H28C28.5522 27 29 27.4477 29 28C29 28.5523 28.5522 29 28 29H7.99996C7.44767 29 6.99996 28.5523 6.99996 28Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 32C12 31.4477 12.4477 31 13 31L32 31C32.5522 31 33 31.4477 33 32C33 32.5523 32.5522 33 32 33L13 33C12.4477 33 12 32.5523 12 32Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.99996 20C6.99996 19.4477 7.44767 19 7.99996 19L20 19C20.5522 19 21 19.4477 21 20C21 20.5523 20.5522 21 20 21L7.99996 21C7.44767 21 6.99996 20.5523 6.99996 20Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.99996 24C4.99996 23.4477 5.44767 23 5.99996 23L24 23C24.5522 23 25 23.4477 25 24C25 24.5523 24.5522 25 24 25L5.99995 25C5.44767 25 4.99996 24.5523 4.99996 24Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );