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="M19 16C19 17.1046 18.1046 18 17 18C15.8954 18 15 17.1046 15 16C15 14.8954 15.8954 14 17 14C18.1046 14 19 14.8954 19 16Z" fill="black"/>
<path d="M22.9645 18.2151C24.1281 18.2142 25.0705 17.2702 25.0695 16.1067C25.0686 14.9432 24.1246 14.0007 22.9611 14.0017C21.7976 14.0026 20.8551 14.9466 20.8561 16.1101C20.857 17.2737 21.801 18.2161 22.9645 18.2151Z" 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,
    );