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="M28.5002 17.5001C28.5002 19.9853 26.4855 22.0001 24.0002 22.0001C21.5149 22.0001 19.5002 19.9853 19.5002 17.5001C19.5002 15.0148 21.5149 13.0001 24.0002 13.0001C26.4855 13.0001 28.5002 15.0148 28.5002 17.5001ZM26.5002 17.5001C26.5002 18.8808 25.3809 20.0001 24.0002 20.0001C22.6195 20.0001 21.5002 18.8808 21.5002 17.5001C21.5002 16.1193 22.6195 15.0001 24.0002 15.0001C25.3809 15.0001 26.5002 16.1193 26.5002 17.5001Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.00378 6.06078C9.55409 6.01402 10.0381 6.42223 10.0848 6.97254L10.3711 10.3417C20.3978 8.56603 27.3736 8.55034 37.6287 10.3489L37.9155 6.97254C37.9623 6.42223 38.4463 6.01402 38.9966 6.06078L40.9894 6.23008C41.5397 6.27683 41.9479 6.76084 41.9012 7.31114L41.5725 11.1797C41.8882 11.4002 42.061 11.7936 41.9809 12.1954C41.9165 12.5187 41.7029 12.7744 41.426 12.9049L41.0757 17.0273C41.029 17.5776 40.545 17.9858 39.9947 17.939L38.0019 17.7697C37.4516 17.723 37.0434 17.239 37.0901 16.6887L37.4587 12.3496C36.9112 12.2527 36.3734 12.1611 35.8444 12.0748C35.9388 12.3662 35.9898 12.6772 35.9898 13C35.9898 13.0756 35.9911 13.1907 35.9929 13.3492L35.993 13.3581C36.0063 14.5095 36.0414 17.546 35.6846 20.4418C35.485 22.0621 35.1353 23.901 34.4536 25.4156C33.9452 26.5451 32.8997 28.2179 31.0002 28.7957V29.8835C31.7458 29.6203 32.4921 29.3692 33.1101 29.2133C33.5015 29.1145 34.2149 28.9499 34.9561 29.0155C35.3342 29.0489 36.099 29.1709 36.8138 29.7524C37.6713 30.4499 38.0002 31.4244 38.0002 32.2632C38.0002 33.1862 37.7031 35.3792 37.4663 36.9401C37.3392 37.7782 37.207 38.5775 37.1017 39.1211L37.0933 39.1647C37.0199 39.5452 36.9107 40.1117 36.6039 40.628L36.6031 40.6293L36.6015 40.6321C36.5322 40.7494 36.2165 41.2819 35.5649 41.6742C35.1626 41.9164 34.5005 42.1805 33.6717 42.0853C32.8329 41.9888 32.2338 41.5717 31.88 41.2144C31.5136 40.8445 31.2457 40.3797 31.1105 39.8753C30.9309 39.2119 30.8773 38.5197 30.8493 37.9006C30.8397 37.6892 30.8331 37.4907 30.8268 37.3011C30.8153 36.956 30.8048 36.6403 30.7793 36.3297C29.9655 36.6121 29.0898 36.901 28.2182 37.1459C26.9176 37.5115 25.4152 37.8421 24.0002 37.8421C22.5853 37.8421 21.0829 37.5115 19.7823 37.146C18.925 36.905 18.0638 36.6216 17.2614 36.3436L17.2414 36.6051C17.1789 37.418 17.115 38.2176 17.066 38.756C17.0628 38.7914 17.0596 38.8297 17.0562 38.8706C17.0256 39.2379 16.9778 39.8113 16.7417 40.3329C16.6927 40.4433 16.4422 41.0043 15.8491 41.4656C15.4742 41.7572 14.7751 42.1482 13.8304 42.0926C12.8813 42.0368 12.2283 41.5625 11.8845 41.2188C11.1598 40.494 11.0618 39.5908 11 39.0214C10.9933 38.9589 10.9869 38.9004 10.9802 38.8466C10.9594 38.6793 10.9269 38.4595 10.8827 38.1874C10.8053 37.7103 10.7045 37.1472 10.5949 36.5354L10.5471 36.2682C10.4227 35.5726 10.2912 34.8289 10.1909 34.1721C10.0997 33.575 10.0002 32.8437 10.0002 32.2632C10.0002 31.4243 10.3292 30.4499 11.1868 29.7524C11.9016 29.1709 12.6664 29.0489 13.0444 29.0155C13.1078 29.0098 13.1711 29.0059 13.2339 29.0035C13.7626 28.9831 14.2637 29.0689 14.6277 29.1504C14.726 29.1724 14.8143 29.1941 14.8904 29.2133C15.5083 29.3692 16.2547 29.6203 17.0002 29.8835V28.78C16.8732 28.738 16.7504 28.6907 16.6316 28.6387C15.4247 28.1103 14.6399 27.0982 14.1552 26.2463C13.9857 25.9483 13.8528 25.6699 13.7515 25.4386C13.7111 25.3463 13.6717 25.2527 13.6334 25.1579C13.0732 23.7722 12.7359 22.1323 12.5168 20.6461C12.04 17.4105 12.0002 13.9846 12.0002 13C12.0002 12.6741 12.0522 12.3603 12.1483 12.0666C11.6213 12.1533 11.0859 12.2454 10.5411 12.3427L10.9103 16.6887C10.957 17.239 10.5488 17.723 9.99853 17.7697L8.0057 17.939C7.4554 17.9858 6.97139 17.5776 6.92464 17.0273L6.57443 12.9049C6.29816 12.7747 6.08486 12.52 6.01989 12.1976C5.93883 11.7952 6.11157 11.4006 6.42786 11.1797L6.0992 7.31114C6.05245 6.76084 6.46066 6.27683 7.01096 6.23008L9.00378 6.06078ZM17.501 11.3422C17.8165 11.8172 18.0002 12.3871 18.0002 13C18.0002 13.9054 18.0413 16.9793 18.4527 19.7713C18.6599 21.1774 18.9321 22.2974 19.2338 23H28.9607L28.9711 22.9775L28.9822 22.9531C29.2896 22.2701 29.5524 21.1469 29.7297 19.708C30.0316 17.2574 30.0057 14.6551 29.9932 13.4478L29.9932 13.4424C29.9914 13.2667 29.9898 13.1146 29.9898 13C29.9898 12.3913 30.1711 11.825 30.4826 11.352C25.9818 10.8913 21.9352 10.8905 17.501 11.3422ZM29.0002 28.7819V27.98C29.0002 27.4667 29.3889 27.0367 29.8997 26.9851C31.262 26.8473 32.1214 25.7243 32.6298 24.5947C33.1869 23.357 33.5075 21.7563 33.6996 20.1972C34.0391 17.4426 34.0063 14.5205 33.9931 13.3723L33.993 13.3667C33.9912 13.2164 33.9898 13.089 33.9898 13C33.9898 12.4477 33.5421 12 32.9898 12C32.4375 12 31.9898 12.4477 31.9898 13C31.9898 13.103 31.9912 13.2445 31.9931 13.4271L31.9932 13.4383C32.0057 14.6447 32.0339 17.3616 31.7146 19.9526C31.53 21.451 31.2383 22.8133 30.806 23.7739C30.6004 24.2307 30.3994 24.5348 30.1937 24.7283C30.0082 24.9028 29.7631 25 29.5085 25H18.6382C18.3213 25 18.0231 24.8498 17.8345 24.5951C17.71 24.427 17.5693 24.1849 17.4152 23.8331C16.9998 22.8853 16.6921 21.5425 16.4741 20.0629C16.0408 17.123 16.0002 13.9316 16.0002 13C16.0002 12.4477 15.5525 12 15.0002 12C14.448 12 14.0002 12.4477 14.0002 13C14.0002 13.7947 14.0279 16.2071 14.2971 18.769C14.3524 19.2954 14.4179 19.8282 14.4955 20.3545C14.7215 21.888 15.0598 23.4411 15.5833 24.6359C16.0394 25.6767 16.8255 26.8435 18.1096 26.9848C18.6165 27.0406 19.0002 27.4689 19.0002 27.9788V28.782C19.2436 28.8554 19.552 28.9408 19.9167 29.0266C20.9217 29.2631 22.3435 29.5 24.0002 29.5C25.6568 29.5 27.0786 29.2631 28.0836 29.0266C28.4484 28.9408 28.7569 28.8553 29.0002 28.7819ZM19.0002 30.8594C19.1432 30.8969 19.2962 30.9352 19.4586 30.9734C20.5786 31.2369 22.1568 31.5 24.0002 31.5C25.8435 31.5 27.4217 31.2369 28.5417 30.9734C28.7042 30.9352 28.8572 30.8969 29.0002 30.8593V31.3027C29.0002 31.6278 29.1583 31.9326 29.424 32.12C29.6898 32.3073 30.03 32.3538 30.3362 32.2445L30.8864 32.0476C31.9087 31.681 32.8775 31.3346 33.5994 31.1525C33.9654 31.0602 34.398 30.9739 34.7798 31.0077C34.973 31.0248 35.279 31.082 35.5517 31.3039C35.8693 31.5623 36.0002 31.9254 36.0002 32.2632C36.0002 33.0011 35.7343 35.0226 35.4889 36.6401C35.3632 37.4688 35.2358 38.2369 35.1382 38.7408C35.0535 39.1784 34.9962 39.4186 34.8844 39.6066L34.8792 39.6154C34.8622 39.6441 34.7534 39.8283 34.5334 39.9608C34.396 40.0435 34.1748 40.1299 33.9002 40.0983C33.6223 40.0664 33.4217 39.9289 33.301 39.807C33.1781 39.6829 33.087 39.5243 33.0422 39.3574L33.0415 39.3546C32.9216 38.9125 32.874 38.4016 32.8473 37.8103C32.8401 37.6531 32.8345 37.485 32.8287 37.3111C32.814 36.8761 32.7982 36.4046 32.7552 35.9745C32.7157 35.5791 32.6761 35.1962 32.6406 34.8577C32.6085 34.5525 32.438 34.2789 32.1782 34.1156C31.9183 33.9522 31.5978 33.9173 31.3089 34.0208C30.1935 34.4202 28.9233 34.8703 27.6771 35.2205C26.4315 35.5706 25.1388 35.8421 24.0002 35.8421C22.8617 35.8421 21.569 35.5706 20.3234 35.2205C19.1527 34.8915 17.9609 34.4744 16.8961 34.0939L16.6994 34.0236C16.4053 33.9183 16.079 33.9564 15.8172 34.1266C15.6815 34.2148 15.5711 34.3333 15.4932 34.4703C15.4207 34.5977 15.3761 34.7411 15.365 34.8911C15.3286 35.3816 15.288 35.9232 15.2473 36.4517C15.1848 37.2643 15.1218 38.0517 15.0743 38.5749L15.0702 38.6199C15.0279 39.0853 15.007 39.3159 14.9193 39.5089L14.9129 39.5232C14.9068 39.5369 14.8208 39.7317 14.6213 39.8869C14.4926 39.987 14.2596 40.1144 13.9478 40.0961C13.6348 40.0777 13.4167 39.9225 13.2988 39.8045C13.0885 39.5943 13.0638 39.3958 12.9722 38.6579L12.9649 38.5998C12.9398 38.3974 12.9029 38.1503 12.8569 37.867C12.7766 37.3721 12.673 36.7938 12.5647 36.1892L12.5158 35.916C12.391 35.2182 12.2639 34.4983 12.168 33.8701C12.0753 33.2634 12.0002 32.6722 12.0002 32.2632C12.0002 31.9254 12.1312 31.5623 12.4488 31.3039C12.6406 31.1479 12.8488 31.0733 13.0227 31.0368C13.0961 31.0214 13.1634 31.0128 13.2207 31.0077C13.6025 30.9739 14.0351 31.0602 14.4011 31.1525C14.5799 31.1976 14.7738 31.2528 14.98 31.3159C15.561 31.4936 16.239 31.734 16.9482 31.9881L17.6643 32.2445C17.9705 32.3538 18.3107 32.3073 18.5765 32.12C18.8422 31.9326 19.0002 31.6278 19.0002 31.3027V30.8594Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );