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="M13 5C13 4.44772 13.4477 4 14 4C14.5523 4 15 4.44772 15 5V10.6525C15 11.839 14.7355 13.0105 14.2257 14.0818L13.4832 15.6424C12.5067 17.6947 12 19.939 12 22.2119V22.2857C12 25.2018 12.6501 28.0812 13.903 30.7144C14.6252 32.2324 15 33.8922 15 35.5732V43C15 43.5523 14.5523 44 14 44C13.4477 44 13 43.5523 13 43V35.5732C13 34.1895 12.6915 32.8232 12.097 31.5737C10.7164 28.6721 10 25.4991 10 22.2857V22.2119C10 19.6417 10.573 17.1039 11.6772 14.7831L12.4198 13.2225C12.8018 12.4196 13 11.5417 13 10.6525V5Z" fill="black"/>
<path d="M35 5C35 4.44772 34.5523 4 34 4C33.4477 4 33 4.44772 33 5V10.6525C33 11.839 33.2645 13.0105 33.7743 14.0818L34.5168 15.6424C35.4933 17.6947 36 19.939 36 22.2119V22.2857C36 25.2018 35.3499 28.0812 34.097 30.7144C33.4199 32.1375 33.0482 33.6853 33.0044 35.2583C33.0015 35.3632 33 35.4682 33 35.5732V43C33 43.5523 33.4477 44 34 44C34.5523 44 35 43.5523 35 43V35.5732C35 34.1895 35.3085 32.8232 35.903 31.5737C37.2836 28.6721 38 25.4991 38 22.2857V22.2119C38 19.6417 37.427 17.1039 36.3228 14.7831L35.5802 13.2225C35.1982 12.4196 35 11.5417 35 10.6525V5Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.0138 16.5301L21.4668 12.6436L17.6682 18.2283L20.6975 22.7746L17.6682 27.2283L21.4572 32.9147L24.0308 28.9875L26.6476 32.9147L30.3456 27.2718L27.3966 22.7718L30.3456 18.2718L26.6573 12.6436L24.0138 16.5301ZM25.8879 22.7746L24.0308 19.9875L22.2062 22.7718L24.0138 25.5301L25.8879 22.7746ZM20.1523 18.2377L21.4319 16.3564L22.6871 18.2718L21.4415 20.1725L20.1523 18.2377ZM25.3428 18.2377L26.6223 16.3564L27.8775 18.2718L26.632 20.1725L25.3428 18.2377ZM21.4319 25.3564L20.1523 27.2377L21.4415 29.1725L22.6871 27.2718L21.4319 25.3564ZM25.3428 27.2377L26.6223 25.3564L27.8775 27.2718L26.632 29.1725L25.3428 27.2377Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.3772 7.1193C22.7742 6.69949 25.2259 6.69949 27.6228 7.1193L31 7.71078V10.6526C31 11.5417 31.1982 12.4197 31.5802 13.2225L32.3228 14.7831C33.427 17.1039 34 19.6417 34 22.2119V22.2858C34 25.4991 33.2836 28.6721 31.903 31.5737C31.3085 32.8232 31 34.1895 31 35.5733V38.2893L29.348 38.5786C25.8096 39.1983 22.1904 39.1983 18.652 38.5786L17 38.2893V34.8221C17 33.9329 16.8018 33.055 16.4198 32.2521L16.097 31.5737C14.7164 28.6721 14 25.4991 14 22.2858V22.2119C14 19.6417 14.573 17.1039 15.6772 14.7831L16.097 13.9009C16.6915 12.6514 17 11.2851 17 9.90136V7.71078L20.3772 7.1193ZM27.2778 9.08931C25.1091 8.70949 22.8909 8.70949 20.7222 9.08931L19 9.39094V9.90136C19 11.5824 18.6252 13.2422 17.903 14.7602L17.4832 15.6424C16.5067 17.6948 16 19.939 16 22.2119V22.2858C16 25.2018 16.6501 28.0812 17.903 30.7144L18.2257 31.3928C18.7355 32.4641 19 33.6356 19 34.8221V36.6091C22.3082 37.1881 25.6918 37.1881 29 36.6091V35.5733C29 33.8922 29.3748 32.2324 30.097 30.7144C31.3499 28.0812 32 25.2018 32 22.2858V22.2119C32 19.939 31.4933 17.6948 30.5168 15.6424L29.7743 14.0818C29.2645 13.0105 29 11.839 29 10.6526V9.39094L27.2778 9.08931Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );