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="M8.03735 17C8.03735 17.7445 7.96697 18.4478 7.84042 19.1231C7.37767 21.5921 6.16389 23.6852 4.89396 26.0382C3.42525 28.7595 4.02324 31.2141 5.34651 33.5059C5.83851 34.358 6.43077 35.1876 7.05434 36C7.05434 35.8141 7.05408 35.6356 7.05383 35.4638C7.05238 34.4781 7.05126 33.7157 7.10199 33.0734C7.24843 31.2196 7.82687 30.3666 10.0763 28.0327C11.1023 29.93 10.8456 31.8945 10.4681 33.8901C10.4306 34.0884 10.3918 34.287 10.3531 34.4859C10.255 34.9891 10.1566 35.494 10.0763 36C10.4869 35.7952 10.8931 35.6046 11.2916 35.4176C11.5295 35.3059 11.7647 35.1955 11.9964 35.0842C13.8305 34.2031 15.4437 33.2639 16.4682 31.1594C17.677 28.6763 17.1436 26.7141 16.3128 24.3403C16.0314 23.5362 15.7158 22.6848 15.4223 21.75C15.0656 23.1071 14.4009 24.3409 13.969 25.2045C13.1091 21.7648 10.6567 19.245 8.03735 17Z" fill="black"/>
<path d="M38.9998 17.2207L22.2686 17.2207C21.2822 17.2207 20.8915 15.9438 21.7092 15.3919L25.7452 12.6676C26.9244 11.8716 27.225 10.2652 26.4136 9.09663C25.6719 8.02864 24.2459 7.68901 23.1024 8.30802L10.2869 15.2457C10.1321 15.3296 9.97956 15.4165 9.82944 15.5065C11.2762 16.8084 12.4809 18.1401 13.8912 20.5C14.5007 19.5 14.9297 18.2857 15.3912 16.5C15.6311 17.2767 16.0393 18.2419 16.4994 19.3296C18.1886 23.323 20.5762 28.9675 17.8912 33C15.8973 35.7456 14.2133 36.5657 11.9924 37.6472C11.8925 37.6959 11.7914 37.7451 11.6892 37.7951C11.46 37.907 11.2282 38.0183 10.9942 38.1301C12.5177 38.8303 14.2131 39.2207 15.9998 39.2207L32.9998 39.2207C34.1043 39.2207 34.9998 38.3253 34.9998 37.2207C34.9998 36.1162 34.1043 35.2207 32.9998 35.2207H22.8886V33.2207H38.9998C40.1043 33.2207 40.9998 32.3253 40.9998 31.2207C40.9998 30.1162 40.1043 29.2207 38.9998 29.2207H24.9998V27.2207H41.9997C43.1043 27.2207 43.9997 26.3253 43.9997 25.2207C43.9997 24.1162 43.1043 23.2207 41.9997 23.2207L24.9998 23.2207V21.2207L38.9998 21.2207C40.1043 21.2207 40.9998 20.3253 40.9998 19.2207C40.9998 18.1162 40.1043 17.2207 38.9998 17.2207Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );