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="M22 13C24.4853 13 26.5 10.9853 26.5 8.5C26.5 6.01472 24.4853 4 22 4C19.5147 4 17.5 6.01472 17.5 8.5C17.5 10.9853 19.5147 13 22 13Z" fill="black"/>
<path d="M35 25C33.3431 25 32 26.3431 32 28V28.343C32 28.8953 32.4477 29.343 33 29.343C33.5523 29.343 34 28.8953 34 28.343V28C34 27.4477 34.4477 27 35 27C35.5523 27 36 27.4477 36 28V42.9456C36 43.4979 36.4477 43.9456 37 43.9456C37.5523 43.9456 38 43.4979 38 42.9456V28C38 26.3431 36.6569 25 35 25Z" fill="black"/>
<path d="M29.7087 20.179L28 19.4325L29.5954 20.1103C29.6339 20.133 29.6717 20.1559 29.7087 20.179Z" fill="black"/>
<path d="M30.9352 21.2414C30.6569 20.9031 30.266 20.5259 29.7087 20.179L36.0008 22.928C36.0016 22.9623 36.0021 22.9647 35.9998 22.8323L36 22.8339C36.0953 23.9347 35.2453 24.9014 34.1014 24.9931C32.9668 25.0841 31.9693 24.2802 31.86 23.193L31.8598 23.1915C31.8583 23.1802 31.854 23.1506 31.8453 23.1051C31.8277 23.0137 31.7932 22.8623 31.7297 22.6711C31.6019 22.2861 31.3651 21.764 30.9352 21.2414Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M35.9998 22.8311L29.5954 20.1103C29.1648 19.8557 28.6404 19.6204 28 19.4325V42C28 43.0658 27.1642 43.9444 26.0996 43.9975C25.0351 44.0506 24.116 43.2596 24.0099 42.199L23.0099 32.199C23.0033 32.1326 23 32.0662 23 32H21C21 32.0662 20.9967 32.1326 20.9901 32.199L19.9901 42.199C19.884 43.2596 18.9649 44.0506 17.9004 43.9975C16.8359 43.9444 16 43.0658 16 42V27.919C14.3213 27.6961 12.9103 27.0212 11.8635 25.9941C10.5862 24.7407 9.98424 23.0911 10.0003 21.4808C10.0164 19.8719 10.6491 18.239 11.9188 17.0013C13.211 15.7416 15.0496 15 17.2549 15H24.5759C29.5475 15 32.5189 16.722 34.1944 18.7586C34.9985 19.736 35.4437 20.7139 35.6894 21.4539C35.8353 21.8933 35.9494 22.3475 35.9975 22.8073L35.9989 22.8218L35.9995 22.8281L35.9998 22.8311ZM14.8314 23.1934C15.0877 23.445 15.4622 23.6889 16 23.8414V19.17C15.4992 19.3219 15.1361 19.5588 14.8772 19.8112C14.4158 20.261 14.1634 20.8781 14.157 21.5192C14.1506 22.1589 14.3889 22.7593 14.8314 23.1934Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);