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="M27 41V27.8397C26.3181 27.8371 25.6499 27.7767 25 27.6631V40H21V26.1751C20.28 25.7446 19.6098 25.2394 19 24.6704V41C19 41.5523 19.4477 42 20 42H26C26.5523 42 27 41.5523 27 41Z" fill="black"/>
<path d="M27 22.0215C26.2979 22.0164 25.6246 21.8902 25 21.6627V20H22.5638C22.0532 19.4219 21.6527 18.7443 21.3951 18H26C26.5523 18 27 18.4477 27 19V22.0215Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M27 25.9999C26.3112 25.997 25.6427 25.926 25 25.7934V25.7793C20.4886 24.8363 17.1001 20.8363 17.1001 16.0449C17.1001 10.5525 21.5526 6.1001 27.045 6.1001C32.5374 6.1001 36.9899 10.5525 36.9899 16.0449C36.9899 18.1817 36.3161 20.1609 35.1693 21.7818L35.1206 21.8507L40.8587 27.5886L39.361 29.0863L33.7053 23.4307L33.6349 23.4931C31.8802 25.0467 29.5729 25.9897 27.045 25.9897C27.03 25.9897 27.015 25.9897 27 25.9896V25.9999ZM34.8719 16.0449C34.8719 20.3675 31.3676 23.8717 27.045 23.8717C22.7224 23.8717 19.2182 20.3675 19.2182 16.0449C19.2182 11.7223 22.7224 8.21813 27.045 8.21813C31.3676 8.21813 34.8719 11.7223 34.8719 16.0449Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 6C7.44772 6 7 6.44772 7 7V41C7 41.5523 7.44772 42 8 42H14C14.5523 42 15 41.5523 15 41V7C15 6.44772 14.5523 6 14 6H8ZM9 40V8H13V40H9Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M31 32C31 31.4477 31.4477 31 32 31H38C38.5523 31 39 31.4477 39 32V41C39 41.5523 38.5523 42 38 42H32C31.4477 42 31 41.5523 31 41V32ZM33 33V40H37V33H33Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);