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.3679 29.9493C7.96423 31.0004 8.5065 32.1815 9.58296 32.5118C14.1546 33.9145 18.9927 34.6713 23.9993 34.6713C29.0062 34.6713 33.8448 33.9144 38.4167 32.5115C39.4931 32.1812 40.0354 31.0001 39.6317 29.949L33.2233 13.2617C32.8518 12.2942 31.804 11.7779 30.7925 12.0035C28.6044 12.4915 26.3314 12.7492 23.9993 12.7492C21.6676 12.7492 19.3949 12.4916 17.207 12.0037C16.1955 11.7781 15.1478 12.2945 14.7763 13.2619L8.3679 29.9493ZM34.2058 22.1535C34.2058 24.6343 32.1387 26.6455 29.5888 26.6455C29.3948 26.6455 29.2035 26.6338 29.0157 26.6112C28.8421 26.8451 28.6564 27.1632 28.4427 27.5294C27.5235 29.1042 26.0861 31.5668 22.8658 32.0269C20.3515 32.3903 18.6138 30.2723 17.4594 28.0173C17.3142 27.7337 17.1732 27.4603 17.0413 27.207C16.8476 27.2931 16.6403 27.3862 16.4345 27.4786C15.9051 27.7163 15.3865 27.9492 15.1397 28.0452C14.0873 28.4544 12.8933 27.9561 12.4727 26.9322C12.0521 25.9084 12.5643 24.7466 13.6166 24.3374C13.767 24.279 14.0888 24.1342 14.511 23.9443C14.796 23.8162 15.1267 23.6674 15.4814 23.5107C15.8825 23.3335 16.3009 23.1526 16.6422 23.0187C16.8073 22.9539 16.9955 22.8837 17.1721 22.8302C17.2554 22.805 17.3896 22.7669 17.5444 22.7402C17.6211 22.727 17.7494 22.7083 17.9059 22.7056C18.0276 22.7035 18.3594 22.7046 18.7417 22.8559C19.0599 22.9819 19.2671 23.1555 19.3392 23.2176C19.4343 23.2997 19.5038 23.3746 19.5434 23.4192C19.6231 23.5091 19.6825 23.5909 19.7143 23.636C19.7826 23.7326 19.8449 23.8333 19.8926 23.9127C19.9929 24.0799 20.1117 24.2929 20.2356 24.5214C20.3853 24.7975 20.8308 25.6872 21.0459 26.1183C21.1034 26.2335 21.2585 26.2556 21.3458 26.161C21.3901 26.113 21.4057 26.0452 21.3867 25.9827L20.7307 23.8243C20.5559 23.2416 20.38 22.6571 20.2357 22.1891C20.1633 21.9547 20.101 21.7563 20.0518 21.6052C20.0171 21.4984 19.9967 21.4395 19.9881 21.4147C19.9823 21.3981 19.9819 21.3968 19.986 21.4066C19.5602 20.3848 20.0666 19.2206 21.1168 18.8064C22.1671 18.3922 23.3636 18.8848 23.7893 19.9067L24.782 23.2775C24.8056 23.3578 24.8844 23.4084 24.9673 23.3968C25.0609 23.3837 25.1203 23.2918 25.0978 23.2C25.0155 22.8642 24.9719 22.5138 24.9719 22.1535C24.9719 20.2261 25.8573 18.9352 27.7295 18.1809C28.9224 17.7003 30.2896 17.5372 31.4692 18.0496C33.0819 18.7502 34.2058 20.3241 34.2058 22.1535Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M41 11.5V13.5C41 14.0523 41.4477 14.5 42 14.5C42.5523 14.5 43 14.0523 43 13.5V11C43 10.1716 42.3284 9.5 41.5 9.5L39 9.5C38.4477 9.5 38 9.94772 38 10.5C38 11.0523 38.4477 11.5 39 11.5H41Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M7 11.5H9C9.55228 11.5 10 11.0523 10 10.5C10 9.94772 9.55228 9.5 9 9.5H6.5C5.67157 9.5 5 10.1716 5 11V13.5C5 14.0523 5.44772 14.5 6 14.5C6.55228 14.5 7 14.0523 7 13.5V11.5Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M41 36.5V34.5C41 33.9477 41.4477 33.5 42 33.5C42.5523 33.5 43 33.9477 43 34.5V37C43 37.8284 42.3284 38.5 41.5 38.5H39C38.4477 38.5 38 38.0523 38 37.5C38 36.9477 38.4477 36.5 39 36.5H41Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M7 36.5H9C9.55228 36.5 10 36.9477 10 37.5C10 38.0523 9.55228 38.5 9 38.5H6.5C5.67157 38.5 5 37.8284 5 37V34.5C5 33.9477 5.44772 33.5 6 33.5C6.55228 33.5 7 33.9477 7 34.5V36.5Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );