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="M35.5 3.58569L39.7071 7.7928C40.0976 8.18332 40.0976 8.81649 39.7071 9.20701C39.3166 9.59754 38.6834 9.59754 38.2929 9.20701L36.5 7.41412V44H34.5V7.41412L32.7071 9.20701C32.3166 9.59754 31.6834 9.59754 31.2929 9.20701C30.9024 8.81649 30.9024 8.18332 31.2929 7.7928L35.5 3.58569Z" fill="black"/>
<path d="M27.9999 8C27.9999 10.2091 26.2091 12 23.9999 12C21.7908 12 19.9999 10.2091 19.9999 8C19.9999 5.79086 21.7908 4 23.9999 4C26.2091 4 27.9999 5.79086 27.9999 8Z" fill="black"/>
<path d="M29.9999 28.8007C30.6279 28.4964 31.0751 27.8728 31.1244 27.133L31.8293 16.5597C31.9159 15.2602 30.7574 14.2218 29.4702 14.4196C27.6892 14.6933 25.3845 15 23.9999 15C22.6154 15 20.3107 14.6933 18.5297 14.4196C17.2425 14.2218 16.084 15.2602 16.1706 16.5597L16.8755 27.133C16.9248 27.8728 17.372 28.4964 17.9999 28.8007V42C17.9999 43.0747 18.8493 43.9573 19.9232 43.9985C20.9971 44.0398 21.9116 43.2249 21.994 42.1534L22.994 29.1534C22.998 29.1022 22.9999 29.051 22.9999 29H24.9999C24.9999 29.051 25.0019 29.1022 25.0058 29.1534L26.0058 42.1534C26.0883 43.2249 27.0028 44.0398 28.0767 43.9985C29.1506 43.9573 29.9999 43.0747 29.9999 42V28.8007Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);