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="M19.5 11C20.8807 11 22 9.88071 22 8.5C22 7.11929 20.8807 6 19.5 6C18.1193 6 17 7.11929 17 8.5C17 9.88071 18.1193 11 19.5 11ZM19.5 13C21.9853 13 24 10.9853 24 8.5C24 6.01472 21.9853 4 19.5 4C17.0147 4 15 6.01472 15 8.5C15 10.9853 17.0147 13 19.5 13Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M32 16C34.2091 16 36 14.2091 36 12C36 9.79086 34.2091 8 32 8C29.7909 8 28 9.79086 28 12C28 14.2091 29.7909 16 32 16ZM32 18C35.3137 18 38 15.3137 38 12C38 8.68629 35.3137 6 32 6C28.6863 6 26 8.68629 26 12C26 15.3137 28.6863 18 32 18Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M32 9C32.5523 9 33 9.44772 33 10V11.6972L33.8321 12.9453C34.1384 13.4048 34.0142 14.0257 33.5547 14.3321C33.0952 14.6384 32.4743 14.5142 32.1679 14.0547L31 12.3028V10C31 9.44772 31.4477 9 32 9Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.0795 15.3065C15.3527 15.1874 15.8588 15 16.5 15H18.5C19.071 15 19.5275 15.1643 19.6506 15.2086L19.6587 15.2115C19.859 15.2835 20.0444 15.3671 20.1974 15.4416C20.5096 15.5936 20.8513 15.7884 21.2009 16.0088C21.9068 16.4536 22.769 17.0806 23.6694 17.8729C25.447 19.4371 27.553 21.8048 28.7854 24.8858C29.5686 26.8438 29.5132 28.7332 28.7846 30.3777C28.103 31.9159 26.9491 32.9814 25.967 33.675C22.9171 35.829 22.774 37.2291 21.9981 41.1087C21.9409 42.7152 20.6205 44 19 44C17.3431 44 16 42.6569 16 41C16 35.8673 15.9977 32.8134 15.7657 29.9253C14.4605 30.8767 12.6265 30.6238 11.6297 29.3389C11.3868 29.0258 10.7143 28.0796 10.1137 27.1692C9.80953 26.7081 9.48895 26.2037 9.23467 25.7575C9.11011 25.539 8.97253 25.2842 8.85725 25.028C8.79986 24.9005 8.72744 24.7275 8.66451 24.529C8.61541 24.3742 8.5 23.9883 8.5 23.5C8.5 22.7844 8.76069 22.228 8.81751 22.1067L8.8182 22.1053L8.81889 22.1038L8.82068 22.1C8.91538 21.8945 9.0211 21.7097 9.10495 21.5706C9.27784 21.284 9.49243 20.9715 9.71138 20.6694C10.1569 20.0545 10.7401 19.3184 11.3472 18.6101C11.9477 17.9096 12.6258 17.1727 13.2606 16.5859C13.5722 16.298 13.9386 15.9851 14.3257 15.7252C14.52 15.5948 14.7768 15.4386 15.0795 15.3065ZM16.5 17C15.765 17 15.1254 17.5858 14.6181 18.0547C14.0627 18.568 13.4409 19.2407 12.8657 19.9117C12.2884 20.5853 11.7398 21.2786 11.3309 21.8429C11.0794 22.1899 10.8173 22.546 10.637 22.9372C10.5555 23.1141 10.5 23.3039 10.5 23.5C10.5 23.9569 10.7535 24.3834 10.9723 24.7673C11.195 25.158 11.4882 25.6207 11.7832 26.0679C12.3707 26.9585 13.0115 27.8573 13.2099 28.113C13.5484 28.5493 14.1766 28.6286 14.613 28.2901C15.0493 27.9516 15.1286 27.3234 14.7901 26.887C14.6363 26.6888 14.0271 25.8375 13.4527 24.9666C13.2553 24.6674 13.0691 24.3766 12.9109 24.1169L12.5646 23.5483L12.9555 23.0094C13.3273 22.4968 13.8391 21.8493 14.3843 21.2133C14.507 21.0701 14.63 20.9291 14.7521 20.7919L16.0899 19.2881L16.4803 21.2625C17.9921 28.9082 18 31.4231 18 41C18 41.5523 18.4477 42 19 42C19.6212 42 20 41.479 20 40.901C20.8162 36.8201 21.295 34.5261 24.8132 32.0413C25.6285 31.4656 26.4735 30.6563 26.956 29.5674C27.4541 28.4433 27.523 27.115 26.9285 25.6286C25.851 22.935 23.9824 20.8124 22.3481 19.3743C21.5272 18.6519 20.7502 18.0887 20.1347 17.7008C19.7701 17.4711 19.3904 17.2402 18.9827 17.0938C18.8278 17.0381 18.6654 17 18.5 17H16.5Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );