build method

  1. @override
Widget build(
  1. BuildContext context
)
override

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:

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="M24 20.0225H22V28.0225H24V20.0225Z" fill="black"/>
<path d="M27.5352 20.023L30 23.7202V20.023H32L32 28.023H30.4648L28 24.3258V28.023H26V20.023H27.5352Z" fill="black"/>
<path d="M38.4556 22.2225L39.3203 22.7247L40.3247 20.9951L39.4599 20.4929C39.0664 20.2644 38.6358 20.1009 38.1847 20.0111C37.3791 19.8509 36.5441 19.9331 35.7853 20.2474C35.0265 20.5617 34.378 21.094 33.9217 21.7769C33.4654 22.4598 33.2218 23.2627 33.2218 24.084C33.2218 24.9053 33.4654 25.7082 33.9217 26.3911C34.378 27.074 35.0265 27.6063 35.7853 27.9206C36.5441 28.2349 37.3791 28.3171 38.1847 28.1569C38.6358 28.0672 39.0664 27.9036 39.4599 27.6751L40.3247 27.1729L39.3203 25.4434L38.4556 25.9456C38.2515 26.064 38.0283 26.1488 37.7945 26.1953C37.3769 26.2784 36.9441 26.2358 36.5507 26.0728C36.1574 25.9099 35.8212 25.634 35.5846 25.28C35.3481 24.926 35.2218 24.5098 35.2218 24.084C35.2218 23.6583 35.3481 23.2421 35.5846 22.888C35.8212 22.534 36.1574 22.2581 36.5507 22.0952C36.9441 21.9323 37.3769 21.8896 37.7945 21.9727C38.0283 22.0192 38.2515 22.104 38.4556 22.2225Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M13 24.0225C13 21.8134 14.7909 20.0225 17 20.0225C19.2091 20.0225 21 21.8134 21 24.0225C21 26.2316 19.2091 28.0225 17 28.0225C14.7909 28.0225 13 26.2316 13 24.0225ZM17 22.0225C15.8954 22.0225 15 22.9179 15 24.0225C15 25.1271 15.8954 26.0225 17 26.0225C18.1046 26.0225 19 25.1271 19 24.0225C19 22.9179 18.1046 22.0225 17 22.0225Z" fill="black"/>
<path d="M10 20.0225H8V28.0225H12.5V26.0225H10V20.0225Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 13C4 11.3431 5.34315 10 7 10H41C42.6569 10 44 11.3431 44 13V35C44 36.6569 42.6569 38 41 38H7C5.34315 38 4 36.6569 4 35V13ZM7 12H41C41.5523 12 42 12.4477 42 13V35C42 35.5523 41.5523 36 41 36H7C6.44772 36 6 35.5523 6 35V13C6 12.4477 6.44772 12 7 12Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );