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="M21.5843 10.0874L21.5782 10.0928C21.574 10.0194 21.5698 9.94163 21.5654 9.85905L21.557 9.70141C21.521 9.04058 21.4654 8.0406 21.0591 7.25051C20.8385 6.8214 20.4962 6.41208 19.9757 6.15329C19.4613 5.89747 18.8729 5.83854 18.245 5.925C17.6883 6.00166 17.1945 6.22589 16.8047 6.60348C16.4226 6.97362 16.1957 7.43726 16.0709 7.91064C15.8285 8.8293 15.9314 9.92695 16.1818 10.9837C16.6881 13.1199 17.9194 15.5841 19.3039 17.2603C19.8366 17.9052 20.0001 18.877 20.0001 19.2956L20.0001 21.5L22.0001 22V20.685C22.8827 20.357 23.4789 20.207 24.038 20.1955C24.5799 20.1844 25.1584 20.3035 26.0001 20.6513V22L28.0001 21.5L28.0001 19.2956C28.0001 18.877 28.1636 17.9052 28.6963 17.2603C30.0715 15.5953 31.3642 13.1422 31.9358 11.0123C32.2179 9.96102 32.3592 8.86383 32.1474 7.94184C32.0381 7.46562 31.8243 6.99328 31.4453 6.61447C31.0583 6.22759 30.5621 6.00178 30.0045 5.925C29.3767 5.83854 28.7883 5.89747 28.2738 6.15329C27.7534 6.41208 27.4111 6.8214 27.1904 7.25051C26.7842 8.0406 26.7286 9.04058 26.6926 9.70141L26.6841 9.85903C26.6798 9.94162 26.6756 10.0194 26.6714 10.0928L26.6653 10.0874C26.1879 9.66212 25.5561 9.51729 25.1302 9.45488C24.8041 9.4071 24.4873 9.39377 24.2495 9.39006V9.38864L24.2369 9.38864C24.2036 9.38863 24.1661 9.38863 24.1248 9.38883C24.0835 9.38863 24.0459 9.38863 24.0126 9.38864L24.0001 9.38864V9.39006C23.7623 9.39377 23.4454 9.4071 23.1193 9.45488C22.6935 9.51729 22.0617 9.66212 21.5843 10.0874ZM22.9147 11.5807C22.9153 11.5802 22.9236 11.5734 22.9436 11.5624C22.9579 11.5544 22.9766 11.5453 23 11.5355V16H25V11.462C25.0782 11.4785 25.1466 11.4974 25.2044 11.518C25.2502 11.5345 25.2834 11.5499 25.306 11.5624C25.326 11.5735 25.3344 11.5803 25.335 11.5809C25.7583 11.9579 26.188 12.2759 26.6192 12.4201C26.8509 12.4977 27.1459 12.5466 27.4634 12.4691C27.7982 12.3874 28.0479 12.1922 28.2164 11.9732C28.5014 11.6029 28.578 11.1307 28.6142 10.8471C28.6499 10.5673 28.6668 10.2448 28.6821 9.95223L28.6896 9.81013C28.7302 9.06395 28.7917 8.51011 28.9691 8.16501C29.0403 8.02653 29.1064 7.97291 29.1644 7.9441C29.2283 7.91232 29.3881 7.85899 29.7317 7.9063C29.9126 7.93121 29.99 7.98762 30.0314 8.02894C30.0808 8.07833 30.1501 8.18017 30.1982 8.38958C30.3014 8.83886 30.2551 9.55868 30.0042 10.4939C29.5096 12.3368 28.3539 14.5343 27.1543 15.9867C26.4846 16.7974 26.183 17.7918 26.0652 18.5403C25.3509 18.3021 24.6867 18.1818 23.9969 18.1959C23.3165 18.2099 22.6534 18.355 21.9421 18.586C21.8294 17.8326 21.5293 16.814 20.8459 15.9867C19.6556 14.5455 18.5632 12.3591 18.1279 10.5225C17.9076 9.59276 17.8853 8.87338 18.0047 8.42078C18.0607 8.20854 18.1364 8.09799 18.1963 8.03993C18.2486 7.98932 18.3361 7.93133 18.5179 7.9063C18.8614 7.85899 19.0213 7.91232 19.0852 7.9441C19.1432 7.97291 19.2093 8.02653 19.2805 8.16501C19.4579 8.51011 19.5193 9.06395 19.5599 9.81013L19.5675 9.95218C19.5828 10.2447 19.5997 10.5673 19.6354 10.8471C19.6715 11.1307 19.7482 11.6029 20.0331 11.9732C20.2017 12.1922 20.4514 12.3874 20.7862 12.4691C21.1037 12.5466 21.3987 12.4977 21.6304 12.4201C22.0616 12.2759 22.4914 11.9578 22.9147 11.5807Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M26.0001 35.3149C25.1174 35.643 24.5212 35.793 23.962 35.8045C23.4202 35.8156 22.8417 35.6965 22.0001 35.3488V33.6667L20.0001 35.8334L20.0001 38C20.0001 40.2091 21.7909 42 24 42C26.2091 42 27.9999 40.2092 28 38.0001L28.0001 35.8333L26.0001 33.6667L26.0001 35.3149ZM24 40C22.8955 40 22.0001 39.1046 22 38.0001L22.0001 37.4811C22.6897 37.7052 23.3344 37.8178 24.0031 37.8041C24.6651 37.7905 25.3106 37.6528 26.0001 37.4326V38C26.0001 39.1046 25.1046 40 24 40Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.3616 11.4564C13.3531 12.0825 14.1689 13.2191 14.7737 14.725C14.9275 15.1079 15.0778 15.5207 15.2352 15.9525C15.7537 17.3761 16.348 19.0077 17.3924 20.4676C18.6864 22.2764 20.6362 23.7381 24 23.7381C27.3638 23.7381 29.3136 22.2764 30.6076 20.4676C31.652 19.0077 32.2463 17.3761 32.7648 15.9526C32.9222 15.5207 33.0725 15.1079 33.2263 14.725C33.8311 13.2191 34.6469 12.0825 35.6384 11.4564C36.6834 10.7965 37.8663 10.7501 38.9189 11.3558C39.9103 11.9262 40.672 13.0052 41.1835 14.3775C41.7012 15.7664 42 17.5493 42 19.6819V29.8691C42 30.7182 41.8359 32.6845 40.883 34.4771C39.8932 36.3389 38.045 38.0002 34.8462 38.0002C33.251 38.0002 32.0601 37.5494 31.0936 36.849C30.2289 36.2225 29.5679 35.4071 28.9943 34.6994L28.878 34.5561C28.2484 33.7817 27.6901 33.1275 26.9608 32.6456C26.2611 32.1833 25.354 31.8504 24 31.8504C22.646 31.8504 21.7389 32.1833 21.0392 32.6456C20.3099 33.1275 19.7516 33.7817 19.122 34.5561L19.0057 34.6995C18.4321 35.4071 17.7711 36.2225 16.9064 36.849C15.9399 37.5494 14.749 38.0002 13.1538 38.0002C9.95499 38.0002 8.10675 36.3389 7.11703 34.4771C6.16409 32.6845 6 30.7182 6 29.8691V19.6819C6 17.5493 6.29877 15.7664 6.81647 14.3775C7.32798 13.0052 8.08973 11.9262 9.08109 11.3558C10.1337 10.7501 11.3166 10.7965 12.3616 11.4564ZM12 18C12 18.5523 11.5523 19 11 19C10.4477 19 10 18.5523 10 18C10 17.4477 10.4477 17 11 17C11.5523 17 12 17.4477 12 18ZM13 23C13.5523 23 14 22.5523 14 22C14 21.4477 13.5523 21 13 21C12.4477 21 12 21.4477 12 22C12 22.5523 12.4477 23 13 23ZM12 26C12 26.5523 11.5523 27 11 27C10.4477 27 10 26.5523 10 26C10 25.4477 10.4477 25 11 25C11.5523 25 12 25.4477 12 26ZM16 32C16.5523 32 17 31.5523 17 31C17 30.4477 16.5523 30 16 30C15.4477 30 15 30.4477 15 31C15 31.5523 15.4477 32 16 32ZM13 31C13 31.5523 12.5523 32 12 32C11.4477 32 11 31.5523 11 31C11 30.4477 11.4477 30 12 30C12.5523 30 13 30.4477 13 31ZM16 28C16.5523 28 17 27.5523 17 27C17 26.4477 16.5523 26 16 26C15.4477 26 15 26.4477 15 27C15 27.5523 15.4477 28 16 28ZM21 28C21 28.5523 20.5523 29 20 29C19.4477 29 19 28.5523 19 28C19 27.4477 19.4477 27 20 27C20.5523 27 21 27.4477 21 28ZM37 19C36.4477 19 36 18.5523 36 18C36 17.4477 36.4477 17 37 17C37.5523 17 38 17.4477 38 18C38 18.5523 37.5523 19 37 19ZM34 22C34 22.5523 34.4477 23 35 23C35.5523 23 36 22.5523 36 22C36 21.4477 35.5523 21 35 21C34.4477 21 34 21.4477 34 22ZM37 27C36.4477 27 36 26.5523 36 26C36 25.4477 36.4477 25 37 25C37.5523 25 38 25.4477 38 26C38 26.5523 37.5523 27 37 27ZM31 31C31 31.5523 31.4477 32 32 32C32.5523 32 33 31.5523 33 31C33 30.4477 32.5523 30 32 30C31.4477 30 31 30.4477 31 31ZM36 32C35.4477 32 35 31.5523 35 31C35 30.4477 35.4477 30 36 30C36.5523 30 37 30.4477 37 31C37 31.5523 36.5523 32 36 32ZM31 27C31 27.5523 31.4477 28 32 28C32.5523 28 33 27.5523 33 27C33 26.4477 32.5523 26 32 26C31.4477 26 31 26.4477 31 27ZM28 29C27.4477 29 27 28.5523 27 28C27 27.4477 27.4477 27 28 27C28.5523 27 29 27.4477 29 28C29 28.5523 28.5523 29 28 29ZM25 28C25 28.5523 24.5523 29 24 29C23.4477 29 23 28.5523 23 28C23 27.4477 23.4477 27 24 27C24.5523 27 25 27.4477 25 28Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );