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="M21.2857 21.9149C21.3934 22.3134 21.4323 22.7504 21.3023 23.1081C21.2512 23.2488 21.1398 23.3591 20.9987 23.4089C20.8576 23.4586 20.7016 23.4426 20.5736 23.3652C20.3119 23.2069 20.0523 23.0046 19.8085 22.8078C19.7426 22.7545 19.6781 22.7018 19.6143 22.6498L19.6135 22.6491C19.4331 22.502 19.2585 22.3595 19.0791 22.2253C18.5774 21.8499 18.1791 21.6523 17.8345 21.6692C17.4717 21.687 17.0342 21.94 16.4719 22.3841C16.3135 22.5092 16.1434 22.6513 15.9668 22.799C15.579 23.1232 15.1593 23.4741 14.7599 23.7305C14.6163 23.8228 14.4355 23.8353 14.2804 23.7638C14.1254 23.6924 14.0175 23.5467 13.9944 23.3776C13.9445 23.013 14.0202 22.5568 14.1629 22.1111C14.3095 21.6531 14.5433 21.1551 14.8578 20.6948C15.4778 19.7877 16.4842 18.9329 17.831 18.9895C19.1318 19.0441 20.0947 19.8064 20.6753 20.6356C20.9666 21.0515 21.1734 21.4993 21.2857 21.9149Z" fill="black"/>
<path d="M26.6298 21.9149C26.5221 22.3134 26.4832 22.7504 26.6132 23.1081C26.6644 23.2488 26.7758 23.3591 26.9169 23.4089C27.058 23.4586 27.2139 23.4426 27.342 23.3652C27.6036 23.2069 27.8632 23.0046 28.107 22.8078C28.1729 22.7545 28.2375 22.7019 28.3013 22.6498L28.3026 22.6487C28.483 22.5016 28.6571 22.3595 28.8365 22.2253C29.3381 21.8499 29.7365 21.6523 30.081 21.6692C30.4438 21.687 30.8813 21.94 31.4436 22.3841C31.602 22.5092 31.7721 22.6513 31.9487 22.799C32.3365 23.1232 32.7563 23.4741 33.1556 23.7305C33.2993 23.8228 33.4801 23.8353 33.6351 23.7638C33.7901 23.6924 33.898 23.5467 33.9211 23.3776C33.971 23.013 33.8954 22.5568 33.7527 22.1111C33.606 21.6531 33.3723 21.1551 33.0577 20.6948C32.4377 19.7877 31.4313 18.9329 30.0845 18.9895C28.7838 19.0441 27.8208 19.8064 27.2402 20.6356C26.9489 21.0515 26.7421 21.4993 26.6298 21.9149Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M30.3684 31.494C30.572 31.2447 30.7335 30.9263 30.8397 30.6162C30.9454 30.3077 31.0289 29.913 30.9905 29.5094C30.9508 29.0927 30.7608 28.5534 30.2113 28.2322C29.7031 27.9351 29.1149 27.9636 28.5945 28.0941L28.5811 28.0977C26.1852 28.7337 25.0121 28.9969 23.8768 28.9918C22.7388 28.9867 21.5915 28.7127 19.2383 28.0992C18.7837 27.9714 18.2429 27.9403 17.7618 28.2295C17.2647 28.5282 17.0803 29.0172 17.0244 29.3835C16.9688 29.7483 17.0156 30.1111 17.0909 30.4047C17.1668 30.7004 17.292 31.0058 17.4623 31.2592C17.5785 31.4323 17.7509 31.6112 17.8133 31.6759C17.8232 31.6862 17.8303 31.6936 17.834 31.6976C19.1575 33.146 21.4962 34 24.0132 34C26.6364 34 29.0811 33.0703 30.3684 31.494ZM23.8678 30.9918C25.2736 30.9981 26.6653 30.6733 28.9027 30.0815C28.8928 30.1031 28.8828 30.1236 28.8727 30.1426C28.8452 30.1946 28.8248 30.2223 28.8193 30.2289C28.0331 31.1916 26.2582 32 24.0132 32C21.8715 32 20.1453 31.2622 19.3105 30.3485C19.2797 30.3148 19.2493 30.2829 19.226 30.2583L19.2243 30.2565C19.2057 30.237 19.1912 30.2216 19.1782 30.2077L19.1636 30.1919C19.1321 30.1575 19.1229 30.1447 19.1224 30.1439C19.1206 30.1411 19.1184 30.1378 19.1162 30.134C21.1823 30.6703 22.5107 30.9857 23.8678 30.9918Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M42 24C42 33.9411 33.9411 42 24 42C14.0589 42 6 33.9411 6 24C6 14.0589 14.0589 6 24 6C33.9411 6 42 14.0589 42 24ZM40 24C40 32.8366 32.8366 40 24 40C15.1634 40 8 32.8366 8 24C8 15.1634 15.1634 8 24 8C32.8366 8 40 15.1634 40 24Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);