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="M22.7483 4H21.5C21.0326 4 20.6275 4.3238 20.5246 4.77974L17.1719 19.6272C17.0577 20.1331 17 20.6503 17 21.169V23.4909C17 24.2703 17.1302 25.0442 17.3851 25.7807L21.2388 36.9136L15.8143 39H13C12.4477 39 12 39.4477 12 40V41C12 42.6568 13.3431 44 15 44H18.3197C18.4996 44 18.6792 43.9838 18.8563 43.9516L22.8673 43.2223C23.5058 43.1062 24.1647 43.2004 24.7452 43.4906L24.8062 43.5211C26.8124 44.5242 29.25 43.6497 30.161 41.6001C30.7775 40.2127 30.5409 38.5944 29.5529 37.4418L28.0169 35.6498L28.3858 27.5352C28.4687 25.7111 27.9948 23.9049 27.0271 22.3565L26.248 21.11C26.4581 20.8718 26.7244 20.5643 27.0322 20.1968C27.8122 19.2656 28.8629 17.9444 29.9466 16.3826C32.0905 13.2928 34.4583 9.12906 34.9912 5.13216C35.0293 4.84643 34.9423 4.55816 34.7524 4.34128C34.5625 4.12439 34.2883 4 34 4H33.3333L32.8043 6C32.0866 9.18105 30.1846 12.5313 28.3034 15.2424C27.2621 16.7431 26.2503 18.0156 25.499 18.9126C25.1237 19.3606 24.8143 19.7139 24.5999 19.9539C24.4927 20.0739 24.4094 20.1655 24.3535 20.2264C24.3255 20.2568 24.3044 20.2796 24.2907 20.2944L24.2756 20.3106L24.2722 20.3142C23.961 20.645 23.9112 21.1448 24.152 21.53L25.3311 23.4165C26.0838 24.6208 26.4523 26.0256 26.3879 27.4443L26.001 35.9546C25.9895 36.2087 26.0752 36.4576 26.2407 36.6508L28.0344 38.7433C28.5201 39.3101 28.6365 40.1057 28.3333 40.7878C27.8855 41.7955 26.687 42.2255 25.7007 41.7323L25.6396 41.7018C24.6721 41.218 23.5738 41.0611 22.5095 41.2546L18.4985 41.9839C18.4395 41.9946 18.3797 42 18.3197 42H15C14.4477 42 14 41.5523 14 41H16C16.1227 41 16.2444 40.9774 16.359 40.9333L22.859 38.4333C23.3621 38.2398 23.6213 37.6823 23.445 37.1729L19.2751 25.1264C19.093 24.6004 19 24.0476 19 23.4909V21.169C19 20.7985 19.0412 20.4291 19.1228 20.0677L22.7483 4Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );