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="M32.4853 5.5148C33.5996 6.6291 34.4835 7.95197 35.0866 9.40788C35.6896 10.8638 36 12.4242 36 14.0001C36 15.5759 35.6896 17.1364 35.0866 18.5923C34.4835 20.0482 33.5996 21.3711 32.4853 22.4854L33.8995 23.8996C35.1995 22.5996 36.2308 21.0562 36.9343 19.3577C37.6379 17.6591 38 15.8386 38 14.0001C38 12.1616 37.6379 10.3411 36.9343 8.64251C36.2308 6.94396 35.1995 5.40061 33.8995 4.10059L32.4853 5.5148Z" fill="black"/>
<path d="M18.75 31C19.4404 31 20 31.5596 20 32.25C20 32.6201 19.8404 32.9516 19.5831 33.1819C19.5736 33.1904 19.5643 33.1991 19.5551 33.2079L14.3051 38.2809C14.012 38.5641 13.9201 38.9969 14.0729 39.3747C14.2256 39.7526 14.5924 40 15 40H21C21.5523 40 22 39.5523 22 39C22 38.4477 21.5523 38 21 38H17.474L20.9324 34.6583C21.5867 34.065 22 33.2051 22 32.25C22 30.4551 20.5449 29 18.75 29H17.25C15.8334 29 14.6309 29.9058 14.1852 31.1668C14.0011 31.6875 14.2741 32.2588 14.7948 32.4428C15.3155 32.6269 15.8868 32.354 16.0709 31.8332C16.2429 31.3464 16.7073 31 17.25 31H18.75Z" fill="black"/>
<path d="M32.7526 31.7742C33.1208 31.3626 33.0856 30.7304 32.6739 30.3622C31.9417 29.7072 31.0458 29.2589 30.0786 29.0665C29.011 28.8541 27.9045 28.9631 26.8989 29.3797C25.8932 29.7962 25.0337 30.5016 24.429 31.4067C23.8242 32.3117 23.5015 33.3757 23.5015 34.4642C23.5015 35.5527 23.8242 36.6168 24.429 37.5218C25.0337 38.4268 25.8932 39.1322 26.8989 39.5488C27.9045 39.9653 29.011 40.0743 30.0786 39.862C31.0458 39.6696 31.9417 39.2213 32.6739 38.5663C32.886 38.3766 33.0073 38.1055 33.0073 37.8209V34.4642C33.0073 33.9119 32.5596 33.4642 32.0073 33.4642H29.0049C28.4527 33.4642 28.0049 33.9119 28.0049 34.4642C28.0049 35.0165 28.4527 35.4642 29.0049 35.4642H31.0073V37.3391C30.6128 37.6139 30.1642 37.8058 29.6884 37.9004C29.0088 38.0356 28.3044 37.9662 27.6642 37.701C27.024 37.4359 26.4769 36.9868 26.0919 36.4107C25.7069 35.8345 25.5015 35.1572 25.5015 34.4642C25.5015 33.7713 25.7069 33.0939 26.0919 32.5178C26.4769 31.9417 27.024 31.4926 27.6642 31.2274C28.3044 30.9623 29.0088 30.8929 29.6884 31.0281C30.3042 31.1505 30.8744 31.4359 31.3406 31.8529C31.7522 32.2211 32.3844 32.1858 32.7526 31.7742Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 28C10 26.3431 11.3431 25 13 25H35C36.6569 25 38 26.3431 38 28V41C38 42.6569 36.6569 44 35 44H13C11.3431 44 10 42.6569 10 41V28ZM12 28C12 27.4477 12.4477 27 13 27H35C35.5523 27 36 27.4477 36 28V41C36 41.5523 35.5523 42 35 42H13C12.4477 42 12 41.5523 12 41V28Z" fill="black"/>
<path d="M29.5433 11.704C29.2418 10.9761 28.7998 10.3146 28.2426 9.75748L29.6569 8.34326C30.3997 9.08613 30.989 9.96804 31.391 10.9386C31.7931 11.9093 32 12.9495 32 14.0001C32 15.0507 31.7931 16.091 31.391 17.0616C30.989 18.0322 30.3997 18.9141 29.6569 19.657L28.2426 18.2428C28.7998 17.6856 29.2418 17.0242 29.5433 16.2962C29.8448 15.5683 30 14.788 30 14.0001C30 13.2122 29.8448 12.432 29.5433 11.704Z" fill="black"/>
<path d="M18.4567 11.704C18.7583 10.9761 19.2002 10.3146 19.7574 9.75748L18.3431 8.34326C17.6003 9.08613 17.011 9.96804 16.609 10.9386C16.2069 11.9093 16 12.9495 16 14.0001C16 15.0507 16.2069 16.091 16.609 17.0616C17.011 18.0322 17.6003 18.9141 18.3431 19.657L19.7574 18.2428C19.2002 17.6856 18.7583 17.0242 18.4567 16.2962C18.1552 15.5683 18 14.788 18 14.0001C18 13.2122 18.1552 12.432 18.4567 11.704Z" fill="black"/>
<path d="M15.5147 5.5148C14.4004 6.6291 13.5165 7.95197 12.9134 9.40788C12.3104 10.8638 12 12.4242 12 14.0001C12 15.5759 12.3104 17.1364 12.9134 18.5923C13.5165 20.0482 14.4004 21.3711 15.5147 22.4854L14.1005 23.8996C12.8005 22.5996 11.7693 21.0562 11.0657 19.3576C10.3621 17.6591 10 15.8386 10 14.0001C10 12.1616 10.3621 10.3411 11.0657 8.64251C11.7693 6.94395 12.8005 5.40061 14.1005 4.10059L15.5147 5.5148Z" fill="black"/>
<path d="M24 16C25.1046 16 26 15.1046 26 14C26 12.8954 25.1046 12 24 12C22.8954 12 22 12.8954 22 14C22 15.1046 22.8954 16 24 16Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);