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="M24 13C24.8284 13 25.5 12.3284 25.5 11.5C25.5 10.6715 24.8284 9.99996 24 9.99996C23.1716 9.99996 22.5 10.6715 22.5 11.5C22.5 12.3284 23.1716 13 24 13Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M23.8164 6.01695L23.8077 6.01859L23.7854 6.02282L23.702 6.03892C23.6297 6.05301 23.5247 6.07379 23.3917 6.10095C23.1258 6.15525 22.7474 6.23519 22.2938 6.33838C21.3888 6.54428 20.1748 6.84496 18.9548 7.22195C17.7462 7.5954 16.4812 8.05886 15.5001 8.60184C15.0118 8.87213 14.5441 9.18886 14.1866 9.5616C13.8324 9.93081 13.5 10.4481 13.5 11.0967C13.5 12.8417 13.9894 14.12 14.508 14.9773C14.7632 15.399 15.0222 15.7137 15.2263 15.9298C15.2353 16.0451 15.2515 16.1743 15.2786 16.3145C15.38 16.8401 15.6333 17.5098 16.2127 18.1606C16.0735 18.752 16 19.3679 16 20C16 24.4183 19.5817 28 24 28C28.4183 28 32 24.4183 32 20C32 19.3679 31.9265 18.752 31.7873 18.1606C32.3667 17.5098 32.62 16.8401 32.7214 16.3145C32.7485 16.1743 32.7647 16.0452 32.7737 15.9298C32.9778 15.7137 33.2368 15.3991 33.4919 14.9774C34.0107 14.1201 34.5 12.8419 34.5 11.0967C34.5 10.4481 34.1676 9.93081 33.8134 9.5616C33.4559 9.18886 32.9882 8.87213 32.4999 8.60184C31.5188 8.05886 30.2538 7.5954 29.0452 7.22195C27.8252 6.84496 26.6112 6.54428 25.7062 6.33838C25.2526 6.23519 24.8742 6.15525 24.6083 6.10095C24.4753 6.07379 24.3703 6.05301 24.298 6.03892L24.2146 6.02282L24.1923 6.01859L24.1836 6.01695L24 5.98267L23.8164 6.01695ZM24 6.99996L24.1836 6.01695C24.1834 6.01692 24.1836 6.01695 24 6.99996ZM23.8164 6.01695L24 6.99996C23.8164 6.01695 23.8166 6.01692 23.8164 6.01695ZM24 18.5C26.2067 18.5 27.6885 18.2137 28.6803 17.8419C29.5187 17.5272 30.0075 17.151 30.2908 16.8338C30.3929 16.7194 30.4738 16.6071 30.5378 16.5H17.4622C17.5262 16.6071 17.6071 16.7194 17.7092 16.8338C17.9925 17.151 18.4813 17.5272 19.3197 17.8419C20.3115 18.2137 21.7933 18.5 24 18.5ZM31.3717 14.5H16.6283C16.5147 14.3732 16.3684 14.1885 16.2192 13.942C15.8761 13.3748 15.5039 12.4581 15.5 11.1179C15.5089 11.0973 15.5391 11.0407 15.6298 10.9461C15.7918 10.7773 16.0663 10.5744 16.4686 10.3517C17.2688 9.90879 18.3788 9.49322 19.5452 9.1328C20.7002 8.77592 21.8612 8.48789 22.7375 8.28855C23.1745 8.18912 23.5383 8.1123 23.7919 8.0605C23.873 8.04395 23.9427 8.02995 24 8.01861C24.0573 8.02995 24.127 8.04394 24.2081 8.0605C24.4617 8.1123 24.8255 8.18912 25.2625 8.28855C26.1388 8.48789 27.2998 8.77592 28.4548 9.1328C29.6212 9.49322 30.7312 9.90879 31.5314 10.3517C31.9337 10.5744 32.2082 10.7773 32.3702 10.9461C32.4609 11.0407 32.4911 11.0973 32.5 11.1179C32.4961 12.4583 32.1239 13.375 31.7808 13.9421C31.6316 14.1886 31.4853 14.3732 31.3717 14.5ZM18 20C18 19.8197 18.0079 19.6415 18.0234 19.4656C19.3606 20.0932 21.2766 20.5 24 20.5C26.3447 20.5 28.0889 20.1992 29.382 19.7151C29.5919 19.6365 29.7899 19.5532 29.9766 19.4656C29.9921 19.6415 30 19.8197 30 20C30 23.3137 27.3137 26 24 26C20.6863 26 18 23.3137 18 20ZM15.4968 11.1268C15.4968 11.1268 15.4969 11.126 15.4975 11.1245L15.4968 11.1268Z" fill="black"/>
<path d="M33 34C33.6667 34.6666 35 35.3333 35 35.3333C35 35.3333 34.3017 38 33 38C31.6983 38 31 35.3333 31 35.3333C31 35.3333 32.3333 34.6666 33 34Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.5 31C20.5 29.8954 21.3954 29 22.5 29H25.5C26.6046 29 27.5 29.8954 27.5 31V32.3819C27.5 33.0488 27.1683 33.6653 26.6267 34.0344L26.7398 34.6L30.1715 30.4329C30.4075 30.1463 30.7829 30.0141 31.1464 30.0894C33.7099 30.6206 36.3329 31.4268 38.3414 32.5334C40.2835 33.6035 42 35.1562 42 37.2979V41C42 41.5523 41.5523 42 41 42H7C6.44772 42 6 41.5523 6 41V37.2979C6 35.1679 7.75055 33.6251 9.69161 32.5636C11.7083 31.4607 14.3321 30.649 16.8647 30.1103C17.2297 30.0326 17.6075 30.1646 17.8447 30.4527L21.2758 34.6189L21.3828 34.0409C20.8356 33.6725 20.5 33.0527 20.5 32.3819V31ZM24.5194 33.6961L25.0988 36.5927L24 37.9269L22.9364 36.6354L23.4833 33.682C23.5644 33.2438 23.3458 32.8048 22.9472 32.6055L22.5 32.3819V31H25.5V32.3819L25.0528 32.6055C24.6494 32.8072 24.431 33.2539 24.5194 33.6961ZM24.8837 40L31.3282 32.1745C33.5878 32.6808 35.7547 33.3917 37.3762 34.2851C39.2043 35.2924 40 36.3329 40 37.2979V40H24.8837ZM16.6903 32.197L23.1163 40H8V37.2979C8 36.3643 8.79922 35.3312 10.6513 34.3183C12.2842 33.4253 14.4547 32.71 16.6903 32.197Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );