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 fill-rule="evenodd" clip-rule="evenodd" d="M14.2072 19.4031C13.5502 20.0594 13 21.0189 13 22.2919C13 24.1644 13.6116 25.4166 14.2643 26.1891C14.4007 26.3505 14.5392 26.4915 14.6751 26.6132V20.7505H16.6751V40.3654C16.6751 40.7122 16.9629 41 17.3097 41C17.6564 41 17.9442 40.7122 17.9442 40.3654V31.1926H23.2134V40.3654C23.2134 40.7122 23.5012 41 23.848 41C24.1947 41 24.4825 40.7122 24.4825 40.3654V19.7505H33.6554C34.0021 19.7505 34.29 19.4627 34.29 19.116C34.29 18.7692 34.0021 18.4814 33.6554 18.4814H15.6751C15.6751 18.4814 15.6752 18.4817 15.6705 18.4826C15.6398 18.4887 15.4726 18.5217 15.1862 18.6719C14.8876 18.8286 14.5382 19.0724 14.2072 19.4031ZM14.6751 28.9803C14.5178 28.9122 14.3637 28.8327 14.2165 28.7466C13.7299 28.4619 13.2116 28.0421 12.7365 27.4798C11.7764 26.3433 11 24.633 11 22.2919C11 20.3889 11.8378 18.9431 12.7936 17.9882C13.269 17.5133 13.7821 17.15 14.257 16.9009C14.7007 16.6681 15.2132 16.4814 15.6751 16.4814H33.6554C35.1067 16.4814 36.29 17.6647 36.29 19.116C36.29 20.5673 35.1067 21.7505 33.6554 21.7505H26.4825V40.3654C26.4825 41.8167 25.2993 43 23.848 43C22.3967 43 21.2134 41.8167 21.2134 40.3654V33.1926H19.9442V40.3654C19.9442 41.8167 18.761 43 17.3097 43C15.8584 43 14.6751 41.8167 14.6751 40.3654V28.9803Z" fill="black"/>
<path d="M34 11V41H32V11C32.9104 11 32.9104 11.0003 34 11Z" fill="black"/>
<path d="M26 15C26 13.3431 29.134 12 33 12C36.866 12 40 13.3431 40 15C35 13.5 31.5 13.5 26 15Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M26 11H24.5448C24.7403 11.4885 24.848 12.021 24.848 12.5777C24.848 14.9281 22.9292 16.8469 20.5788 16.8469C18.2285 16.8469 16.3097 14.9281 16.3097 12.5777C16.3097 12.021 16.4173 11.4885 16.6129 11H15C15 8.23858 17.4624 6 20.5 6C23.5376 6 26 8.23858 26 11ZM22.2042 11H18.9535C18.5558 11.4095 18.3097 11.9669 18.3097 12.5777C18.3097 13.8235 19.3331 14.8469 20.5788 14.8469C21.8246 14.8469 22.848 13.8235 22.848 12.5777C22.848 11.9669 22.6019 11.4095 22.2042 11ZM20.5 10C21.3284 10 22 9.32843 22 8.5C22 7.67157 21.3284 7 20.5 7C19.6716 7 19 7.67157 19 8.5C19 9.32843 19.6716 10 20.5 10Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );