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="M38.5 6C37.1193 6 36 7.11929 36 8.5V13.0505C35.3814 13.6818 35 14.5463 35 15.5C35 17.433 36.567 19 38.5 19C40.433 19 42 17.433 42 15.5C42 14.5463 41.6186 13.6818 41 13.0505V8.5C41 7.11929 39.8807 6 38.5 6ZM37.4285 14.4503L38 13.8671V12H39V13.8671L39.5715 14.4503C39.8386 14.7229 40 15.0906 40 15.5C40 16.3284 39.3284 17 38.5 17C37.6716 17 37 16.3284 37 15.5C37 15.0906 37.1614 14.7229 37.4285 14.4503ZM38.5 8C38.2239 8 38 8.22386 38 8.5V10H39V8.5C39 8.22386 38.7761 8 38.5 8Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.215 18.8858C14.6706 17.7469 15.7737 17 17.0005 17H26.0005C27.2272 17 28.3303 17.7469 28.7859 18.8858L30.7859 23.8858C31.4013 25.4242 30.653 27.1701 29.1147 27.7854L27.5005 28.4311V34L27.5004 34.0125V39.2666C27.5004 40.6926 26.414 41.9283 24.9564 41.9971C23.496 42.066 22.3021 40.9336 22.1777 39.5107L21.7834 35H21.2174L20.8231 39.5107C20.6987 40.9336 19.5048 42.066 18.0444 41.9971C16.5869 41.9283 15.5004 40.6926 15.5004 39.2666V29.7333L15.5005 29.7167V28.5052L15.2481 28.393L15.2148 28.3806L15.2156 28.3786L13.782 27.7414C12.3082 27.0864 11.616 25.3833 12.215 23.8858L14.215 18.8858ZM17.5004 29.7333L17.5005 29.7259V29.1072C17.6945 29.137 17.8887 29.153 18.0785 29.1489C18.4219 29.1415 18.8165 29.0682 19.1785 28.8358C19.556 28.5936 19.81 28.2348 19.9495 27.8162C20.2006 27.0632 20.4594 26.1007 20.0397 25.1564C19.623 24.2188 18.6753 23.5928 17.3722 23.0715L16.4438 22.7001L15.701 24.5571L16.6295 24.9285C17.8264 25.4072 18.1287 25.7812 18.212 25.9686C18.291 26.1464 18.3008 26.4276 18.064 27.1481C18.0555 27.1487 18.046 27.1491 18.0354 27.1493C17.7958 27.1545 17.4039 27.0604 16.8488 26.8542L16.0032 26.54L14.5943 25.9138C14.103 25.6955 13.8723 25.1278 14.072 24.6286L16.072 19.6286C16.2238 19.249 16.5915 19 17.0005 19H26.0005C26.4094 19 26.7771 19.249 26.929 19.6286L28.929 24.6286C29.1341 25.1414 28.8847 25.7234 28.3719 25.9285L26.1291 26.8256C26.0523 26.8563 25.9808 26.8959 25.9156 26.9429L25.7068 27.0071C25.5051 27.0691 25.3318 27.1107 25.1864 27.1323C25.0706 27.1496 24.9898 27.1515 24.9377 27.1481C24.7009 26.4276 24.7107 26.1464 24.7897 25.9686C24.873 25.7812 25.1753 25.4072 26.3722 24.9285L27.3007 24.5571L26.5579 22.7001L25.6295 23.0715C24.3264 23.5928 23.3787 24.2188 22.962 25.1564C22.5423 26.1007 22.8012 27.0632 23.0522 27.8162C23.1693 28.1677 23.369 28.4834 23.6661 28.7226C23.9594 28.9589 24.2905 29.0747 24.6013 29.1218C24.8996 29.1669 25.206 29.1527 25.5005 29.1076V33.9875L25.5004 34V39.2666C25.5004 39.6941 25.185 39.9841 24.8621 39.9993C24.5422 40.0144 24.2071 39.7594 24.1701 39.3365L23.696 33.9129C23.6509 33.3964 23.2184 33 22.6998 33H20.301C19.7825 33 19.3499 33.3964 19.3048 33.9129L18.8307 39.3365C18.7937 39.7594 18.4587 40.0144 18.1387 39.9993C17.8159 39.9841 17.5004 39.6941 17.5004 39.2666V29.7333Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M26.0005 11.5C26.0005 13.9853 23.9858 16 21.5005 16C19.0152 16 17.0005 13.9853 17.0005 11.5C17.0005 9.01472 19.0152 7 21.5005 7C23.9858 7 26.0005 9.01472 26.0005 11.5ZM24.0005 11.5C24.0005 12.8807 22.8812 14 21.5005 14C20.1198 14 19.0005 12.8807 19.0005 11.5C19.0005 10.1193 20.1198 9 21.5005 9C22.8812 9 24.0005 10.1193 24.0005 11.5Z" fill="black"/>
<path d="M8.72146 19.0429C9.25903 18.5053 10.0698 18 11 18H12V20H11C10.7873 20 10.4553 20.1375 10.1357 20.4571C9.98704 20.6057 9.87199 20.765 9.79847 20.9067C9.76223 20.9766 9.73981 21.0351 9.72715 21.0794C9.72526 21.086 9.72364 21.0921 9.72227 21.0977C9.73416 21.1178 9.75302 21.1469 9.78214 21.1857C9.89188 21.332 10.0512 21.4941 10.2785 21.7215L10.3006 21.7435C10.4991 21.9419 10.7567 22.1994 10.9607 22.4714C11.1645 22.7432 11.4286 23.1737 11.4286 23.7143C11.4286 24.18 11.191 24.5173 10.9976 24.7158C10.8061 24.9125 10.5764 25.0597 10.3831 25.1685C10.0755 25.3415 9.6847 25.5097 9.34313 25.6568C9.26393 25.6909 9.18736 25.7238 9.1151 25.7554C8.6818 25.945 8.3473 26.1079 8.12489 26.2701C8.09478 26.292 8.07023 26.3114 8.05031 26.3281C8.15968 26.4275 8.32923 26.5289 8.63312 26.6999L8.67053 26.7209C8.92948 26.8662 9.30798 27.0787 9.61251 27.3642C9.9688 27.6982 10.2857 28.187 10.2857 28.8571C10.2857 29.9235 9.58213 30.6213 9.19368 31.0066L9.13568 31.0643C8.64977 31.5502 8.57143 31.6933 8.57143 31.8571C8.57143 31.9737 8.67871 32.2474 9.18292 32.5634C9.66175 32.8636 10.1942 33 10.4286 33H11.4286V35H10.4286C9.7344 35 8.83825 34.7078 8.12065 34.258C7.42843 33.8241 6.57143 33.0263 6.57143 31.8571C6.57143 30.7908 7.27502 30.093 7.66346 29.7077L7.72146 29.65C8.19783 29.1737 8.28248 29.0267 8.28562 28.8668C8.27871 28.8579 8.26611 28.8434 8.24463 28.8233C8.13561 28.7211 7.96517 28.6188 7.6526 28.443L7.61518 28.422C7.35622 28.2766 6.97773 28.0641 6.6732 27.7786C6.31691 27.4446 6 26.9559 6 26.2857C6 25.4739 6.54617 24.946 6.94654 24.654C7.36699 24.3475 7.88962 24.1086 8.31347 23.9231C8.41687 23.8779 8.51449 23.8357 8.60666 23.7959C8.85093 23.6905 9.05706 23.6015 9.23129 23.5153C9.13514 23.4077 9.0146 23.286 8.86432 23.1357L8.84228 23.1136C8.64375 22.9152 8.38619 22.6578 8.18214 22.3857C7.97834 22.114 7.71429 21.6834 7.71429 21.1429C7.71429 20.3384 8.20169 19.5627 8.72146 19.0429Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M33 18C33.9052 18 34.593 18.636 34.9786 19.15C35.3853 19.6924 35.7143 20.434 35.7143 21.1429C35.7143 21.603 35.5438 21.9936 35.385 22.276C35.2318 22.5483 35.0371 22.8078 34.8875 23.0072L34.8714 23.0286C34.7055 23.2498 34.5889 23.4079 34.5068 23.5515C34.6325 23.6376 34.7859 23.7259 34.986 23.8412C35.0572 23.8822 35.1343 23.9266 35.2182 23.9755C35.5395 24.1629 35.9576 24.4167 36.2953 24.7451C36.644 25.0841 37 25.5941 37 26.2857C37 27.4368 36.1957 28.0347 35.7952 28.3324L35.7429 28.3714C35.284 28.7155 35.2847 28.7708 35.2856 28.8467L35.2857 28.8571C35.2857 29.1272 35.3923 29.3088 35.7286 29.7571L35.7618 29.8013C36.0722 30.2139 36.5714 30.8773 36.5714 31.8571C36.5714 32.9266 35.9242 33.7189 35.3426 34.1887C35.0399 34.4331 34.714 34.6259 34.4081 34.7609C34.126 34.8854 33.7725 35 33.4286 35H32.4286V33L33.4066 33C33.4065 32.9998 33.4072 32.9996 33.4085 32.9992L33.4143 32.9977C33.4349 32.9925 33.497 32.9769 33.6008 32.9311C33.7503 32.8651 33.9243 32.7633 34.0859 32.6328C34.433 32.3525 34.5714 32.0734 34.5714 31.8571C34.5714 31.587 34.4649 31.4055 34.1286 30.9571L34.0954 30.913C33.7849 30.5004 33.2857 29.837 33.2857 28.8571C33.2857 27.706 34.09 27.1081 34.4906 26.8104L34.5429 26.7714C34.9973 26.4306 35.001 26.3731 35.0001 26.2983C34.9916 26.2812 34.9665 26.2426 34.9011 26.179C34.7567 26.0386 34.532 25.8906 34.2104 25.7031C34.1605 25.674 34.1062 25.6428 34.0489 25.61C33.7927 25.463 33.4772 25.282 33.2304 25.0969C32.9692 24.901 32.4286 24.4499 32.4286 23.7143C32.4286 23.2542 32.599 22.8636 32.7579 22.5812C32.9111 22.3088 33.1057 22.0494 33.2554 21.85L33.2714 21.8286C33.4413 21.6021 33.5595 21.4418 33.6418 21.2955C33.6994 21.193 33.7119 21.1437 33.7142 21.1343C33.7105 20.9821 33.6102 20.6588 33.3786 20.35C33.27 20.2052 33.1616 20.1042 33.0748 20.0463C33.0262 20.014 32.9972 20.0032 32.987 20H32V18H33ZM34.3317 23.4112C34.3311 23.4112 34.3348 23.416 34.3446 23.4257C34.3373 23.4161 34.3324 23.4113 34.3317 23.4112ZM35.0013 26.3007C35.0023 26.303 35.003 26.3047 35.0034 26.306C35.0041 26.3079 35.0041 26.3088 35.0039 26.3087C35.0036 26.3082 35.0028 26.3067 35.0023 26.3051L35.0013 26.3007Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );