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="M6.29289 6.29289C6.68342 5.90237 7.31658 5.90237 7.70711 6.29289L12 10.5858V8C12 7.44772 12.4477 7 13 7C13.5523 7 14 7.44772 14 8V14H8C7.44772 14 7 13.5523 7 13C7 12.4477 7.44772 12 8 12H10.5858L6.29289 7.70711C5.90237 7.31658 5.90237 6.68342 6.29289 6.29289Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M41.7071 41.7071C41.3166 42.0976 40.6834 42.0976 40.2929 41.7071L36 37.4142V40C36 40.5523 35.5523 41 35 41C34.4477 41 34 40.5523 34 40V34L40 34C40.5523 34 41 34.4477 41 35C41 35.5523 40.5523 36 40 36H37.4142L41.7071 40.2929C42.0976 40.6834 42.0976 41.3166 41.7071 41.7071Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.29289 41.7071C5.90237 41.3166 5.90237 40.6834 6.29289 40.2929L10.5858 36H8C7.44772 36 7 35.5523 7 35C7 34.4477 7.44772 34 8 34H14L14 40C14 40.5523 13.5523 41 13 41C12.4477 41 12 40.5523 12 40V37.4142L7.70711 41.7071C7.31658 42.0976 6.68342 42.0976 6.29289 41.7071Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M41.7071 6.29289C42.0976 6.68342 42.0976 7.31658 41.7071 7.70711L37.4142 12H40C40.5523 12 41 12.4477 41 13C41 13.5523 40.5523 14 40 14L34 14V8C34 7.44772 34.4477 7 35 7C35.5523 7 36 7.44772 36 8V10.5858L40.2929 6.29289C40.6834 5.90237 41.3166 5.90237 41.7071 6.29289Z" fill="black"/>
<path d="M35.1 19.5C35.1 21.4338 33.5337 23 31.6 23C29.6662 23 28.1 21.4338 28.1 19.5C28.1 17.5662 29.6662 16 31.6 16C33.5337 16 35.1 17.5662 35.1 19.5Z" fill="black"/>
<path d="M20.1 19.5C20.1 21.4338 18.5337 23 16.6 23C14.6662 23 13.1 21.4338 13.1 19.5C13.1 17.5662 14.6662 16 16.6 16C18.5337 16 20.1 17.5662 20.1 19.5Z" fill="black"/>
<path d="M26.5 18.5C26.5 19.8813 25.3813 21 24 21C22.6187 21 21.5 19.8813 21.5 18.5C21.5 17.1187 22.6187 16 24 16C25.3813 16 26.5 17.1187 26.5 18.5Z" fill="black"/>
<path d="M25 28.8582C25 26.2925 28.9975 25 31 25C33.0025 25 37 26.2925 37 28.8582V31H25V28.8582Z" fill="black"/>
<path d="M11 28.8582C11 26.2925 14.9975 25 17 25C19.0025 25 23 26.2925 23 28.8582V31H11V28.8582Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M28.0382 23.4573C27.8114 23.5407 27.5875 23.6292 27.3682 23.7229C26.3728 24.1483 25.3675 24.723 24.5866 25.4917C24.3774 25.6977 24.179 25.9235 24 26.1688C23.8211 25.9235 23.6226 25.6977 23.4135 25.4918C22.6325 24.723 21.6273 24.1483 20.6318 23.7229C20.4125 23.6292 20.1887 23.5407 19.9618 23.4573C21.256 22.7867 22.9204 22.45 24 22.45C25.0796 22.45 26.744 22.7867 28.0382 23.4573Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);