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="M21.8266 8.57643C22.7107 7.03427 23 5.51157 23 4H25C25 5.78843 24.6521 7.66924 23.5617 9.57117C22.4762 11.4645 20.692 13.3144 17.9195 15.1088C15.3594 16.7658 15.0483 17.9966 15.2144 18.8233C15.3132 19.3154 15.6064 19.8515 16.1071 20.4395C16.6049 21.0241 17.2592 21.604 17.9965 22.187C21.2602 24.7679 22.5467 28.0344 23.6363 30.8009L23.692 30.9421C24.8226 33.811 25.7311 35.9567 28.0715 37.1017C29.1936 37.6507 30.7131 38 32.8635 38C33.0727 38 33.4756 37.8907 33.963 37.6108C34.4317 37.3417 34.8615 36.9812 35.138 36.6226C35.433 36.2398 35.4367 36.0223 35.4235 35.9625C35.4205 35.9488 35.3668 35.7006 34.6546 35.4385C30.5113 33.9136 28.241 31.2937 27.4292 27.9738C26.6384 24.7402 27.2668 20.9843 28.5526 17.1798C28.9218 16.0876 29.571 14.8631 30.297 13.6345C30.853 12.6934 31.4785 11.7102 32.0909 10.7476L32.0925 10.745C32.2825 10.4464 32.4711 10.1498 32.6561 9.85705C33.4477 8.60408 34.1734 7.41814 34.7009 6.36926C35.2466 5.2842 35.5 4.49599 35.5 4H37.5C37.5 5.00401 37.0455 6.15869 36.4877 7.26786C35.9117 8.41321 35.1382 9.67285 34.3469 10.9253C34.1545 11.2299 33.9611 11.534 33.7684 11.8368L33.7654 11.8416C33.157 12.7979 32.5566 13.7419 32.0189 14.6519C31.307 15.8567 30.7469 16.9339 30.4473 17.8202C29.2058 21.4935 28.7153 24.8136 29.3719 27.4987C30.0074 30.0974 31.7508 32.2386 35.3454 33.5615C36.3773 33.9413 37.1652 34.576 37.3763 35.5307C37.5764 36.4354 37.17 37.2623 36.722 37.8436C36.2554 38.4489 35.6091 38.9719 34.9589 39.3452C34.3273 39.7079 33.5685 40 32.8635 40C30.5033 40 28.6624 39.6174 27.1925 38.8983C24.0766 37.3737 22.9338 34.4736 21.8545 31.7345L21.8231 31.6548C20.7108 28.8324 19.595 26.0008 16.756 23.7558C15.9783 23.1409 15.2065 22.4668 14.5843 21.7361C13.9651 21.0089 13.4447 20.1685 13.2535 19.2173C12.8397 17.1574 14.0435 15.2351 16.8328 13.4298C19.4099 11.7619 20.9375 10.1272 21.8266 8.57643Z" fill="black"/>
<path d="M22.9465 14.6335C23.3056 15.0531 23.2565 15.6843 22.8369 16.0434C22.2366 16.5571 21.7711 17.035 21.5576 17.5197C21.3889 17.9027 21.3427 18.3545 21.802 19.0225C22.1149 19.4775 21.9997 20.1001 21.5446 20.4131C21.0896 20.726 20.467 20.6108 20.154 20.1557C19.3157 18.9365 19.2694 17.7527 19.7273 16.7134C20.1404 15.7757 20.9281 15.0445 21.5366 14.5238C21.9562 14.1647 22.5874 14.2138 22.9465 14.6335Z" fill="black"/>
<path d="M11.9447 20.6721C11.7636 20.1504 11.1939 19.8742 10.6721 20.0553C10.2516 20.2013 9.99063 20.5997 10 21.022V22.978C9.99743 23.0938 10.0151 23.2121 10.0553 23.3279C10.5577 24.7754 11.1028 25.809 11.6927 26.6038C12.2868 27.4042 12.8973 27.9225 13.467 28.3574C13.6022 28.4606 13.7343 28.5588 13.8632 28.6546C14.7778 29.3343 15.5442 29.9039 16.3088 31.4446C16.7032 32.2392 16.9462 33.2299 17.2401 34.4276C17.2702 34.5503 17.3008 34.6753 17.3322 34.8024C17.6564 36.1148 18.0516 37.6036 18.8011 38.9786C19.5642 40.3787 20.6919 41.6589 22.46 42.5754C24.1847 43.4693 26.4551 43.9843 29.4743 43.9997C29.4828 43.9999 29.4914 44 29.5 44L32 44L32.0077 44H33.9759L34 44C34.5523 44 35 43.5523 35 43C35 42.9633 34.998 42.927 34.9942 42.8912C34.969 42.6585 34.864 42.4498 34.7071 42.2929C34.5262 42.1119 34.2762 42 34 42H33.9779C33.3037 41.9983 32.0608 41.9185 30.8562 41.8152C29.6235 41.7095 28.5408 41.5884 28.1961 41.5194C24.8308 40.8464 22.8342 38.7341 21.4056 36.1969C20.6858 34.9185 20.1226 33.5523 19.6062 32.2237C19.5129 31.9835 19.4204 31.7427 19.3284 31.5031C18.923 30.4472 18.5262 29.4136 18.1003 28.5555C17.1163 26.5727 16.0069 25.7518 15.0482 25.0425C14.923 24.9498 14.8001 24.8589 14.6806 24.7677C14.1859 24.39 13.7368 24.0021 13.2987 23.4118C12.8565 22.8161 12.3969 21.9747 11.9447 20.6721Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );