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="M5.94168 8.76905L7.54777 3.75L9.45262 4.35955L7.84652 9.3786C6.31083 14.1776 5.79967 19.2456 6.34611 24.2546L8.4943 43.9463L6.50609 44.1632L4.35791 24.4715C3.78111 19.1842 4.32067 13.8347 5.94168 8.76905Z" fill="black"/>
<path d="M42.0583 8.76905L40.4522 3.75L38.5474 4.35955L40.1535 9.3786C41.6892 14.1776 42.2003 19.2456 41.6539 24.2546L39.5057 43.9463L41.4939 44.1632L43.6421 24.4715C44.2189 19.1842 43.6793 13.8347 42.0583 8.76905Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M21.5004 18.3048C21.5004 17.7525 21.9481 17.3048 22.5004 17.3048H25.5004C26.0526 17.3048 26.5004 17.7525 26.5004 18.3048C26.5004 18.8571 26.0526 19.3048 25.5004 19.3048H25.0004V20.4308C25.6402 20.5955 26.2181 20.9146 26.692 21.3459L28.0466 20.5638L27.7966 20.1308C27.5205 19.6525 27.6844 19.0409 28.1626 18.7648C28.6409 18.4886 29.2525 18.6525 29.5287 19.1308L31.0287 21.7289C31.3048 22.2072 31.1409 22.8188 30.6626 23.0949C30.1844 23.371 29.5728 23.2072 29.2966 22.7289L29.0466 22.2959L27.79 23.0214C27.9264 23.4242 28.0004 23.8559 28.0004 24.3048C28.0004 24.5974 27.9689 24.8826 27.9093 25.1573L29.0466 25.8139L29.2966 25.3809C29.5728 24.9026 30.1844 24.7388 30.6626 25.0149C31.1409 25.291 31.3048 25.9026 31.0287 26.3809L29.5287 28.979C29.2525 29.4573 28.6409 29.6212 28.1626 29.345C27.6844 29.0689 27.5205 28.4573 27.7966 27.979L28.0466 27.546L27.0054 26.9449C26.4838 27.5382 25.7891 27.9758 25.0004 28.1788V29.3048H25.5004C26.0526 29.3048 26.5004 29.7525 26.5004 30.3048C26.5004 30.8571 26.0526 31.3048 25.5004 31.3048H22.5004C21.9481 31.3048 21.5004 30.8571 21.5004 30.3048C21.5004 29.7525 21.9481 29.3048 22.5004 29.3048H23.0004V28.1788C22.2114 27.9757 21.5167 27.5381 20.995 26.9446L19.9536 27.5458L20.2036 27.9788C20.4797 28.4571 20.3159 29.0687 19.8376 29.3448C19.3593 29.621 18.7477 29.4571 18.4715 28.9788L16.9715 26.3807C16.6954 25.9025 16.8593 25.2909 17.3376 25.0147C17.8159 24.7386 18.4275 24.9025 18.7036 25.3807L18.9536 25.8138L20.0913 25.1569C20.0317 24.8823 20.0004 24.5972 20.0004 24.3048C20.0004 23.8559 20.0743 23.4243 20.2107 23.0215L18.9536 22.2957L18.7036 22.7287C18.4275 23.207 17.8159 23.3709 17.3376 23.0947C16.8593 22.8186 16.6954 22.207 16.9715 21.7287L18.4715 19.1306C18.7477 18.6523 19.3593 18.4885 19.8376 18.7646C20.3159 19.0407 20.4797 19.6523 20.2036 20.1306L19.9536 20.5636L21.3086 21.346C21.7825 20.9146 22.3604 20.5955 23.0004 20.4308V19.3048H22.5004C21.9481 19.3048 21.5004 18.8571 21.5004 18.3048ZM22.0004 24.3048C22.0004 23.2002 22.8958 22.3048 24.0004 22.3048C25.1049 22.3048 26.0004 23.2002 26.0004 24.3048C26.0004 25.4094 25.1049 26.3048 24.0004 26.3048C22.8958 26.3048 22.0004 25.4094 22.0004 24.3048Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.5 35.5364C15.5799 34.0385 12 29.4647 12 24.0548C12 17.4274 17.3726 12.0548 24 12.0548C30.6274 12.0548 36 17.4274 36 24.0548C36 29.4647 32.4201 34.0385 27.5 35.5364V44.0548H25.5V35.962C25.0086 36.0232 24.508 36.0548 24 36.0548C23.492 36.0548 22.9914 36.0232 22.5 35.962V44.0548H20.5V35.5364ZM14 24.0548C14 18.532 18.4772 14.0548 24 14.0548C29.5228 14.0548 34 18.532 34 24.0548C34 29.5777 29.5228 34.0548 24 34.0548C18.4772 34.0548 14 29.5777 14 24.0548Z" fill="black"/>
<path d="M25.1499 6.05481C25.1499 5.50252 24.7022 5.05481 24.1499 5.05481C23.5976 5.05481 23.1499 5.50252 23.1499 6.05481V7.05481C23.1499 7.60709 23.5976 8.05481 24.1499 8.05481C24.7022 8.05481 25.1499 7.60709 25.1499 7.05481V6.05481Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );