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="M28.0555 14.2778C28.0555 16.6403 26.1403 18.5555 23.7777 18.5555C21.4152 18.5555 19.5 16.6403 19.5 14.2778C19.5 11.9152 21.4152 10 23.7777 10C26.1403 10 28.0555 11.9152 28.0555 14.2778Z" fill="black"/>
<path d="M27.6667 27.8422C27.6667 28.3348 27.223 29.5999 25.8618 30.2061C25.706 30.2754 25.5309 30.3624 25.3735 30.4405L25.2809 30.4864C25.0875 30.582 24.9004 30.6724 24.7111 30.7526C24.3164 30.9198 24.0085 30.9997 23.7778 30.9997C23.547 30.9997 23.2392 30.9198 22.8445 30.7526C22.6552 30.6724 22.468 30.582 22.2747 30.4864L22.1821 30.4405C22.0247 30.3624 21.8496 30.2754 21.6938 30.2061C20.3326 29.5999 19.8889 28.3348 19.8889 27.8422V26.3332H27.6667V27.8422Z" fill="black"/>
<path d="M27.6667 23.3098C29.028 23.1157 30.4573 22.822 32.0357 22.4315C33.108 22.1663 33.7622 21.082 33.497 20.0098C33.2317 18.9375 32.1475 18.2833 31.0752 18.5486C28.1306 19.277 25.9341 19.5983 23.7852 19.5901C21.6305 19.5819 19.4266 19.2423 16.4585 18.5433C15.3833 18.2901 14.3065 18.9564 14.0533 20.0316C13.8 21.1067 14.4664 22.1836 15.5415 22.4368C17.1094 22.806 18.532 23.0938 19.8889 23.2896V24.7776H27.6667V23.3098Z" fill="black"/>
<path d="M17.2248 34.1027C17.2248 33.0133 17.4844 32.0888 17.9736 31.2922C18.0031 31.2442 18.0334 31.1967 18.0646 31.1496C18.3435 30.7279 18.6889 30.3427 19.096 29.9884C19.2585 30.2632 19.4681 30.5386 19.7295 30.7966L19.7441 30.8108C19.8333 30.898 19.9284 30.9831 20.0296 31.0654L20.0428 31.076C20.3174 31.2976 20.6368 31.4989 21.0045 31.666C20.8665 31.7965 20.7344 31.9478 20.6095 32.1337C20.4514 32.369 20.3024 32.6268 20.1812 32.8952L20.1666 32.9278C19.9975 33.3104 19.8861 33.7134 19.8861 34.1027C19.8861 34.719 20.1389 35.2492 20.3305 35.6508L20.3444 35.6802C20.5559 36.124 20.6895 36.4226 20.6895 36.7384C20.6895 37.4482 20.0795 37.9997 19.3589 37.9997C18.6872 37.9997 18.1558 37.5524 17.76 36.6866C17.3735 35.8411 17.2248 34.7979 17.2248 34.1027Z" fill="black"/>
<path d="M28.4595 29.988C28.297 30.2628 28.0874 30.5382 27.826 30.7962L27.8114 30.8104C27.7223 30.8976 27.6271 30.9827 27.5259 31.065L27.5128 31.0756C27.2381 31.2972 26.9187 31.4985 26.551 31.6656C26.689 31.7961 26.8211 31.9473 26.946 32.1332C27.104 32.3685 27.2531 32.6264 27.3743 32.8948L27.3889 32.9274C27.5579 33.31 27.6694 33.713 27.6694 34.1022C27.6694 34.7185 27.4165 35.2487 27.225 35.6504L27.211 35.6797C26.9996 36.1235 26.8659 36.4222 26.8659 36.7379C26.8659 37.4478 27.476 37.9993 28.1966 37.9993C28.8682 37.9993 29.3997 37.552 29.7955 36.6862C30.182 35.8407 30.3307 34.7975 30.3307 34.1022C30.3307 33.0128 30.0711 32.0884 29.5818 31.2918C29.5524 31.2438 29.5221 31.1963 29.491 31.1492C29.212 30.7275 28.8666 30.3424 28.4595 29.988Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 9C6 7.34315 7.34315 6 9 6H39C40.6569 6 42 7.34315 42 9V39C42 40.6569 40.6569 42 39 42H9C7.34315 42 6 40.6569 6 39V9ZM8 9C8 8.44772 8.44771 8 9 8H39C39.5523 8 40 8.44771 40 9V39C40 39.5523 39.5523 40 39 40H9C8.44772 40 8 39.5523 8 39V9Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );