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="M27.2501 6C28.3415 6 29.3543 6.33661 30.1904 6.91167C29.9539 7.28228 29.7477 7.68802 29.5714 8.12871C29.3663 8.6415 29.6157 9.22347 30.1285 9.42857C30.6413 9.63368 31.2233 9.38425 31.4284 8.87146C31.8542 7.80688 32.4624 7.12162 33.2401 6.6842C33.9833 6.26621 34.9539 6.0341 36.211 6.00364C39.427 6.11479 42 8.75692 42 12C42 13.5367 41.4223 14.9385 40.4722 16C41.4223 17.0615 42 18.4633 42 20C42 21.9858 41.0353 23.7463 39.5489 24.8384C41.0206 25.7554 42 27.3884 42 29.2501C42 32.1189 39.6744 34.4446 36.8056 34.4446C35.0314 34.4446 33.4649 33.5551 32.5278 32.1977C32.1668 32.7207 31.7123 33.1742 31.1885 33.5342C30.4115 35.1254 30.0492 36.3993 30 38.1317V42H26V37.32C25.8819 35.7752 25.4006 34.5096 24.4522 32.7939C23.5859 31.8658 23.0557 30.6199 23.0557 29.2501C23.0557 26.3813 25.3813 24.0557 28.2501 24.0557C29.0247 24.0557 29.7598 24.2252 30.4201 24.5293C30.8926 24.7945 31.2397 25.0628 31.5101 25.3602C31.9689 25.8649 32.2894 26.5459 32.5194 27.6961C32.6277 28.2377 33.1545 28.5889 33.6961 28.4806C34.2377 28.3723 34.5889 27.8455 34.4806 27.3039C34.2106 25.9542 33.7811 24.8851 32.9899 24.0148C32.3349 23.2943 31.4916 22.7771 30.4656 22.3214C30.1657 21.6074 30 20.823 30 20C30 18.4633 30.5777 17.0615 31.5278 16C31.2507 15.6905 31.0054 15.352 30.7967 14.9897C29.8684 15.8576 28.6213 16.3889 27.2501 16.3889C25.4933 16.3889 23.9402 15.5167 23.0001 14.1818C22.06 15.5167 20.5069 16.3889 18.7501 16.3889C17.2616 16.3889 15.9193 15.7628 14.9723 14.7596C14.7216 15.0251 14.4433 15.2642 14.1419 15.4723C15.4994 16.4093 16.3889 17.9758 16.3889 19.7501C16.3889 20.8063 16.0737 21.7888 15.5323 22.6088C14.5043 21.8918 13.3565 21.5 12.0001 21.5C11.4478 21.5 11.0001 21.9477 11.0001 22.5C11.0001 23.0523 11.4478 23.5 12.0001 23.5C13.1662 23.5 14.1503 23.9091 15.1536 24.8872C15.924 25.7934 16.3889 26.9675 16.3889 28.2501C16.3889 30.0855 15.437 31.6985 14 32.6225V35.5C14 36.3284 13.3284 37 12.5 37C11.6716 37 11 36.3284 11 35.5V33.441C8.22129 33.3387 6.00003 31.0538 6.00003 28.2501C6.00003 26.4933 6.87217 24.9402 8.20712 24.0001C6.87217 23.06 6.00003 21.5069 6.00003 19.7501C6.00003 17.9758 6.88958 16.4094 8.24702 15.4723C6.88956 14.5352 6 12.9687 6 11.1944C6 8.32563 8.32563 6 11.1944 6C12.6829 6 14.0252 6.62609 14.9723 7.62928C15.9193 6.62609 17.2616 6 18.7501 6C20.5069 6 22.06 6.87215 23.0001 8.20709C23.9402 6.87215 25.4933 6 27.2501 6Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );