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="M6 9C6 7.34315 7.34315 6 9 6H15V8H9C8.44772 8 8 8.44772 8 9V15H6V9Z" fill="black"/>
<path d="M13 15C13 14.4477 13.4477 14 14 14H18C18.5523 14 19 14.4477 19 15V19C19 19.5523 18.5523 20 18 20H14C13.4477 20 13 19.5523 13 19V15Z" fill="black"/>
<path d="M14 28C13.4477 28 13 28.4477 13 29V33C13 33.5523 13.4477 34 14 34H18C18.5523 34 19 33.5523 19 33V29C19 28.4477 18.5523 28 18 28H14Z" fill="black"/>
<path d="M14 26C13.4477 26 13 25.5523 13 25C13 24.4477 13.4477 24 14 24C14.5523 24 15 24.4477 15 25C15 25.5523 14.5523 26 14 26Z" fill="black"/>
<path d="M15 23C15 23.5523 14.5523 24 14 24C13.4477 24 13 23.5523 13 23C13 22.4477 13.4477 22 14 22C14.5523 22 15 22.4477 15 23Z" fill="black"/>
<path d="M15 23C15 22.4477 15.4477 22 16 22C16.5523 22 17 22.4477 17 23C17 23.5523 16.5523 24 16 24C15.4477 24 15 23.5523 15 23Z" fill="black"/>
<path d="M18 26C17.4477 26 17 25.5523 17 25C17 24.4477 17.4477 24 18 24C18.5523 24 19 24.4477 19 25C19 25.5523 18.5523 26 18 26Z" fill="black"/>
<path d="M20 24C20.5523 24 21 24.4477 21 25C21 25.5523 20.5523 26 20 26C19.4477 26 19 25.5523 19 25C19 24.4477 19.4477 24 20 24Z" fill="black"/>
<path d="M20 24C19.4477 24 19 23.5523 19 23C19 22.4477 19.4477 22 20 22C20.5523 22 21 22.4477 21 23C21 23.5523 20.5523 24 20 24Z" fill="black"/>
<path d="M24 26C23.4477 26 23 25.5523 23 25C23 24.4477 23.4477 24 24 24C24.5523 24 25 24.4477 25 25C25 25.5523 24.5523 26 24 26Z" fill="black"/>
<path d="M25 27C25 26.4477 24.5523 26 24 26C23.4477 26 23 26.4477 23 27C23 26.4477 22.5523 26 22 26C21.4477 26 21 26.4477 21 27C21 27.5523 21.4477 28 22 28C21.4477 28 21 28.4477 21 29C21 29.5523 21.4477 30 22 30C22.5523 30 23 29.5523 23 29C23 28.4477 22.5523 28 22 28C22.5523 28 23 27.5523 23 27C23 27.5523 23.4477 28 24 28C24.5523 28 25 27.5523 25 27Z" fill="black"/>
<path d="M25 27C25 26.4477 25.4477 26 26 26C26.5523 26 27 26.4477 27 27C27 27.5523 26.5523 28 26 28C25.4477 28 25 27.5523 25 27Z" fill="black"/>
<path d="M25 23C25 23.5523 24.5523 24 24 24C23.4477 24 23 23.5523 23 23C23 22.4477 23.4477 22 24 22C24.5523 22 25 22.4477 25 23Z" fill="black"/>
<path d="M25 23C25 22.4477 25.4477 22 26 22C26.5523 22 27 22.4477 27 23C27 23.5523 26.5523 24 26 24C25.4477 24 25 23.5523 25 23Z" fill="black"/>
<path d="M24 20C24.5523 20 25 20.4477 25 21C25 21.5523 24.5523 22 24 22C23.4477 22 23 21.5523 23 21C23 20.4477 23.4477 20 24 20Z" fill="black"/>
<path d="M24 18C24.5523 18 25 17.5523 25 17C25 16.4477 24.5523 16 24 16C23.4477 16 23 16.4477 23 17C23 16.4477 22.5523 16 22 16C22.5523 16 23 15.5523 23 15C23 14.4477 22.5523 14 22 14C21.4477 14 21 14.4477 21 15C21 15.5523 21.4477 16 22 16C21.4477 16 21 16.4477 21 17C21 17.5523 21.4477 18 22 18C22.5523 18 23 17.5523 23 17C23 17.5523 23.4477 18 24 18Z" fill="black"/>
<path d="M24 18C24.5523 18 25 18.4477 25 19C25 19.5523 24.5523 20 24 20C23.4477 20 23 19.5523 23 19C23 18.4477 23.4477 18 24 18Z" fill="black"/>
<path d="M23 21C23 21.5523 22.5523 22 22 22C21.4477 22 21 21.5523 21 21C21 20.4477 21.4477 20 22 20C22.5523 20 23 20.4477 23 21Z" fill="black"/>
<path d="M24 32C23.4477 32 23 31.5523 23 31C23 30.4477 23.4477 30 24 30C24.5523 30 25 30.4477 25 31C25 31.5523 24.5523 32 24 32Z" fill="black"/>
<path d="M23 33C23 32.4477 23.4477 32 24 32C24.5523 32 25 32.4477 25 33C25 33.5523 24.5523 34 24 34C23.4477 34 23 33.5523 23 33Z" fill="black"/>
<path d="M23 33C23 33.5523 22.5523 34 22 34C21.4477 34 21 33.5523 21 33C21 32.4477 21.4477 32 22 32C22.5523 32 23 32.4477 23 33Z" fill="black"/>
<path d="M25 31C25 30.4477 25.4477 30 26 30C26.5523 30 27 30.4477 27 31C27 31.5523 26.5523 32 26 32C25.4477 32 25 31.5523 25 31Z" fill="black"/>
<path d="M27 25C27 25.5523 27.4477 26 28 26C28.5523 26 29 25.5523 29 25C29 24.4477 28.5523 24 28 24C27.4477 24 27 24.4477 27 25Z" fill="black"/>
<path d="M30 24C29.4477 24 29 23.5523 29 23C29 22.4477 29.4477 22 30 22C30.5523 22 31 22.4477 31 23C31 23.5523 30.5523 24 30 24Z" fill="black"/>
<path d="M32 24C31.4477 24 31 23.5523 31 23C31 22.4477 31.4477 22 32 22C32.5523 22 33 22.4477 33 23C33 23.5523 32.5523 24 32 24Z" fill="black"/>
<path d="M32 24C32.5523 24 33 24.4477 33 25C33 25.5523 32.5523 26 32 26C31.4477 26 31 25.5523 31 25C31 24.4477 31.4477 24 32 24Z" fill="black"/>
<path d="M30 34C29.4477 34 29 33.5523 29 33C29 32.4477 29.4477 32 30 32C30.5523 32 31 32.4477 31 33C31 33.5523 30.5523 34 30 34Z" fill="black"/>
<path d="M31 33C31 32.4477 31.4477 32 32 32C32.5523 32 33 32.4477 33 33C33 33.5523 32.5523 34 32 34C31.4477 34 31 33.5523 31 33Z" fill="black"/>
<path d="M28 30C27.4477 30 27 29.5523 27 29C27 28.4477 27.4477 28 28 28C28.5523 28 29 28.4477 29 29C29 29.5523 28.5523 30 28 30Z" fill="black"/>
<path d="M30 30C29.4477 30 29 29.5523 29 29C29 28.4477 29.4477 28 30 28C30.5523 28 31 28.4477 31 29C31 29.5523 30.5523 30 30 30Z" fill="black"/>
<path d="M31 29C31 28.4477 31.4477 28 32 28C32.5523 28 33 28.4477 33 29C33 29.5523 32.5523 30 32 30C31.4477 30 31 29.5523 31 29Z" fill="black"/>
<path d="M27 15C27 14.4477 27.4477 14 28 14H32C32.5523 14 33 14.4477 33 15V19C33 19.5523 32.5523 20 32 20H28C27.4477 20 27 19.5523 27 19V15Z" fill="black"/>
<path d="M6 39C6 40.6569 7.34315 42 9 42H15V40H9C8.44772 40 8 39.5523 8 39L8 33H6V39Z" fill="black"/>
<path d="M42 9C42 7.34315 40.6569 6 39 6H33V8H39C39.5523 8 40 8.44772 40 9V15H42V9Z" fill="black"/>
<path d="M42 39C42 40.6569 40.6569 42 39 42H33V40H39C39.5523 40 40 39.5523 40 39V33H42V39Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);