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.7814 14.7674L33.7847 14.7749L33.7863 14.7785C33.8109 14.8347 33.8307 14.894 33.8446 14.9538L35.3736 21.5213C33.3597 21.7292 31.7891 23.4312 31.7891 25.5V25.7305C31.7891 27.9396 33.5799 29.7305 35.7891 29.7305H36.7011C36.252 30.7944 35.2014 31.5688 33.9341 31.5688H32.0794V35.1773C32.0794 35.7296 31.6317 36.1773 31.0794 36.1773H24.9143V42H22.9143V35.1773C22.9143 34.625 23.3621 34.1773 23.9143 34.1773H30.0794V31.5688H28.3368C26.1219 31.5688 24.6707 29.2511 25.638 27.2586L26.5437 25.393C20.5144 26.4729 14.6347 26.2055 8.16314 22.5176C8.64522 25.2117 10.124 27.1064 11.6296 28.3961C12.5513 29.1857 13.4767 29.741 14.1717 30.0982C14.5182 30.2763 14.8044 30.4036 15.0002 30.4851C15.098 30.5258 15.173 30.5549 15.2213 30.5732L15.2545 30.5855L15.2733 30.5923L15.2829 30.5958C15.6868 30.7345 15.958 31.1144 15.958 31.5415V42H13.958V32.2135C13.7588 32.1247 13.5222 32.0131 13.2574 31.877C12.4604 31.4673 11.3962 30.8297 10.3284 29.915C8.1841 28.0781 6 25.0944 6 20.6342C6 15.8739 8.26081 11.9664 11.6795 9.39753C14.5233 7.26076 17.2492 6 21.2274 6C25.6294 6 28.7867 8.2415 30.8038 10.409C31.8136 11.4941 32.5535 12.5759 33.0416 13.3864C33.2862 13.7927 33.4692 14.1334 33.5924 14.3759C33.6541 14.4972 33.7009 14.5941 33.7332 14.6627C33.7493 14.697 33.7618 14.7242 33.7707 14.7438L33.7814 14.7674ZM37.2144 27.7331H38.6294V42H41.9862V26.5206C41.9976 24.8557 40.6511 23.5 38.9862 23.5H36.1342H35.8342H35.6397C34.5351 23.5 33.6397 24.3954 33.6397 25.5V25.7305C33.6397 26.835 34.5351 27.7305 35.6397 27.7305H37.2144V27.7331ZM30.2226 17.9582C26.5226 14.2907 22.042 10.3442 15.3343 9.40557C17.0733 8.48382 18.8909 8 21.2274 8C24.8861 8 27.5504 9.84875 29.3397 11.7715C30.2332 12.7316 30.8927 13.6949 31.3283 14.4182C31.5048 14.7113 31.6434 14.9632 31.7451 15.1573L30.2226 17.9582ZM12.6174 11.1997C20.2986 11.3214 25.03 15.5959 29.252 19.8144L27.6374 23.1402C21.0417 24.5448 14.9473 24.4616 8.0113 20.0949C8.16758 16.3855 9.9332 13.3219 12.6174 11.1997Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);