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
contextusing 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="M25 6H23V10.1707C21.9624 10.5375 21.1868 11.4589 21.0294 12.5787L13.7409 14.5342C13.5152 14.5947 13.3178 14.7324 13.1831 14.9233L7.32815 23.2178H6.11987C6.11987 23.9084 6.20191 24.5785 6.35616 25.2178C6.38694 25.3454 6.4206 25.4717 6.45706 25.5967C7.40664 28.8533 10.2544 31.2178 13.6199 31.2178C17.1146 31.2178 20.0512 28.6676 20.8838 25.2171C21.0377 24.579 21.1196 23.91 21.1199 23.2207L21.1199 23.2178H20.185L15.5858 16.1099L21.4266 14.5429C21.7829 15.1357 22.3381 15.5953 23 15.8293V38H20V40H14V42H34V40H28V38H25V15.8293C26.1511 15.4224 26.9797 14.3331 26.9997 13.0474L32.1392 11.6687L28.474 17L27 17C27 17.6904 27.082 18.3603 27.2361 18.9993C28.0687 22.4498 31.0053 25 34.5 25C37.8655 25 40.7133 22.6355 41.6628 19.379C41.6993 19.2539 41.733 19.1276 41.7637 19C41.9026 18.4247 41.9829 17.8243 41.9976 17.2065C41.9992 17.1388 42 17.071 42 17.0029V17H40.0543L35.36 9.48913C35.1467 9.12964 34.7227 8.93295 34.2987 9.02044C34.2794 9.02443 34.2602 9.02898 34.2409 9.03416L26.3606 11.1484C26.0124 10.705 25.5419 10.3622 25 10.1707V6ZM30.9011 17H37.6958L34.4602 11.8231L30.9011 17ZM17.8028 23.2178L13.964 17.2851L9.77623 23.2178H17.8028Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);