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 d="M33 9.22967V6H31V9H13V6H11V9.22967C11 14.6524 13.5895 19.6466 17.8037 22.7875C18.4275 22.3933 19.0782 22.0334 19.7536 21.7107C17.8831 20.4891 16.329 18.8727 15.1851 17H23.1319C23.2566 16.2999 23.4669 15.6295 23.7517 15H14.1615C13.6308 13.7364 13.2711 12.392 13.1051 11H27.4964C28.6894 10.3618 30.0525 10 31.5 10C32.0035 10 32.4968 10.0438 32.9763 10.1277C32.992 9.82987 33 9.53043 33 9.22967Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M22 22.9172C22.611 22.6536 23.1981 22.352 23.7589 22.0158C24.0375 22.6283 24.3867 23.2018 24.7959 23.7261C24.6398 23.8198 24.4819 23.9111 24.3223 24C23.698 24.3476 23.0469 24.6583 22.3714 24.9285C22.252 24.9762 22.1335 25.0254 22.0159 25.076L22 25.0828C19.1137 26.3281 16.7605 28.4211 15.1851 31H28.8149C27.671 29.1273 26.1169 27.5109 24.2464 26.2893C24.9218 25.9666 25.5725 25.6067 26.1963 25.2125C29.9474 28.0082 32.4113 32.2723 32.9075 37L33 42H31V39H13V42H11L11.0925 37C11.6672 31.5245 14.8813 26.6708 19.6777 24C20.302 23.6524 20.9531 23.3417 21.6286 23.0715C21.748 23.0238 21.8665 22.9746 21.9841 22.924L22 22.9172ZM29.8385 33H14.1615C13.6308 34.2636 13.2711 35.608 13.1051 37H30.8949C30.7289 35.608 30.3692 34.2636 29.8385 33Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M31.5 25C33.0621 25 34.4955 24.449 35.6164 23.5307L39.293 27.2072L40.7072 25.793L36.9531 22.0389C37.6153 21.0206 38 19.8052 38 18.5C38 14.9101 35.0899 12 31.5 12C27.9101 12 25 14.9101 25 18.5C25 22.0899 27.9101 25 31.5 25ZM31.5 23C33.9853 23 36 20.9853 36 18.5C36 16.0147 33.9853 14 31.5 14C29.0147 14 27 16.0147 27 18.5C27 20.9853 29.0147 23 31.5 23Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);