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="M12.822 33.9969C12.9159 34.0003 13.0258 34.0025 13.1538 34.0025C14.1742 34.0025 15.1196 34.2338 15.9193 34.764C16.7212 35.2957 17.2144 36.0203 17.5113 36.729C17.9303 37.7291 18.0089 38.8508 18.023 39.6603C18.1967 39.7078 18.4375 39.7597 18.7607 39.8064C20.0665 39.9953 21.8938 40 24 40C26.1062 40 27.9335 39.9953 29.2393 39.8064C29.5625 39.7597 29.8033 39.7078 29.977 39.6603C29.9911 38.8507 30.0697 37.7291 30.4887 36.729C30.7856 36.0203 31.2788 35.2957 32.0807 34.764C32.8804 34.2338 33.8258 34.0025 34.8462 34.0025C34.9742 34.0025 35.0841 34.0003 35.178 33.9969C35.1785 33.9057 35.1777 33.8029 35.1757 33.6865C35.1729 33.5156 35.1669 33.3069 35.1602 33.07C35.146 32.5713 35.1282 31.9478 35.1282 31.2902C35.1282 29.141 35.918 27.897 36.4933 26.9907C36.6141 26.8004 36.7255 26.625 36.8181 26.4593C37.3258 25.5505 38 23.9828 38 19.7236C38 15.8082 36.3199 12.9522 33.7874 11.0214C31.1994 9.04819 27.6491 8 24 8C20.3509 8 16.8006 9.04819 14.2126 11.0214C11.6801 12.9522 9.99998 15.8082 10 19.7236C10 23.9828 10.6742 25.5505 11.1819 26.4593C11.2745 26.625 11.3859 26.8004 11.5067 26.9907C12.082 27.897 12.8718 29.141 12.8718 31.2902C12.8718 31.9478 12.854 32.5713 12.8398 33.07C12.8331 33.3069 12.8271 33.5157 12.8243 33.6865C12.8223 33.8029 12.8215 33.9057 12.822 33.9969ZM10.842 32.9583C10.7715 35.4043 10.7542 36.0025 13.1538 36.0025C16.0256 36.0025 16.0256 38.5729 16.0256 40.2864C16.0256 42 19.8975 42 24 42C28.1025 42 31.9744 42 31.9744 40.2864C31.9744 38.5729 31.9744 36.0025 34.8462 36.0025C37.2458 36.0025 37.2285 35.4043 37.158 32.9583C37.1441 32.477 37.1282 31.9241 37.1282 31.2902C37.1282 29.7648 37.5778 29.0441 38.1211 28.1729C38.9511 26.8422 40 25.1606 40 19.7236C40.0001 1.42546 7.99991 1.42546 8 19.7236C8.00003 25.1606 9.04892 26.8422 9.8789 28.1729C10.4222 29.0441 10.8718 29.7648 10.8718 31.2902C10.8718 31.9241 10.8559 32.477 10.842 32.9583Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M35.0044 27.9922C35.0066 30.7537 32.9936 32.994 30.5083 32.9961C28.023 32.9983 26.0066 30.7614 26.0044 28C26.0022 25.2386 28.0152 22.9983 30.5005 22.9961C32.9858 22.994 35.0022 25.2308 35.0044 27.9922ZM33.0044 27.994C33.0059 29.8542 31.6945 30.9951 30.5067 30.9961C29.319 30.9971 28.0059 29.8585 28.0044 27.9983C28.0029 26.138 29.3143 24.9971 30.5021 24.9961C31.6898 24.9951 33.0029 26.1337 33.0044 27.994Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M22.0011 28C22.0014 30.7614 19.9869 33 17.5016 33C15.0163 33 13.0014 30.7614 13.0011 28C13.0007 25.2386 15.0152 23 17.5005 23C19.9858 23 22.0007 25.2386 22.0011 28ZM20.0011 28C20.0013 29.8603 18.6891 31 17.5014 31C16.3137 31 15.0013 29.8603 15.0011 28C15.0008 26.1397 16.313 25 17.5007 25C18.6884 25 20.0008 26.1397 20.0011 28Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M23.9701 33.0084C23.982 33.0028 23.9883 33 23.9883 33C23.9883 33 23.9944 33.0026 24.0061 33.0078C24.2532 33.117 26.9883 34.369 26.9883 36.2759C26.9883 37.1062 26.4088 37.8805 25.589 37.9874C25.5256 37.9957 25.4607 38 25.3945 38C24.7553 38 24.2811 37.6278 23.9883 37.0998C23.6955 37.6278 23.2212 38 22.582 38C22.5159 38 22.451 37.9957 22.3876 37.9874C21.5677 37.8805 20.9883 37.1061 20.9883 36.2759C20.9883 34.4486 23.7204 33.1255 23.9701 33.0084ZM22.2278 36.1486L22.2268 36.15L22.2278 36.1486ZM25.7487 36.1486L25.7498 36.15L25.7487 36.1486Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);