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="M22.0826 5.18344C23.1034 4.91608 24.0001 5.7202 24.0001 6.68074C24.0001 7.38431 23.5394 7.95416 22.9446 8.171C20.6418 9.01065 19.0001 11.2199 19.0001 13.81C19.0001 17.1237 21.6864 19.81 25.0001 19.81C28.3138 19.81 31.0001 17.1237 31.0001 13.81C31.0001 11.2199 29.3584 9.01065 27.0555 8.171C26.4608 7.95416 26.0001 7.3843 26.0001 6.68074C26.0001 5.7202 26.8968 4.91608 27.9176 5.18344C32.5448 6.39544 36.0001 10.4428 36.0001 15.31C36.0001 16.7255 35.7062 18.0758 35.1747 19.3075C36.0428 19.456 36.9028 19.7205 37.735 20.1086C42.1461 22.1655 44.354 27.0075 43.4969 31.7135C43.3078 32.7516 42.2 33.2244 41.3295 32.8185C40.6919 32.5212 40.3701 31.8628 40.4249 31.2321C40.6372 28.7902 39.3288 26.3687 36.9813 25.274C33.9781 23.8736 30.4082 25.1729 29.0078 28.1762C27.6073 31.1794 28.9067 34.7493 31.9099 36.1497C34.2573 37.2444 36.9534 36.6901 38.6876 34.9579C39.1354 34.5105 39.8466 34.3338 40.4843 34.6311C41.3548 35.0371 41.7046 36.1896 41.0309 37.0017C37.9769 40.6833 32.8485 42.1043 28.4374 40.0473C27.075 39.412 25.9194 38.5075 25.0001 37.4219C24.0807 38.5075 22.9252 39.412 21.5628 40.0473C17.1516 42.1043 12.0232 40.6833 8.9692 37.0017C8.29549 36.1896 8.64531 35.0371 9.51585 34.6311C10.1535 34.3338 10.8647 34.5105 11.3125 34.9579C13.0467 36.6901 15.7428 37.2444 18.0902 36.1497C21.0935 34.7493 22.3928 31.1794 20.9924 28.1762C19.5919 25.1729 16.022 23.8736 13.0188 25.274C10.6714 26.3687 9.36295 28.7902 9.5752 31.2321C9.63001 31.8628 9.30826 32.5212 8.67061 32.8185C7.80008 33.2245 6.69232 32.7516 6.50324 31.7135C5.64612 27.0075 7.85404 22.1655 12.2652 20.1086C13.0973 19.7205 13.9574 19.456 14.8255 19.3074C14.294 18.0758 14.0001 16.7255 14.0001 15.31C14.0001 10.4428 17.4553 6.39544 22.0826 5.18344ZM17.9491 10.0274C16.7254 11.4837 16.0001 13.3233 16.0001 15.31C16.0001 16.8876 16.4544 18.3645 17.2494 19.6327C17.4412 19.9388 17.4531 20.3245 17.2805 20.6418C17.1078 20.9591 16.7774 21.1586 16.4162 21.1637C15.2995 21.1795 14.1776 21.4236 13.1104 21.9212C11.3099 22.7608 9.94916 24.1956 9.14646 25.9201C9.91115 24.8955 10.9332 24.0398 12.1736 23.4614C15.2132 22.044 18.6881 22.7008 21.0028 24.851C21.0543 23.4441 21.8324 22.2227 22.973 21.5509C19.5363 20.6534 17.0001 17.5279 17.0001 13.81C17.0001 12.4414 17.3437 11.1535 17.9491 10.0274ZM27.0271 21.5509C28.1677 22.2227 28.9458 23.4441 28.9973 24.851C31.312 22.7008 34.7869 22.044 37.8266 23.4614C39.0669 24.0398 40.089 24.8955 40.8537 25.9201C40.051 24.1956 38.6902 22.7608 36.8897 21.9212C35.8226 21.4236 34.7006 21.1795 33.584 21.1637C33.2228 21.1586 32.8924 20.9591 32.7197 20.6418C32.5471 20.3245 32.5589 19.9388 32.7508 19.6327C33.5458 18.3645 34.0001 16.8876 34.0001 15.31C34.0001 13.3233 33.2747 11.4837 32.0511 10.0274C32.6565 11.1535 33.0001 12.4414 33.0001 13.81C33.0001 17.5279 30.4638 20.6535 27.0271 21.5509ZM26.7254 28.6098C26.203 28.8599 25.6179 29 25 29C24.3822 29 23.7971 28.8599 23.2747 28.6098C24.2844 32.3006 22.5204 36.2907 18.9355 37.9623C17.6951 38.5407 16.3826 38.7736 15.1062 38.7008C16.9432 39.1944 18.917 39.0743 20.7175 38.2347C22.1754 37.5549 23.3389 36.4912 24.1549 35.2011C24.3382 34.9114 24.6572 34.7357 25.0001 34.7357C25.3429 34.7357 25.6619 34.9114 25.8452 35.2011C26.6612 36.4912 27.8247 37.5549 29.2826 38.2347C31.0831 39.0743 33.0569 39.1944 34.8939 38.7008C33.6175 38.7736 32.305 38.5407 31.0647 37.9623C27.4797 36.2907 25.7157 32.3006 26.7254 28.6098ZM25 23C23.8955 23 23 23.8954 23 25C23 26.1046 23.8955 27 25 27C26.1046 27 27 26.1046 27 25C27 23.8954 26.1046 23 25 23Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.4756 31.5989C20.3713 32.1748 20.1667 32.7291 19.8718 33.2349C19.8214 33.3212 19.7684 33.4062 19.7128 33.4896C19.5428 33.3834 19.3761 33.2723 19.213 33.1564C18.8291 32.8835 18.4653 32.5841 18.1242 32.261C16.8336 31.0385 15.8687 29.4756 15.3733 27.716C15.2525 27.2869 15.1596 26.8461 15.0967 26.3957C15.0664 26.1788 15.043 25.9596 15.0269 25.7384C15.1355 25.7269 15.2441 25.719 15.3525 25.7147C15.9331 25.6914 16.509 25.7704 17.0548 25.9422C17.0547 25.9422 17.0548 25.9423 17.0548 25.9422C17.3301 28.2886 18.6209 30.3247 20.4756 31.5989C20.4756 31.5988 20.4756 31.5989 20.4756 31.5989ZM34.6476 25.7147C34.0671 25.6914 33.4911 25.7704 32.9453 25.9422C32.9452 25.9423 32.9454 25.9422 32.9453 25.9422C32.67 28.2886 31.3792 30.3245 29.5245 31.5986C29.5244 31.5985 29.5245 31.5987 29.5245 31.5986C29.6288 32.1746 29.8334 32.7292 30.1284 33.2349C30.1787 33.3213 30.2317 33.4062 30.2873 33.4895C30.4573 33.3834 30.624 33.2723 30.787 33.1564C31.171 32.8835 31.5348 32.5842 31.8759 32.261C33.1665 31.0385 34.1314 29.4756 34.6268 27.716C34.7476 27.2869 34.8405 26.846 34.9034 26.3955C34.9337 26.1786 34.9571 25.9595 34.9732 25.7384C34.8646 25.7269 34.756 25.719 34.6476 25.7147ZM22.4168 15.3369C21.7587 15.5123 21.1272 15.7533 20.5299 16.0523C20.8421 16.6736 21.2801 17.2208 21.8104 17.6606C21.8103 17.6605 21.8106 17.6607 21.8104 17.6606C22.7411 17.2556 23.7642 17.0228 24.8388 17.0016C24.8924 17.0005 24.9462 17 25 17C25.0504 17 25.1006 17.0005 25.1507 17.0014C26.2292 17.0213 27.2556 17.2547 28.1893 17.661C28.1891 17.6611 28.1894 17.6609 28.1893 17.661C28.7196 17.2212 29.158 16.6736 29.4703 16.0523C28.873 15.7533 28.2415 15.5124 27.5833 15.3369C26.7593 15.1171 25.8933 15 25 15C24.1068 15 23.2409 15.1171 22.4168 15.3369Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );