build method
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:
- the fields of the widget, which themselves must not change over time, and
- any ambient state obtained from the
context
using BuildContext.dependOnInheritedWidgetOfExactType.
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="M33 22C29.7397 22 26.9976 24.2299 26.2205 27.2493L24.2836 26.7508C25.2826 22.8692 28.805 20 33 20C37.9706 20 42 24.0295 42 29C42 33.9706 37.9706 38 33 38C29.987 38 27.32 36.5184 25.6881 34.2485L27.312 33.081C28.5843 34.8508 30.6579 36 33 36C36.866 36 40 32.866 40 29C40 25.134 36.866 22 33 22Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M32.5798 28H14.0196C11.7996 28 10 29.7997 10 32.0196C10 34.6902 12.5561 36.6183 15.1239 35.8846L32.97 30.7857C33.5797 30.6115 34 30.0543 34 29.4202C34 28.6359 33.3642 28 32.5798 28ZM14.0196 26C10.6951 26 8 28.6951 8 32.0196C8 36.0189 11.8279 38.9063 15.6733 37.8076L33.5194 32.7088C34.9877 32.2893 36 30.9472 36 29.4202C36 27.5313 34.4687 26 32.5798 26H14.0196Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M35.4 36.2C35.8418 35.8687 36.4686 35.9582 36.8 36.4L39.5 39.9998H41C41.5523 39.9998 42 40.4476 42 40.9998C42 41.5521 41.5523 41.9998 41 41.9998H36C35.4477 41.9998 35 41.5521 35 40.9998C35 40.4476 35.4477 39.9998 36 39.9998H36.9999L35.2 37.6C34.8686 37.1582 34.9582 36.5314 35.4 36.2Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.6 36.2C14.0418 36.5314 14.1314 37.1582 13.8 37.6L10.8 41.6C10.4686 42.0419 9.84183 42.1314 9.4 41.8C8.95817 41.4687 8.86863 40.8419 9.2 40.4L12.2 36.4C12.5314 35.9582 13.1582 35.8687 13.6 36.2Z" fill="black"/>
<path d="M7 41C7 40.4477 7.44772 40 8 40H13C13.5523 40 14 40.4477 14 41C14 41.5523 13.5523 42 13 42H8C7.44772 42 7 41.5523 7 41Z" fill="black"/>
<path d="M14 32C14 31.4477 14.4477 31 15 31H19C19.5523 31 20 31.4477 20 32C20 32.5523 19.5523 33 19 33H15C14.4477 33 14 32.5523 14 32Z" fill="black"/>
<path d="M16 32C16 33.1046 15.1046 34 14 34C12.8954 34 12 33.1046 12 32C12 30.8955 12.8954 30 14 30C15.1046 30 16 30.8955 16 32Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.7017 18.0455C11.2289 17.8808 11.7897 18.1746 11.9545 18.7017L14.4545 26.7016C14.6192 27.2288 14.3254 27.7897 13.7983 27.9544C13.2711 28.1191 12.7103 27.8253 12.5455 27.2982L10.0455 19.2983C9.88079 18.7712 10.1746 18.2103 10.7017 18.0455Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M35.3431 6.06073C35.8619 6.25023 36.1288 6.82438 35.9393 7.34314L34.9393 10.0807C34.8409 10.3501 34.6317 10.5642 34.3647 10.6688L30.7771 12.0738L33.9383 20.6542C34.1293 21.1724 33.8639 21.7473 33.3457 21.9383C32.8275 22.1292 32.2526 21.8639 32.0617 21.3456L28.5617 11.8457C28.3735 11.3349 28.6284 10.7674 29.1353 10.5689L33.2154 8.97094L34.0607 6.65692C34.2502 6.13816 34.8244 5.87124 35.3431 6.06073Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.4375 16.7537L8.93499 16.3035C8.43439 16.2534 8 16.6466 8 17.1497C8 17.6193 8.38072 18 8.85037 18H13.3753C13.7203 18 14 17.7203 14 17.3753C14 17.0544 13.7568 16.7857 13.4375 16.7537ZM9.134 14.3134C7.45602 14.1456 6 15.4633 6 17.1497C6 18.7239 7.27616 20 8.85037 20H13.3753C14.8249 20 16 18.8249 16 17.3753C16 16.0269 14.9782 14.8978 13.6365 14.7637L9.134 14.3134Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);