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="M24.8066 6.32325C15.8044 4.51088 6.77272 10.5416 6.04702 19.6962C6.01648 19.792 6 19.8941 6 20.0001C6 20.0622 6.00566 20.1229 6.01649 20.1819C6.00736 20.3782 6.00202 20.5758 6.00056 20.7748C5.98231 22.893 6.41404 24.9909 7.26707 26.9283C8.05926 28.7275 9.19792 30.3498 10.6161 31.7025V41.0001C10.6161 41.5524 11.0638 42.0001 11.6161 42.0001C12.1684 42.0001 12.6161 41.5524 12.6161 41.0001V31.2654C12.6161 30.9814 12.4953 30.7108 12.2839 30.5211C10.9228 29.2999 9.83633 27.8003 9.09749 26.1223C8.38666 24.5079 8.01347 22.7644 8.00036 21.0001H22V26.2149C22 29.331 23.2006 32.3252 25.3469 34.5375C27.4942 36.7508 30.4132 38.0001 33.4634 38.0001H42V19.163C42 17.2729 41.2718 15.4543 39.9665 14.1088C38.6602 12.7623 36.8818 12.0001 35.0209 12.0001H32.7858C32.1228 10.8891 31.351 9.89061 30.4127 9.04C28.9511 7.71498 27.1334 6.79229 24.8066 6.32325ZM29.0694 10.5218C29.551 10.9583 29.9881 11.4511 30.3913 12.0001H11.7173C14.8554 8.88184 19.5958 7.3144 24.4119 8.28391C26.4179 8.68832 27.8987 9.46038 29.0694 10.5218ZM8.13984 19.0001C8.41635 17.159 9.09255 15.4714 10.0714 14.0001H22V19.0001H8.13984ZM31.965 14.7468C31.8474 14.4906 31.7274 14.2417 31.6046 14.0001H24V26.2149C24 28.8197 25.0042 31.312 26.7824 33.1449C28.5596 34.9767 30.9635 36.0001 33.4634 36.0001H40V19.163C40 17.7841 39.4683 16.4676 38.531 15.5015C37.5948 14.5364 36.3315 14.0001 35.0209 14.0001H33.8212C34.0384 14.5106 34.149 15.0606 34.146 15.6161V18.6606C34.2092 18.7804 34.2962 18.9458 34.4025 19.1494C34.6354 19.5954 34.9616 20.2251 35.3349 20.9611C36.0802 22.4304 37.0195 24.3347 37.7813 26.0496L37.7817 26.0505C37.9532 26.4376 38.0254 26.8614 37.9921 27.2834C37.9588 27.7053 37.8209 28.1126 37.5906 28.4679C37.3603 28.8233 37.0448 29.1156 36.6724 29.3178C36.3006 29.5196 35.8841 29.625 35.461 29.624H34.1581V31.7173C34.1581 32.2695 33.7103 32.7173 33.1581 32.7173C32.6058 32.7173 32.1581 32.2695 32.1581 31.7173V28.624C32.1581 28.0717 32.6058 27.624 33.1581 27.624H35.4621L35.4653 27.624C35.5533 27.6243 35.6402 27.6024 35.7182 27.5601C35.7962 27.5177 35.8631 27.4561 35.9122 27.3803C35.9614 27.3044 35.9911 27.217 35.9983 27.1259C36.0055 27.035 35.9899 26.9438 35.9532 26.8608C35.2121 25.1925 34.2908 23.3238 33.5513 21.8659C33.1822 21.1382 32.8598 20.5157 32.6298 20.0753C32.5148 19.8552 32.423 19.6806 32.36 19.5614L32.2879 19.4252L32.2638 19.3798C32.1867 19.2351 32.146 19.073 32.146 18.909V15.6071C32.1479 15.3104 32.0861 15.0169 31.965 14.7468ZM31.965 14.7468L31.9666 14.7502L32.8754 14.3334L31.9636 14.7438L31.965 14.7468Z" fill="black"/>
<path d="M28 38.0001C28.5523 38.0001 29 38.4478 29 39.0001V41.0001C29 41.5524 28.5523 42.0001 28 42.0001C27.4477 42.0001 27 41.5524 27 41.0001V39.0001C27 38.4478 27.4477 38.0001 28 38.0001Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );