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="M25 14C25.9241 14 26.7897 13.7493 27.5324 13.3122L28.5872 15H19C18.9532 15 18.9072 15.0032 18.8622 15.0094C16.541 15.1102 14.5735 16.0171 13.1703 17.5019C11.7184 19.0383 11.0182 21.0356 11.0003 22.9724C10.9825 24.9105 11.6479 26.9316 13.1119 28.4909C14.3498 29.8094 16.029 30.6592 18 30.917V30.9803L17.9999 30.9952L17.9999 31L17.9999 41C17.9999 42.5988 19.2537 43.9166 20.8505 43.9963C22.4472 44.0759 23.8259 42.8894 23.985 41.2985L24.7149 34H25.2849L26.0148 41.2985C26.1739 42.8894 27.5526 44.0759 29.1493 43.9963C30.7461 43.9166 31.9999 42.5988 31.9999 41V33.0135L32 33V21H34C35.0906 21 36.0952 20.4082 36.6239 19.4543C37.1526 18.5004 37.122 17.3348 36.544 16.41L31.544 8.41C31.0925 7.68761 30.3839 7.22374 29.6109 7.06286C28.854 5.26345 27.0746 4 25 4C22.2386 4 20 6.23858 20 9C20 11.7614 22.2386 14 25 14ZM25 12C25.5347 12 26.0368 11.8601 26.4716 11.6149L26.456 11.59C25.5779 10.185 26.005 8.33414 27.41 7.45601C27.4493 7.43145 27.4889 7.40792 27.5289 7.38539C26.9959 6.55227 26.0624 6 25 6C23.3431 6 22 7.34315 22 9C22 10.6569 23.3431 12 25 12ZM29.848 9.47C29.5553 9.00167 28.9383 8.85929 28.47 9.152C28.0017 9.44471 27.8593 10.0617 28.152 10.53L31.2395 15.47C31.4322 15.7782 31.4424 16.1668 31.2661 16.4847C31.0899 16.8027 30.755 17 30.3915 17H19.099C19.0771 17.0021 19.0551 17.0036 19.0328 17.0043C17.1598 17.0658 15.664 17.775 14.6239 18.8756C13.5496 20.0124 13.0139 21.5114 13.0003 22.9908C12.9867 24.4708 13.4955 25.9776 14.5699 27.122C15.6105 28.2302 17.1218 28.9355 19.0316 28.9958C19.1083 28.9982 19.1828 29.0092 19.2541 29.0279C19.5477 29.0299 19.8295 29.0351 20.0955 29.0403L20.1713 29.0417C20.4868 29.0479 20.7765 29.0535 21.0487 29.054C21.6494 29.0551 22.0841 29.0295 22.404 28.957C22.7096 28.8878 22.8089 28.7983 22.8519 28.7431C22.9004 28.681 23 28.5033 23 28.027C23 27.6007 22.8939 27.4386 22.8305 27.3689C22.7523 27.2829 22.5899 27.1761 22.2306 27.1001C21.8694 27.0237 21.4095 26.9989 20.8378 27C20.5663 27.0005 20.2846 27.0066 19.9861 27.013L19.9541 27.0137C19.6475 27.0203 19.3247 27.027 19 27.027C18.8808 27.027 18.7664 27.0061 18.6603 26.9678C17.4547 26.8423 16.5994 26.3615 16.028 25.753C15.343 25.0234 14.9908 24.0307 15.0002 23.0092C15.0096 21.9874 15.3807 20.9867 16.0775 20.2493C16.7008 19.5898 17.6349 19.0878 18.9408 19.0104C19.2158 18.9941 19.4854 19.092 19.6859 19.2809C19.8863 19.4699 20 19.7332 20 20.0087V25.0122C20.2767 25.0063 20.5588 25.0005 20.8341 25C21.4342 24.9989 22.0681 25.0215 22.6444 25.1434C23.2226 25.2656 23.8414 25.5079 24.3101 26.0232C24.7936 26.5549 25 27.2463 25 28.027C25 28.7577 24.8496 29.4336 24.4293 29.9727C24.0036 30.5188 23.4154 30.7786 22.846 30.9076C22.2909 31.0333 21.6631 31.0551 21.0451 31.054C20.7543 31.0534 20.4474 31.0475 20.1362 31.0414L19.9999 31.0388V41C19.9999 41.5329 20.4178 41.9722 20.9501 41.9988C21.4824 42.0253 21.9419 41.6298 21.9949 41.0995L22.8148 32.9005C22.866 32.3893 23.2961 32 23.8099 32H26.1899C26.7037 32 27.1338 32.3893 27.185 32.9005L28.0049 41.0995C28.0579 41.6298 28.5175 42.0253 29.0497 41.9988C29.582 41.9722 29.9999 41.5329 29.9999 41V33L30 32.9864V20C30 19.4477 30.4477 19 31 19H34C34.3635 19 34.6984 18.8027 34.8746 18.4848C35.0509 18.1668 35.0407 17.7783 34.848 17.47L29.848 9.47ZM18 21.272C17.7971 21.3773 17.6458 21.5017 17.5311 21.623C17.2103 21.9625 17.0053 22.4656 17.0001 23.0276C16.9949 23.5879 17.1887 24.0673 17.4861 24.384C17.6015 24.5069 17.7649 24.6407 18 24.7521V21.272Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );