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="M11.7644 6C7.44309 6 7.12463 6.01323 6.80962 6.03921C6.35203 6.07695 5.99988 6.45925 5.99988 6.91826V41.118C5.99988 41.6051 6.39489 42 6.88216 42H13.529C14.0163 42 14.4113 41.6051 14.4113 41.118V34.6807L18.0258 36.2293C18.4879 36.4273 19.0497 36.6359 19.6363 36.7132C20.2338 36.7918 20.9118 36.7407 21.5424 36.3557C22.555 35.7374 23.2341 34.6199 23.2341 33.343V30.6969C23.2341 30.2098 22.8391 29.8149 22.3518 29.8149L19.6363 28.9328C19.6363 27.9586 20.495 28.0508 21.4695 28.0508H22.3518C22.8391 28.0508 23.2341 27.6559 23.2341 27.1688V25.4047H24.2323C25.6417 25.4047 26.4823 23.8344 25.7006 22.6621L23.2341 18.9634V17.4664C23.2341 11.1337 18.0989 6 11.7644 6ZM20.5872 19.6715C20.5872 20.4022 19.9947 20.9946 19.2638 20.9946C18.5329 20.9946 17.9404 20.4022 17.9404 19.6715C17.9404 18.9408 18.5329 18.3485 19.2638 18.3485C19.9947 18.3485 20.5872 18.9408 20.5872 19.6715Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M28.4954 32.0835C29.205 31.6688 29.6841 30.8925 29.6841 29.9995C29.6841 29.1066 29.205 28.3303 28.4954 27.9156L29.5044 26.1888C30.8084 26.9508 31.6841 28.3736 31.6841 29.9995C31.6841 31.6254 30.8084 33.0483 29.5044 33.8103L28.4954 32.0835Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M31.7821 34.6633C32.9951 33.7858 33.8946 32.0671 33.8946 29.9999C33.8946 27.9327 32.9951 26.214 31.7821 25.3365L32.9544 23.7161C34.762 25.0238 35.8946 27.3893 35.8946 29.9999C35.8946 32.6106 34.762 34.9761 32.9544 36.2837L31.7821 34.6633Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M38.105 29.9999C38.105 26.8185 36.8409 24.152 35.1153 22.7835L36.358 21.2165C38.6596 23.0417 40.105 26.3444 40.105 29.9999C40.105 33.6554 38.6596 36.9581 36.358 38.7834L35.1153 37.2163C36.8409 35.8478 38.105 33.1813 38.105 29.9999Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);