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="M35.0866 9.40776C34.4835 7.95185 33.5996 6.62898 32.4853 5.51468L33.8995 4.10046C35.1995 5.40048 36.2307 6.94383 36.9343 8.64239C37.6379 10.341 38 12.1615 38 14C38 15.8385 37.6379 17.659 36.9343 19.3575C36.2307 21.0561 35.1995 22.5994 33.8995 23.8995L32.4853 22.4852C33.5996 21.3709 34.4835 20.0481 35.0866 18.5922C35.6896 17.1363 36 15.5758 36 14C36 12.4241 35.6896 10.8637 35.0866 9.40776Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M29.5433 11.7039C29.2417 10.9759 28.7998 10.3145 28.2426 9.75735L29.6569 8.34314C30.3997 9.08601 30.989 9.96792 31.391 10.9385C31.7931 11.9091 32 12.9494 32 14C32 15.0506 31.7931 16.0909 31.391 17.0615C30.989 18.0321 30.3997 18.914 29.6569 19.6568L28.2426 18.2426C28.7998 17.6855 29.2417 17.024 29.5433 16.2961C29.8448 15.5681 30 14.7879 30 14C30 13.2121 29.8448 12.4318 29.5433 11.7039Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.7574 9.75735C19.2002 10.3145 18.7583 10.9759 18.4567 11.7039C18.1552 12.4318 18 13.2121 18 14C18 14.7879 18.1552 15.5681 18.4567 16.2961C18.7583 17.024 19.2002 17.6855 19.7574 18.2426L18.3431 19.6568C17.6003 18.914 17.011 18.0321 16.609 17.0615C16.2069 16.0909 16 15.0506 16 14C16 12.9494 16.2069 11.9091 16.609 10.9385C17.011 9.96792 17.6003 9.08601 18.3431 8.34314L19.7574 9.75735Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.5147 5.51468C14.4004 6.62898 13.5165 7.95185 12.9134 9.40776C12.3104 10.8637 12 12.4241 12 14C12 15.5758 12.3104 17.1363 12.9134 18.5922C13.5165 20.0481 14.4004 21.3709 15.5147 22.4852L14.1005 23.8995C12.8005 22.5994 11.7693 21.0561 11.0657 19.3575C10.3621 17.659 10 15.8385 10 14C10 12.1615 10.3621 10.3409 11.0657 8.64239C11.7693 6.94383 12.8005 5.40048 14.1005 4.10046L15.5147 5.51468Z" fill="black"/>
<path d="M26 14C26 15.1045 25.1046 16 24 16C22.8954 16 22 15.1045 22 14C22 12.8954 22.8954 12 24 12C25.1046 12 26 12.8954 26 14Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 29C10 27.3431 11.3431 26 13 26H35C36.6569 26 38 27.3431 38 29V41C38 42.6568 36.6569 44 35 44H13C11.3431 44 10 42.6568 10 41V29ZM22 30C22 29.4477 21.5523 29 21 29H15.75C15.2733 29 14.8629 29.3364 14.7694 29.8038L14.0194 33.5538C13.9401 33.9504 14.1075 34.3558 14.4436 34.5808C14.7796 34.8059 15.2182 34.8064 15.5547 34.582C15.7657 34.4413 16.6978 34 18 34C19.1046 34 20 34.8954 20 36C20 37.1045 19.1046 38 18 38H17.1682C16.5907 38 16.1138 37.6399 15.9405 37.1603C15.7529 36.6408 15.1798 36.3718 14.6603 36.5594C14.1409 36.747 13.8719 37.3202 14.0595 37.8396C14.5174 39.1077 15.7437 40 17.1682 40H18C20.2091 40 22 38.2091 22 36C22 33.7908 20.2091 32 18 32C17.3891 32 16.8274 32.0723 16.3335 32.1816L16.5698 31H21C21.5523 31 22 30.5522 22 30ZM32.7526 31.7739C33.1208 31.3622 33.0856 30.73 32.6739 30.3618C31.9417 29.7069 31.0458 29.2585 30.0786 29.0662C29.011 28.8538 27.9045 28.9628 26.8988 29.3793C25.8932 29.7959 25.0337 30.5013 24.429 31.4063C23.8242 32.3114 23.5014 33.3754 23.5014 34.4639C23.5014 35.5524 23.8242 36.6164 24.429 37.5215C25.0337 38.4265 25.8932 39.1319 26.8988 39.5485C27.9045 39.965 29.011 40.074 30.0786 39.8616C31.0458 39.6692 31.9417 39.2209 32.6739 38.5659C32.886 38.3762 33.0073 38.1052 33.0073 37.8206V34.4639C33.0073 33.9116 32.5595 33.4639 32.0073 33.4639H29.0049C28.4526 33.4639 28.0049 33.9116 28.0049 34.4639C28.0049 35.0162 28.4526 35.4639 29.0049 35.4639H31.0073V37.3388C30.6128 37.6135 30.1642 37.8054 29.6884 37.9001C29.0088 38.0352 28.3044 37.9659 27.6642 37.7007C27.024 37.4355 26.4769 36.9865 26.0919 36.4103C25.7069 35.8342 25.5014 35.1568 25.5014 34.4639C25.5014 33.771 25.7069 33.0936 26.0919 32.5175C26.4769 31.9413 27.024 31.4923 27.6642 31.2271C28.3044 30.9619 29.0088 30.8925 29.6884 31.0277C30.3041 31.1502 30.8744 31.4356 31.3406 31.8525C31.7522 32.2207 32.3844 32.1855 32.7526 31.7739Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);