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="M14.9531 16.6302C19.7687 18.4906 25.5556 18.4899 30.3705 16.6283C32.2742 18.6233 34.0664 21.1329 35.3587 23.7708C35.415 23.8857 35.4702 24.0006 35.5244 24.1154C36.3961 24.2488 37.2308 24.4947 38.0132 24.8379C36.5873 21.1944 34.1726 17.6523 31.5782 15L35.2722 9.6C34.8536 9.32094 34.2602 8.97698 33.5239 8.6134C33.4787 8.59106 33.4329 8.56864 33.3865 8.54616C30.9454 7.36139 27.0259 6 22.7111 6C18.3047 6 14.2796 7.41991 11.8253 8.62149C11.5814 8.74087 11.3531 8.85811 11.1414 8.97158C10.7137 9.20082 10.3541 9.41472 10.0722 9.6L13.7404 15C5.15076 24.0384 -1.24996 41.9971 22.7111 41.9971C24.5154 41.9971 26.1465 41.8934 27.6166 41.6979C26.9726 41.1633 26.3968 40.5494 25.9041 39.8712C24.9217 39.9533 23.8592 39.9971 22.7111 39.9971C16.9264 39.9971 13.2981 38.9058 11.1316 37.4056C9.05623 35.9685 8.14534 34.0366 8.01599 31.7738C7.88162 29.4234 8.60103 26.6809 9.94818 23.9044C11.2331 21.2562 13.0268 18.7072 14.9531 16.6302ZM29.2043 14.928L32.1616 10.605C29.4122 10.8028 26.1391 11.4493 22.989 12.3606C20.7396 13.0114 18.2402 12.912 15.9241 12.4846C15.336 12.3761 14.755 12.2456 14.1873 12.0987L16.1077 14.9257C20.2226 16.3907 25.0886 16.3914 29.2043 14.928ZM13.8037 9.91633C14.6035 10.1542 15.439 10.3614 16.287 10.5178C18.4367 10.9145 20.5937 10.9715 22.4332 10.4394C24.579 9.81864 26.8237 9.30397 28.9626 8.96795C27.1224 8.4139 24.9717 8 22.7111 8C19.2664 8 16.0533 8.96102 13.8037 9.91633Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M22.67 28C23.6915 28 24.6235 28.3829 25.3304 29.0129C24.9602 29.655 24.6593 30.3421 24.4379 31.064C24.1022 30.4311 23.4364 30 22.67 30V34C23.187 34 23.6582 33.8038 24.0132 33.4819C24.0044 33.6535 24 33.8262 24 34C24 34.586 24.0504 35.1601 24.1471 35.7184C23.6901 35.9001 23.1917 36 22.67 36V37H20.67V36C18.9269 36 17.4465 34.8855 16.8979 33.3332C16.7139 32.8125 16.9868 32.2412 17.5075 32.0572C18.0282 31.8731 18.5995 32.146 18.7836 32.6668C19.0586 33.4449 19.8008 34 20.67 34V30C18.4609 30 16.67 28.2091 16.67 26C16.67 23.7909 18.4609 22 20.67 22V21H22.67V22C24.4132 22 25.8935 23.1145 26.4422 24.6668C26.6262 25.1875 26.3533 25.7588 25.8326 25.9428C25.3119 26.1269 24.7405 25.854 24.5565 25.3332C24.2815 24.5551 23.5393 24 22.67 24V28ZM20.67 24C19.5655 24 18.67 24.8954 18.67 26C18.67 27.1046 19.5655 28 20.67 28V24Z" fill="black"/>
<path d="M35 34.4196L36.1899 33.353L37.5248 34.8423L34.0002 38.0017L30.4756 34.8423L31.8105 33.353L33 34.4192V30H35V34.4196Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M34 42C38.4183 42 42 38.4183 42 34C42 29.5817 38.4183 26 34 26C29.5817 26 26 29.5817 26 34C26 38.4183 29.5817 42 34 42ZM34 40C37.3137 40 40 37.3137 40 34C40 30.6863 37.3137 28 34 28C30.6863 28 28 30.6863 28 34C28 37.3137 30.6863 40 34 40Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);