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="M26 25.5C26 27.433 24.433 29 22.5 29C20.567 29 19 27.433 19 25.5C19 23.567 20.567 22 22.5 22C24.433 22 26 23.567 26 25.5Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M33 24C33 28.9706 28.9706 33 24 33C19.0294 33 15 28.9706 15 24C15 19.0294 19.0294 15 24 15C28.9706 15 33 19.0294 33 24ZM31 24C31 27.866 27.866 31 24 31C20.134 31 17 27.866 17 24C17 20.134 20.134 17 24 17C27.866 17 31 20.134 31 24Z" fill="black"/>
<path d="M14.5 11C16.433 11 18 12.567 18 14.5C18 16.433 16.433 18 14.5 18C12.567 18 11 16.433 11 14.5C11 12.567 12.567 11 14.5 11Z" fill="black"/>
<path d="M39 31.5C39 33.433 37.433 35 35.5 35C33.567 35 32 33.433 32 31.5C32 29.567 33.567 28 35.5 28C37.433 28 39 29.567 39 31.5Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M31 15C32.6569 15 34 13.6569 34 12C34 10.3431 32.6569 9 31 9C29.3431 9 28 10.3431 28 12C28 13.6569 29.3431 15 31 15ZM31 13C31.5523 13 32 12.5523 32 12C32 11.4477 31.5523 11 31 11C30.4477 11 30 11.4477 30 12C30 12.5523 30.4477 13 31 13Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M16 32C16 33.6569 14.6569 35 13 35C11.3431 35 10 33.6569 10 32C10 30.3431 11.3431 29 13 29C14.6569 29 16 30.3431 16 32ZM14 32C14 32.5523 13.5523 33 13 33C12.4477 33 12 32.5523 12 32C12 31.4477 12.4477 31 13 31C13.5523 31 14 31.4477 14 32Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M44 24C44 35.0457 35.0457 44 24 44C12.9543 44 4 35.0457 4 24C4 12.9543 12.9543 4 24 4C35.0457 4 44 12.9543 44 24ZM42 24C42 33.9411 33.9411 42 24 42C14.0589 42 6 33.9411 6 24C6 14.0589 14.0589 6 24 6C33.9411 6 42 14.0589 42 24Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);