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="M40 24C40 32.8366 32.8366 40 24 40C16.9695 40 10.9981 35.4655 8.85083 29.1616L7.50001 30C7.35194 30.0888 7.20913 30.1321 7.07231 30.1343C9.58085 37.0552 16.213 42 24 42C33.9411 42 42 33.9411 42 24C42 19.1141 40.0534 14.6829 36.8934 11.4397C36.8705 11.662 36.7455 11.8527 36.5 12L35.3446 12.7172C38.2219 15.6102 40 19.5974 40 24ZM6.78381 18.7298C7.12301 18.2181 7.52647 17.796 8.00001 17.5001L9.9751 16.293C12.6273 11.4768 17.6883 8.17362 23.5347 8.00664L26 6.50003C26.2024 6.36511 26.4366 6.2666 26.6967 6.20065C25.817 6.0685 24.9165 6 24 6C15.8926 6 9.03703 11.3601 6.78381 18.7298Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M30.5 22C30.2239 22 30 22.2239 30 22.5C30 22.7761 30.2239 23 30.5 23C30.7762 23 31 22.7761 31 22.5C31 22.2239 30.7762 22 30.5 22ZM28 22.5C28 21.1193 29.1193 20 30.5 20C31.8807 20 33 21.1193 33 22.5C33 23.8807 31.8807 25 30.5 25C29.1193 25 28 23.8807 28 22.5Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.1711 24.6179C16.5561 24.86 17.0117 25 17.5 25C18.8807 25 20 23.8807 20 22.5C20 22.4153 19.9958 22.3316 19.9876 22.2491L16.1711 24.6179Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M26 6.50003L8.00001 17.5001C4.00001 20.0001 5.00001 31.5001 7.50001 30L36.5 12C39 10.5 29 4.49999 26 6.50003ZM7.59208 27.5889L34.2939 11.0154C33.8196 10.6085 33.149 10.139 32.334 9.68179C31.1746 9.03137 29.9 8.50546 28.8081 8.25348C28.2631 8.12771 27.8246 8.08454 27.5029 8.09868C27.2122 8.11145 27.1076 8.16627 27.105 8.16708C27.105 8.16709 27.105 8.16709 27.105 8.16708L27.0766 8.18601L9.05356 19.2001C8.65009 19.4559 8.16356 20.0988 7.79553 21.3033C7.44112 22.4631 7.28418 23.8694 7.31208 25.2084C7.33195 26.1621 7.44326 26.9823 7.59208 27.5889Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.8347 33.3077C18.8346 33.3079 18.8335 33.305 18.832 33.2983C18.8342 33.3041 18.8349 33.3075 18.8347 33.3077ZM18.8339 33.0016C18.8453 32.9117 18.8651 32.8107 18.8943 32.7038C18.9542 32.485 19.0304 32.326 19.0715 32.2629C19.9055 30.9834 21.6979 30 23.8925 30C26.0051 30 27.7504 30.9128 28.6203 32.1266C28.6918 32.2265 28.7291 32.2744 28.7529 32.305C28.7775 32.3366 28.7878 32.3498 28.8067 32.3828C28.8408 32.4424 28.9006 32.5869 28.9439 32.7861C28.9554 32.8387 28.9646 32.8899 28.9716 32.9388C26.8488 32.2476 25.4628 31.8296 24.041 31.8216C22.5708 31.8133 21.1229 32.2422 18.8339 33.0016ZM28.9726 33.3405C28.9724 33.3402 28.9733 33.3362 28.9761 33.3292C28.9742 33.3373 28.9728 33.3408 28.9726 33.3405ZM16.9652 32.1763C17.0624 31.8207 17.2105 31.4554 17.3961 31.1707C18.6645 29.2248 21.1508 28 23.8925 28C26.538 28 28.9397 29.1388 30.2459 30.9616C30.2484 30.9651 30.2544 30.973 30.2632 30.9846C30.3137 31.0509 30.4553 31.2374 30.5415 31.3877C30.7054 31.6734 30.825 32.0247 30.8981 32.3605C30.9719 32.6991 31.015 33.0978 30.9738 33.4844C30.9359 33.8401 30.8038 34.3839 30.3337 34.7525C29.811 35.1624 29.1842 35.1245 28.678 34.9467C26.2837 34.1646 25.1486 33.8278 24.0297 33.8215C22.9146 33.8152 21.753 34.1383 19.3161 34.9489L19.3082 34.9515L19.3002 34.954C18.7403 35.1299 18.0786 35.1698 17.5285 34.7669C17.0012 34.3807 16.8604 33.7906 16.8299 33.3898C16.7977 32.9661 16.8673 32.534 16.9652 32.1763Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );