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 fill-rule="evenodd" clip-rule="evenodd" d="M14 14C13.4477 14 13 14.4477 13 15V19C13 19.5523 13.4477 20 14 20H18C18.5523 20 19 19.5523 19 19V15C19 14.4477 18.5523 14 18 14H14ZM15 16V18H17V16H15Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" 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 28H14ZM15 30V32H17V30H15Z" fill="black"/>
<path d="M13 25C13 25.5523 13.4477 26 14 26C14.5523 26 15 25.5523 15 25C15 24.4477 14.5523 24 14 24C14.5523 24 15 23.5523 15 23C15 23.5523 15.4477 24 16 24C16.5523 24 17 23.5523 17 23C17 22.4477 16.5523 22 16 22C15.4477 22 15 22.4477 15 23C15 22.4477 14.5523 22 14 22C13.4477 22 13 22.4477 13 23C13 23.5523 13.4477 24 14 24C13.4477 24 13 24.4477 13 25Z" fill="black"/>
<path d="M17 25C17 25.5523 17.4477 26 18 26C18.5523 26 19 25.5523 19 25C19 25.5523 19.4477 26 20 26C20.5523 26 21 25.5523 21 25C21 24.4477 20.5523 24 20 24C20.5523 24 21 23.5523 21 23C21 22.4477 20.5523 22 20 22C19.4477 22 19 22.4477 19 23C19 23.5523 19.4477 24 20 24C19.4477 24 19 24.4477 19 25C19 24.4477 18.5523 24 18 24C17.4477 24 17 24.4477 17 25Z" fill="black"/>
<path d="M23 25C23 25.5523 23.4477 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 27C25 27.5523 25.4477 28 26 28C26.5523 28 27 27.5523 27 27C27 26.4477 26.5523 26 26 26C25.4477 26 25 26.4477 25 27C25 26.4477 24.5523 26 24 26C24.5523 26 25 25.5523 25 25C25 24.4477 24.5523 24 24 24C24.5523 24 25 23.5523 25 23C25 23.5523 25.4477 24 26 24C26.5523 24 27 23.5523 27 23C27 22.4477 26.5523 22 26 22C25.4477 22 25 22.4477 25 23C25 22.4477 24.5523 22 24 22C24.5523 22 25 21.5523 25 21C25 20.4477 24.5523 20 24 20C24.5523 20 25 19.5523 25 19C25 18.4477 24.5523 18 24 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 18C23.4477 18 23 18.4477 23 19C23 19.5523 23.4477 20 24 20C23.4477 20 23 20.4477 23 21C23 20.4477 22.5523 20 22 20C21.4477 20 21 20.4477 21 21C21 21.5523 21.4477 22 22 22C22.5523 22 23 21.5523 23 21C23 21.5523 23.4477 22 24 22C23.4477 22 23 22.4477 23 23C23 23.5523 23.4477 24 24 24C23.4477 24 23 24.4477 23 25Z" fill="black"/>
<path d="M23 31C23 31.5523 23.4477 32 24 32C23.4477 32 23 32.4477 23 33C23 32.4477 22.5523 32 22 32C21.4477 32 21 32.4477 21 33C21 33.5523 21.4477 34 22 34C22.5523 34 23 33.5523 23 33C23 33.5523 23.4477 34 24 34C24.5523 34 25 33.5523 25 33C25 32.4477 24.5523 32 24 32C24.5523 32 25 31.5523 25 31C25 31.5523 25.4477 32 26 32C26.5523 32 27 31.5523 27 31C27 30.4477 26.5523 30 26 30C25.4477 30 25 30.4477 25 31C25 30.4477 24.5523 30 24 30C23.4477 30 23 30.4477 23 31Z" fill="black"/>
<path d="M28 26C27.4477 26 27 25.5523 27 25C27 24.4477 27.4477 24 28 24C28.5523 24 29 24.4477 29 25C29 25.5523 28.5523 26 28 26Z" fill="black"/>
<path d="M29 23C29 23.5523 29.4477 24 30 24C30.5523 24 31 23.5523 31 23C31 23.5523 31.4477 24 32 24C31.4477 24 31 24.4477 31 25C31 25.5523 31.4477 26 32 26C32.5523 26 33 25.5523 33 25C33 24.4477 32.5523 24 32 24C32.5523 24 33 23.5523 33 23C33 22.4477 32.5523 22 32 22C31.4477 22 31 22.4477 31 23C31 22.4477 30.5523 22 30 22C29.4477 22 29 22.4477 29 23Z" fill="black"/>
<path d="M29 33C29 33.5523 29.4477 34 30 34C30.5523 34 31 33.5523 31 33C31 33.5523 31.4477 34 32 34C32.5523 34 33 33.5523 33 33C33 32.4477 32.5523 32 32 32C31.4477 32 31 32.4477 31 33C31 32.4477 30.5523 32 30 32C29.4477 32 29 32.4477 29 33Z" fill="black"/>
<path d="M27 29C27 29.5523 27.4477 30 28 30C28.5523 30 29 29.5523 29 29C29 29.5523 29.4477 30 30 30C30.5523 30 31 29.5523 31 29C31 29.5523 31.4477 30 32 30C32.5523 30 33 29.5523 33 29C33 28.4477 32.5523 28 32 28C31.4477 28 31 28.4477 31 29C31 28.4477 30.5523 28 30 28C29.4477 28 29 28.4477 29 29C29 28.4477 28.5523 28 28 28C27.4477 28 27 28.4477 27 29Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" 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 19V15ZM29 18V16H31V18H29Z" 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,
);