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="M15 16.5C15 15.1193 16.1193 14 17.5 14C18.6923 14 19.6896 14.8346 19.9396 15.9515C20.2302 14.829 21.2494 13.9997 22.4628 13.9987C23.9034 13.9975 25.0722 15.1644 25.0734 16.605C25.0746 18.0456 23.9077 19.2144 22.4671 19.2155C21.2131 19.2166 20.165 18.3325 19.9138 17.1532C19.6266 18.2171 18.6547 19 17.5 19C16.1193 19 15 17.8807 15 16.5ZM17.5 16C17.2239 16 17 16.2239 17 16.5C17 16.7761 17.2239 17 17.5 17C17.7761 17 18 16.7761 18 16.5C18 16.2239 17.7761 16 17.5 16ZM21.8565 16.6076C21.8563 16.2716 22.1284 15.999 22.4645 15.9987C22.8005 15.9984 23.0731 16.2706 23.0734 16.6066C23.0737 16.9426 22.8015 17.2153 22.4655 17.2155C22.1294 17.2158 21.8568 16.9436 21.8565 16.6076Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.4615 21.8347C14 21.8347 12.6154 21.3825 12.6154 19.3476C12.6154 18.5425 12.3625 18.1622 12.0569 17.7024C11.59 17.0001 11 16.1125 11 13.243C11 3.58566 29 3.58566 29 13.243C29 16.1125 28.41 17.0001 27.9431 17.7024C27.6375 18.1622 27.3846 18.5425 27.3846 19.3476C27.3846 21.3825 25.5769 21.8347 25.5385 21.8347C25.5 21.8347 24.9231 23.1912 24.9231 24.0956C24.9231 25 22.3077 25 20 25C17.6923 25 15.0769 25 15.0769 24.0956C15.0769 23.1912 14.9231 21.8347 14.4615 21.8347ZM14.6874 19.8307C14.6898 19.8363 14.6922 19.8414 14.6944 19.8459C15.7743 19.9517 16.3246 20.7757 16.4964 21.0817C16.7214 21.4825 16.8347 21.9096 16.8986 22.21C16.947 22.438 16.9837 22.6761 17.0107 22.9125C17.7989 22.9971 18.8542 23 20 23C21.1836 23 22.2706 22.9969 23.0664 22.9038C23.1431 22.5546 23.2377 22.2402 23.3169 21.9999C23.4077 21.7243 23.5021 21.4764 23.5828 21.2847C23.6217 21.1923 23.6662 21.092 23.7126 20.9993C23.7324 20.9598 23.7731 20.8801 23.8285 20.7913C23.8512 20.755 23.9154 20.6532 24.0136 20.5384C24.0596 20.4847 24.1647 20.3664 24.3236 20.2452C24.3971 20.1892 24.6558 19.9932 25.0558 19.8937L25.0621 19.891C25.1078 19.8716 25.1685 19.8392 25.2224 19.7958C25.2721 19.7559 25.3039 19.7168 25.3254 19.6752C25.3431 19.641 25.3846 19.548 25.3846 19.3476C25.3846 17.8638 26.0422 16.9175 26.3528 16.4705C26.4041 16.3966 26.446 16.3364 26.4738 16.2896C26.6474 15.9981 27 15.3589 27 13.243C27 11.5415 26.2439 10.3101 25.0239 9.4374C23.7446 8.52225 21.9261 8 20 8C18.0739 8 16.2554 8.52225 14.9761 9.4374C13.7561 10.3101 13 11.5415 13 13.243C13 15.3589 13.3526 15.9981 13.5262 16.2896C13.554 16.3364 13.5959 16.3966 13.6472 16.4705C13.9578 16.9175 14.6154 17.8638 14.6154 19.3476C14.6154 19.6272 14.6623 19.7707 14.6849 19.8248C14.6857 19.8268 14.6865 19.8288 14.6874 19.8307Z" fill="black"/>
<path d="M7 42C6.44772 42 6 41.5523 6 41V6H8V35H11.0523C17.6037 35 23.406 33.6319 27.8954 30.4676C32.0479 27.5408 35.1717 23.0109 36.6981 16.3624L34.5655 17.8247C34.11 18.1371 33.4876 18.021 33.1753 17.5655C32.8629 17.11 32.979 16.4876 33.4345 16.1753L37.8095 13.1753C38.0451 13.0137 38.3385 12.9606 38.6157 13.0294C38.893 13.0982 39.1276 13.2822 39.2604 13.5352L41.8854 18.5352C42.1421 19.0242 41.9538 19.6287 41.4648 19.8854C40.9758 20.1421 40.3713 19.9538 40.1146 19.4648L38.6696 16.7124C37.057 23.8232 33.6809 28.8367 29.0476 32.1024C24.1117 35.5814 17.8585 37 11.0523 37H8V40H42V42H7Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );