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="M26.3427 14.9744C28.8209 14.9744 30.8299 12.9654 30.8299 10.4872C30.8299 8.00898 28.8209 6 26.3427 6C23.8645 6 21.8555 8.00898 21.8555 10.4872C21.8555 12.9654 23.8645 14.9744 26.3427 14.9744ZM26.3427 12.9744C27.7164 12.9744 28.8299 11.8608 28.8299 10.4872C28.8299 9.11355 27.7164 8 26.3427 8C24.9691 8 23.8555 9.11355 23.8555 10.4872C23.8555 11.8608 24.9691 12.9744 26.3427 12.9744Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 28C8.89543 28 8 28.8954 8 30V42H6V30C6 27.7909 7.79086 26 10 26H16.9113C16.4171 20.9691 17.4713 16.9171 20.5425 15.2686C20.5808 15.248 20.6205 15.23 20.6611 15.2146L20.6861 15.2051C21.992 14.7198 23.399 14.7474 24.6631 15.401C25.8646 16.0222 26.6745 17.0704 27.1819 18.1602C27.3695 18.563 27.543 18.9392 27.705 19.2907C28.0998 20.1471 28.4228 20.8475 28.7309 21.4597C29.1664 22.325 29.4811 22.8243 29.7547 23.143C29.9864 23.4129 30.181 23.5452 30.4307 23.6427C30.7308 23.7599 31.2318 23.8716 32.1398 23.8988C33.3799 23.936 34.392 24.8324 34.6224 26H38C40.2091 26 42 27.7909 42 30V42H40V30C40 28.8954 39.1046 28 38 28H34.2035C33.7163 28.698 32.8977 29.1443 31.9833 29.1168C30.7594 29.0801 29.6003 28.9228 28.5315 28.5053C28.163 28.3614 27.8201 28.1924 27.4997 28H25.3743L25.37 28.0225L29.2501 31.8511C29.51 32.1075 29.7132 32.4156 29.8465 32.7555L32.076 38.4359C32.6027 39.7778 31.9418 41.2925 30.5999 41.8192C29.258 42.3459 27.7432 41.685 27.2165 40.3431L25.1894 35.1782L18.1519 28.2342C18.0767 28.16 18.0066 28.0818 17.9416 28H10ZM20.7621 28L26.7451 33.9035C26.8447 34.0018 26.9225 34.1198 26.9736 34.25L29.0783 39.6124C29.2014 39.9261 29.5555 40.0806 29.8692 39.9575C30.1829 39.8344 30.3374 39.4803 30.2143 39.1666L27.9848 33.4862C27.9536 33.4067 27.9061 33.3347 27.8454 33.2748L23.5851 29.071C23.3475 28.8366 23.2425 28.4991 23.3052 28.1713L23.338 28H20.7621ZM23.7207 26L24.1854 23.5711C24.2652 23.1536 24.6003 22.8322 25.0208 22.7699C25.4413 22.7075 25.8553 22.9178 26.0529 23.2941C26.4552 24.0602 26.8558 24.71 27.3111 25.2405C27.8536 25.8725 28.473 26.3353 29.2591 26.6424C30.0336 26.9448 30.9406 27.0847 32.0433 27.1177C32.3801 27.1278 32.6614 26.863 32.6715 26.5261C32.6816 26.1893 32.4167 25.908 32.0798 25.8979C31.0511 25.8671 30.2979 25.7379 29.7031 25.5056C29.1205 25.2781 28.6619 24.9406 28.2371 24.4456C27.8024 23.9392 27.4007 23.2655 26.9444 22.3587C26.6193 21.7127 26.2825 20.9823 25.8942 20.14L25.8887 20.128C25.7265 19.7762 25.5546 19.4033 25.3689 19.0045C24.9898 18.1904 24.4455 17.54 23.7445 17.1775C23.0428 16.8147 22.2447 16.7727 21.4307 17.0624C19.5303 18.1277 18.4096 21.021 18.913 25.916C18.9157 25.942 18.921 25.9701 18.9293 26H23.7207Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.557 30.8997C18.3052 30.6582 17.9458 30.5654 17.6086 30.6548C17.2714 30.7442 17.0051 31.0028 16.906 31.3373L15.9229 34.6548L14.005 37.5439C13.0887 38.9243 13.4649 40.7861 14.8453 41.7025C16.2257 42.6188 18.0875 42.2426 19.0039 40.8622L21.1707 37.5981C21.3358 37.3494 21.4629 37.0774 21.5477 36.7912L22.0722 35.0214C22.1785 34.6627 22.0756 34.2746 21.8056 34.0156L18.557 30.8997ZM17.7978 35.3669L18.3572 33.4793L19.9815 35.0373L19.6301 36.223C19.6018 36.3184 19.5595 36.409 19.5045 36.4919L17.3376 39.7561C17.0321 40.2162 16.4115 40.3416 15.9514 40.0362C15.4913 39.7307 15.3659 39.1101 15.6713 38.65L17.6722 35.6359C17.7272 35.553 17.7695 35.4623 17.7978 35.3669Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );