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="M30.4035 5.08497C30.9088 5.30778 31.1378 5.89807 30.915 6.40341L30 5.99998C30.915 6.40341 30.9151 6.40318 30.915 6.40341L30.9145 6.40457L30.9095 6.41599L30.8946 6.44948C30.8816 6.47865 30.8624 6.52139 30.8373 6.57695C30.7871 6.68808 30.7131 6.85056 30.6168 7.05845C30.424 7.47417 30.1417 8.07182 29.7815 8.80394C29.0613 10.2673 28.0274 12.2722 26.7725 14.4375C24.2893 18.7222 20.8478 23.8016 17.1779 26.4468L17.1762 26.4481C13.3194 29.2159 12.5743 32.2502 13.1976 34.4373C13.8393 36.6893 15.9969 38.3725 18.6437 38.3725H19.1156C19.4217 37.306 20.2196 36.275 21.5774 35.6419C23.1162 34.9243 25.2972 34.7469 28.2261 35.4267C28.7641 35.5515 29.099 36.0889 28.9741 36.6268C28.8493 37.1648 28.3119 37.4997 27.7739 37.3749C25.1029 36.7549 23.4172 36.9907 22.4227 37.4545C21.8795 37.7077 21.5215 38.0367 21.2969 38.3725H21.8726C24.4282 38.3725 26.5 40.4443 26.5 43H24.5C24.5 41.5489 23.3237 40.3725 21.8726 40.3725H18.6437C15.139 40.3725 12.1703 38.1304 11.2741 34.9854C10.3595 31.7759 11.6647 27.9421 16.0091 24.8239C19.3008 22.451 22.5625 17.7129 25.0421 13.4346C26.2687 11.3182 27.2812 9.35506 27.987 7.92083C28.3397 7.20413 28.6153 6.62058 28.8022 6.21731C28.8957 6.0157 28.967 5.85922 29.0146 5.75378C29.0384 5.70106 29.0563 5.6611 29.0681 5.63465L29.0812 5.60519L29.0849 5.59672C29.3078 5.09138 29.8981 4.86216 30.4035 5.08497Z" fill="black"/>
<path d="M32.5289 39.8487C33.9392 38.9698 35.2367 37.0814 35.7557 34.9909C36.2866 32.8525 36.0417 30.3276 34.0958 28.3064L32.655 29.6935C34.0101 31.101 34.2236 32.8617 33.8147 34.509C33.3938 36.2042 32.3531 37.6016 31.4711 38.1513L32.5289 39.8487Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);