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="M28 24C28 26.2091 26.2091 28 24 28C21.7909 28 20 26.2091 20 24C20 21.7909 21.7909 20 24 20C26.2091 20 28 21.7909 28 24Z" fill="black"/>
<path d="M42 19C42 20.6569 40.6569 22 39 22C37.3431 22 36 20.6569 36 19C36 17.3431 37.3431 16 39 16C40.6569 16 42 17.3431 42 19Z" fill="black"/>
<path d="M12 19C12 20.6569 10.6569 22 9 22C7.34315 22 6 20.6569 6 19C6 17.3431 7.34315 16 9 16C10.6569 16 12 17.3431 12 19Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.9363 22.3511C17.7424 22.8682 17.166 23.1302 16.6489 22.9363L8.64888 19.9363C8.13176 19.7424 7.86975 19.166 8.06367 18.6489C8.25759 18.1318 8.834 17.8698 9.35112 18.0637L17.3511 21.0637C17.8682 21.2576 18.1302 21.834 17.9363 22.3511Z" fill="black"/>
<path d="M24 10.9021C22.3431 10.9021 21 9.55895 21 7.9021C21 6.24525 22.3431 4.9021 24 4.9021C25.6569 4.9021 27 6.24525 27 7.9021C27 9.55895 25.6569 10.9021 24 10.9021Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M23.902 17.5C23.3497 17.5 22.902 17.0523 22.902 16.5L22.9021 7.90224C22.9021 7.34996 23.3498 6.90225 23.9021 6.90225C24.4544 6.90226 24.9021 7.34997 24.9021 7.90226L24.902 16.5C24.902 17.0523 24.4543 17.5 23.902 17.5Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M39.9285 18.6286C40.1336 19.1414 39.8842 19.7234 39.3714 19.9285L31.8714 22.9285C31.3586 23.1336 30.7766 22.8842 30.5715 22.3714C30.3664 21.8586 30.6158 21.2766 31.1286 21.0715L38.6286 18.0715C39.1414 17.8664 39.7234 18.1158 39.9285 18.6286Z" fill="black"/>
<path d="M17 38C17 39.6569 15.6569 41 14 41C12.3431 41 11 39.6569 11 38C11 36.3431 12.3431 35 14 35C15.6569 35 17 36.3431 17 38Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.1178 29.7137C20.5521 30.0549 20.6275 30.6836 20.2863 31.1178L14.7863 38.1178C14.4451 38.5521 13.8165 38.6275 13.3822 38.2863C12.9479 37.9451 12.8725 37.3165 13.2137 36.8822L18.7137 29.8822C19.0549 29.4479 19.6835 29.3725 20.1178 29.7137Z" fill="black"/>
<path d="M31.5 38C31.5 39.6569 32.8431 41 34.5 41C36.1569 41 37.5 39.6569 37.5 38C37.5 36.3431 36.1569 35 34.5 35C32.8431 35 31.5 36.3431 31.5 38Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M28.3822 29.7137C27.9479 30.0549 27.8725 30.6836 28.2137 31.1178L33.7137 38.1178C34.0549 38.5521 34.6836 38.6275 35.1178 38.2863C35.5521 37.9451 35.6275 37.3165 35.2863 36.8822L29.7863 29.8822C29.4451 29.4479 28.8165 29.3725 28.3822 29.7137Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);