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="M35.0843 38.1833C39.2942 34.8886 42 29.7603 42 24C42 16.1432 36.9663 9.46218 29.9479 7.00593L30.6088 5.1177C38.407 7.84687 44 15.2703 44 24C44 30.413 40.9816 36.1211 36.288 39.781L35.0843 38.1833Z" fill="black"/>
<path d="M28.466 41.4417C27.0379 41.8062 25.5416 42 24 42C22.4922 42 21.0278 41.8146 19.6282 41.4654L19.1526 43.4086C20.7046 43.7949 22.3284 44 24 44C25.7055 44 27.3611 43.7865 28.9416 43.3849L28.466 41.4417Z" fill="black"/>
<path d="M6 24C6 29.789 8.7328 34.9397 12.9787 38.2324L11.7751 39.83C7.04544 36.1722 4 30.4417 4 24C4 15.2703 9.59303 7.84687 17.3912 5.1177L18.0521 7.00593C11.0337 9.46218 6 16.1432 6 24Z" fill="black"/>
<path d="M28.5 8.50001C28.5 10.9853 26.4853 13 24 13C21.5147 13 19.5 10.9853 19.5 8.50001C19.5 6.01779 21.5098 4.00497 23.9908 4.00002H24.0092C26.4902 4.00497 28.5 6.01779 28.5 8.50001Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M16 22C16.7286 22 17.4117 21.8052 18 21.4649V25.9851L17.9999 26V29C17.9999 28.9981 17.9999 28.997 17.9998 28.9967C17.9997 28.9965 17.9996 28.997 17.9993 28.9984L17.9977 29.0092C17.991 29.055 17.9657 29.2287 17.8732 29.5781C17.7678 29.9761 17.6095 30.4791 17.4068 31.0645C17.3711 31.1679 17.3341 31.2731 17.2962 31.38C15.9392 32.0198 15 33.4002 15 35C15 35.5221 15.1 36.0208 15.2819 36.478C14.9465 37.2745 14.6309 38.0072 14.3694 38.6077C14.1605 39.0873 13.9866 39.4816 13.8652 39.7553C13.8044 39.8922 13.7569 39.9989 13.7246 40.071L13.6761 40.1793C13.2535 41.1184 13.6131 42.2248 14.5069 42.7361C15.4008 43.2474 16.5368 42.9964 17.132 42.156L19.3801 38.9822C21.411 38.7907 23 37.0809 23 35C23 34.6679 22.9595 34.3452 22.8832 34.0366L24 32.4601L30.868 42.156C31.4632 42.9963 32.5992 43.2474 33.493 42.7361C34.3869 42.2248 34.7464 41.1184 34.3239 40.1793L34.2753 40.071C34.2431 39.9989 34.1955 39.8922 34.1348 39.7553C34.0133 39.4816 33.8394 39.0873 33.6305 38.6077C33.2124 37.6475 32.6561 36.3495 32.1011 34.9927C31.5441 33.6312 30.9974 32.2325 30.5931 31.0645C30.3905 30.4791 30.2321 29.9761 30.1268 29.5781C30.0343 29.2287 30.009 29.055 30.0023 29.0092C30.0016 29.0044 30.0011 29.0009 30.0007 28.9989C30.0002 28.9955 30 28.996 30 29L30 26.4649C31.1956 25.7733 32 24.4806 32 23C32 21.8053 31.4762 20.733 30.6458 20H36C37.1046 20 38 19.1046 38 18C38 16.8954 37.1046 16 36 16H19.4649C18.7733 14.8044 17.4806 14 16 14C14.5194 14 13.2267 14.8044 12.5351 16H12C10.8954 16 10 16.8954 10 18C10 19.1046 10.8954 20 12 20H12.5351C13.2267 21.1956 14.5194 22 16 22ZM18 18C18 19.1046 17.1046 20 16 20C14.8954 20 14 19.1046 14 18C14 16.8954 14.8954 16 16 16C17.1046 16 18 16.8954 18 18ZM30 23C30 24.1046 29.1046 25 28 25C26.8954 25 26 24.1046 26 23C26 21.8954 26.8954 21 28 21C29.1046 21 30 21.8954 30 23ZM21 35C21 36.1046 20.1046 37 19 37C17.8954 37 17 36.1046 17 35C17 33.8954 17.8954 33 19 33C20.1046 33 21 33.8954 21 35Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);