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="M19.3135 8.17L19.4027 8.11918C20.1725 7.6806 21.1583 7.94311 21.6044 8.70551C21.6661 8.81095 21.7142 8.92042 21.7494 9.03197C23.0834 8.57855 24.601 9.10806 25.3353 10.3631L29.858 18.0923C30.6909 19.5158 30.2008 21.3336 28.7634 22.1525L27.9149 22.6358L28.592 23.9364L25.9181 25.2904L25.309 24.1203L24.6418 24.5004C23.2044 25.3192 21.3638 24.8291 20.5309 23.4056L17.745 18.6445C15.085 20.1354 13.2573 21.8036 12.2874 23.7177C11.4894 25.2923 11.2272 27.1228 11.6687 29.3206C13.1008 28.5337 14.7478 28.0858 16.5 28.0858C20.5373 28.0858 24.0157 30.4636 25.5949 33.887L37.8366 30.6641L38.3608 32.5823L26.2423 35.7728C26.4109 36.4963 26.5 37.2501 26.5 38.0245C26.5 38.7052 26.4311 39.37 26.3 40.0123H39.5C40.0523 40.0123 40.5 40.4572 40.5 41.0061C40.5 41.555 40.0523 42 39.5 42L7.33212 42.0001C6.79691 40.7826 6.5 39.438 6.5 38.0245C6.5 35.0475 7.81695 32.3762 9.90342 30.5547C9.14192 27.6451 9.35822 25.0789 10.5011 22.8236C11.712 20.434 13.899 18.5219 16.7395 16.926L16.0082 15.6764C15.3542 14.5587 15.5159 13.198 16.3113 12.2685C16.1946 12.162 16.0919 12.0366 16.0082 11.8935C15.5621 11.1311 15.8245 10.1575 16.5944 9.71895L16.7103 9.65296L15.4668 7.43513L18.0968 6L19.3135 8.17ZM28.1228 19.0808L23.6001 11.3516C23.3225 10.8771 22.709 10.7137 22.2298 10.9866L18.1083 13.3345C17.6291 13.6075 17.4658 14.2134 17.7434 14.6879L22.2661 22.4171C22.5437 22.8916 23.1572 23.055 23.6364 22.7821L27.7579 20.4342C28.2371 20.1612 28.4004 19.5553 28.1228 19.0808ZM24.5 38.0245C24.5 38.7081 24.4134 39.3697 24.2508 40.0001H8.74918C8.58661 39.3697 8.5 38.7081 8.5 38.0245C8.5 33.6516 12.0701 30.0858 16.5 30.0858C19.6111 30.0858 22.2981 31.8445 23.6223 34.4064L17.2047 36.096L17.7289 38.0142L24.3065 36.2824C24.4332 36.8433 24.5 37.4264 24.5 38.0245Z" fill="black"/>
<path d="M32.2625 19.6969C32.2457 20.3979 32.0792 21.088 31.7757 21.7192L33.0047 22.4502C33.4786 22.732 34.0807 22.5718 34.3495 22.0923C34.6182 21.6127 34.4519 20.9955 33.978 20.7137L32.3312 19.7343C32.3086 19.7208 32.2856 19.7083 32.2625 19.6969Z" fill="black"/>
<path d="M31.6341 24.1097C31.3918 24.1066 31.1505 24.092 30.9109 24.066L31.2928 24.7995L29.33 25.7934C30.071 25.9845 30.8356 26.0875 31.6086 26.0973C33.5465 26.1218 35.446 25.5595 37.0665 24.4845C38.6868 23.4096 39.9542 21.8716 40.7126 20.0679C41.4708 18.2643 41.6873 16.2735 41.3358 14.346C40.9842 12.4185 40.0796 10.6372 38.7325 9.22863C37.3852 7.81979 35.6554 6.847 33.7602 6.43747C31.8648 6.02791 29.8931 6.20105 28.0956 6.93396C27.3526 7.23693 26.6535 7.6297 26.0121 8.10074C26.4201 8.45165 26.7775 8.87446 27.0639 9.36385L27.2424 9.66897C27.7412 9.30778 28.282 9.00646 28.8547 8.77297C30.2782 8.19255 31.8371 8.0561 33.3353 8.37984C34.8337 8.70363 36.208 9.47411 37.2829 10.5981C38.358 11.7223 39.0849 13.1496 39.3678 14.7006C39.6507 16.2517 39.4761 17.8532 38.8672 19.3015C38.2584 20.7496 37.244 21.9769 35.9562 22.8312C34.6688 23.6852 33.1648 24.1291 31.6341 24.1097Z" fill="black"/>
<path d="M35.1503 14.7401C34.7668 15.1351 34.7668 15.7755 35.1503 16.1705C35.5337 16.5656 36.1555 16.5656 36.5389 16.1705L37.8835 14.7855C38.267 14.3904 38.267 13.75 37.8835 13.355C37.5 12.96 36.8783 12.96 36.4948 13.355L35.1503 14.7401Z" fill="black"/>
<path d="M30.6503 13.3668C31.0337 13.7618 31.6555 13.7618 32.0389 13.3668C32.4224 12.9718 32.4224 12.3313 32.0389 11.9363L30.6943 10.5512C30.3109 10.1562 29.6891 10.1562 29.3057 10.5512C28.9222 10.9462 28.9222 11.5867 29.3057 11.9817L30.6503 13.3668Z" fill="black"/>
<path d="M33.6515 16.5215C33.6515 15.9806 33.2258 15.5421 32.7008 15.5421C32.1757 15.5421 31.75 15.9806 31.75 16.5215C31.75 17.0624 32.1757 17.5009 32.7008 17.5009C33.2258 17.5009 33.6515 17.0624 33.6515 16.5215Z" fill="black"/>
<path d="M35.4999 11.6724C35.4999 11.1315 35.0742 10.693 34.5491 10.693C34.024 10.693 33.5984 11.1315 33.5984 11.6724C33.5984 12.2133 34.024 12.6518 34.5491 12.6518C35.0742 12.6518 35.4999 12.2133 35.4999 11.6724Z" fill="black"/>
<path d="M36.4961 19.1262C36.4961 18.5853 36.0705 18.1468 35.5454 18.1468C35.0203 18.1468 34.5946 18.5853 34.5946 19.1262C34.5946 19.6671 35.0203 20.1056 35.5454 20.1056C36.0705 20.1056 36.4961 19.6671 36.4961 19.1262Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );