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="M19 12C19 10.5486 20.7177 9.33797 23 9.06001V6H25V9.06001C27.2822 9.33797 29 10.5486 29 12C29 12.3052 28.924 12.5998 28.7828 12.8773C28.8537 12.9665 28.9105 13.0694 28.9487 13.1838L29.9487 16.1838C30.1233 16.7077 29.8401 17.274 29.3162 17.4487C28.7923 17.6233 28.2259 17.3402 28.0513 16.8162L27.2122 14.2991C26.3434 14.7365 25.223 15 24 15C22.777 15 21.6565 14.7365 20.7877 14.2991L19.9487 16.8162C19.774 17.3402 19.2077 17.6233 18.6837 17.4487C18.1598 17.274 17.8766 16.7077 18.0513 16.1838L19.0513 13.1838C19.0894 13.0694 19.1462 12.9665 19.2172 12.8773C19.0759 12.5998 19 12.3052 19 12ZM21.4934 11.5937C22.038 11.2669 22.9194 11 24 11C25.0805 11 25.9619 11.2669 26.5065 11.5937C26.8195 11.7815 26.9388 11.9277 26.9821 12C26.9388 12.0723 26.8195 12.2185 26.5065 12.4063C25.9619 12.7331 25.0805 13 24 13C22.9194 13 22.038 12.7331 21.4934 12.4063C21.1804 12.2185 21.0611 12.0723 21.0179 12C21.0611 11.9277 21.1804 11.7815 21.4934 11.5937Z" fill="black"/>
<path d="M17.2227 18.578C17.634 18.9466 17.6686 19.5788 17.3 19.9901L15.1893 22.3449C14.8207 22.7562 14.1885 22.7907 13.7772 22.4221C13.3659 22.0535 13.3314 21.4213 13.7 21.01L15.8106 18.6552C16.1793 18.2439 16.8115 18.2094 17.2227 18.578Z" fill="black"/>
<path d="M11.4472 24.3944C11.9412 24.1474 12.1414 23.5468 11.8944 23.0528C11.6474 22.5588 11.0467 22.3586 10.5528 22.6056L7.99997 23.882V27.5C7.99997 28.0523 8.44769 28.5 8.99997 28.5C9.55226 28.5 9.99997 28.0523 9.99997 27.5V25.118L11.4472 24.3944Z" fill="black"/>
<path d="M6.10555 41.9472C5.85856 41.4532 6.05878 40.8526 6.55276 40.6056L7.99998 39.882L7.99998 37.5C7.99998 36.9477 8.44769 36.5 8.99998 36.5C9.55226 36.5 9.99998 36.9477 9.99998 37.5V41.118L7.44719 42.3944C6.95321 42.6414 6.35254 42.4412 6.10555 41.9472Z" fill="black"/>
<path d="M9.99997 31C9.99997 30.4477 9.55226 30 8.99997 30C8.44769 30 7.99997 30.4477 7.99997 31V34C7.99997 34.5523 8.44769 35 8.99997 35C9.55226 35 9.99997 34.5523 9.99997 34V31Z" fill="black"/>
<path d="M30.7 19.9901C30.3314 19.5788 30.3659 18.9466 30.7772 18.578C31.1885 18.2094 31.8207 18.2439 32.1893 18.6552L34.3 21.01C34.6686 21.4213 34.634 22.0535 34.2228 22.4221C33.8115 22.7907 33.1793 22.7562 32.8106 22.3449L30.7 19.9901Z" fill="black"/>
<path d="M36.1056 23.0528C35.8586 23.5468 36.0588 24.1474 36.5528 24.3944L38 25.118V27.5C38 28.0523 38.4477 28.5 39 28.5C39.5523 28.5 40 28.0523 40 27.5V23.882L37.4472 22.6056C36.9532 22.3586 36.3525 22.5588 36.1056 23.0528Z" fill="black"/>
<path d="M41.4472 40.6056C41.9412 40.8526 42.1414 41.4532 41.8944 41.9472C41.6474 42.4412 41.0467 42.6414 40.5528 42.3944L38 41.118V37.5C38 36.9477 38.4477 36.5 39 36.5C39.5523 36.5 40 36.9477 40 37.5V39.882L41.4472 40.6056Z" fill="black"/>
<path d="M39 30C38.4477 30 38 30.4477 38 31V34C38 34.5523 38.4477 35 39 35C39.5523 35 40 34.5523 40 34V31C40 30.4477 39.5523 30 39 30Z" fill="black"/>
<path d="M16 27L16 42H18V38H31V42H33V36H18L18 27H16Z" fill="black"/>
<path d="M20 32C19.1715 32 18.5 32.6716 18.5 33.5C18.5 34.3284 19.1715 35 20 35H32C32.8284 35 33.5 34.3284 33.5 33.5C33.5 32.6716 32.8284 32 32 32H20Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);