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 40V34H40C40.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 fill-rule="evenodd" clip-rule="evenodd" d="M31.6 21C32.4292 21 33.1 20.3292 33.1 19.5C33.1 18.6708 32.4292 18 31.6 18C30.7708 18 30.1 18.6708 30.1 19.5C30.1 20.3292 30.7708 21 31.6 21ZM31.6 23C33.5337 23 35.1 21.4338 35.1 19.5C35.1 17.5662 33.5337 16 31.6 16C29.6662 16 28.1 17.5662 28.1 19.5C28.1 21.4338 29.6662 23 31.6 23Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.6 21C17.4292 21 18.1 20.3292 18.1 19.5C18.1 18.6708 17.4292 18 16.6 18C15.7708 18 15.1 18.6708 15.1 19.5C15.1 20.3292 15.7708 21 16.6 21ZM16.6 23C18.5337 23 20.1 21.4338 20.1 19.5C20.1 17.5662 18.5337 16 16.6 16C14.6662 16 13.1 17.5662 13.1 19.5C13.1 21.4338 14.6662 23 16.6 23Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24 19C24.2767 19 24.5 18.7767 24.5 18.5C24.5 18.2233 24.2767 18 24 18C23.7233 18 23.5 18.2233 23.5 18.5C23.5 18.7767 23.7233 19 24 19ZM24 21C25.3813 21 26.5 19.8813 26.5 18.5C26.5 17.1187 25.3813 16 24 16C22.6187 16 21.5 17.1187 21.5 18.5C21.5 19.8813 22.6187 21 24 21Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M28.165 27.7449C27.1061 28.2904 27 28.7394 27 28.8582V29H35V28.8582C35 28.7394 34.8939 28.2904 33.835 27.7449C32.8611 27.2431 31.6743 27 31 27C30.3257 27 29.1389 27.2431 28.165 27.7449ZM31 25C28.9975 25 25 26.2925 25 28.8582V31H37V28.8582C37 26.2925 33.0025 25 31 25Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.165 27.7449C13.1061 28.2904 13 28.7394 13 28.8582V29H21V28.8582C21 28.7394 20.8939 28.2904 19.835 27.7449C18.8611 27.2431 17.6743 27 17 27C16.3257 27 15.1389 27.2431 14.165 27.7449ZM17 25C14.9975 25 11 26.2925 11 28.8582V31H23V28.8582C23 26.2925 19.0025 25 17 25Z" 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.4918C24.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,
);