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="M30.8397 30.6163C30.7335 30.9263 30.572 31.2447 30.3684 31.494C29.0811 33.0702 26.6364 34 24.0132 34C21.4962 34 19.1575 33.146 17.834 31.6976C17.8303 31.6936 17.8232 31.6862 17.8133 31.6759C17.7509 31.6112 17.5785 31.4323 17.4623 31.2592C17.292 31.0058 17.1668 30.7004 17.0909 30.4047C17.0156 30.1111 16.9688 29.7483 17.0244 29.3835C17.0803 29.0172 17.2647 28.5282 17.7618 28.2295C18.2429 27.9403 18.7837 27.9714 19.2383 28.0992C21.5915 28.7127 22.7388 28.9867 23.8768 28.9918C25.0121 28.9969 26.1852 28.7337 28.5811 28.0977L28.5945 28.0942C29.1149 27.9637 29.7031 27.9351 30.2113 28.2322C30.7608 28.5534 30.9508 29.0927 30.9905 29.5094C31.0289 29.913 30.9454 30.3077 30.8397 30.6163Z" fill="black"/>
<path d="M21.3023 23.1081C21.4323 22.7504 21.3934 22.3134 21.2857 21.9149C21.1734 21.4993 20.9666 21.0515 20.6753 20.6356C20.0947 19.8064 19.1318 19.0441 17.831 18.9895C16.4842 18.9329 15.4778 19.7877 14.8578 20.6948C14.5433 21.1551 14.3095 21.6531 14.1629 22.1111C14.0202 22.5568 13.9445 23.013 13.9944 23.3776C14.0175 23.5467 14.1254 23.6924 14.2804 23.7638C14.4355 23.8353 14.6163 23.8228 14.7599 23.7305C15.1593 23.4741 15.579 23.1232 15.9668 22.799C16.1434 22.6513 16.3135 22.5092 16.4719 22.3841C17.0342 21.94 17.4717 21.687 17.8345 21.6692C18.1791 21.6523 18.5774 21.8499 19.0791 22.2253C19.2585 22.3595 19.4326 22.5016 19.6129 22.6487L19.6143 22.6498C19.6781 22.7018 19.7426 22.7545 19.8085 22.8078C20.0523 23.0046 20.3119 23.2069 20.5736 23.3652C20.7016 23.4426 20.8576 23.4586 20.9987 23.4089C21.1398 23.3591 21.2512 23.2488 21.3023 23.1081Z" fill="black"/>
<path d="M26.6132 23.1081C26.4832 22.7504 26.5221 22.3134 26.6298 21.9149C26.7421 21.4993 26.9489 21.0515 27.2402 20.6356C27.8208 19.8064 28.7838 19.0441 30.0845 18.9895C31.4313 18.9329 32.4377 19.7877 33.0577 20.6948C33.3723 21.1551 33.606 21.6531 33.7527 22.1111C33.8954 22.5568 33.971 23.013 33.9211 23.3776C33.898 23.5467 33.7901 23.6924 33.6351 23.7638C33.4801 23.8353 33.2993 23.8228 33.1556 23.7305C32.7563 23.4741 32.3365 23.1232 31.9487 22.799C31.7721 22.6513 31.602 22.5092 31.4436 22.3841C30.8813 21.94 30.4438 21.687 30.081 21.6692C29.7365 21.6523 29.3381 21.8499 28.8365 22.2253C28.6571 22.3595 28.483 22.5016 28.3026 22.6487L28.3013 22.6498C28.2375 22.7019 28.1729 22.7545 28.107 22.8078C27.8632 23.0046 27.6036 23.2069 27.342 23.3652C27.2139 23.4426 27.058 23.4586 26.9169 23.4089C26.7758 23.3591 26.6644 23.2488 26.6132 23.1081Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24 42C33.9411 42 42 33.9411 42 24C42 14.0589 33.9411 6 24 6C14.0589 6 6 14.0589 6 24C6 33.9411 14.0589 42 24 42ZM24 40C32.8366 40 40 32.8366 40 24C40 15.1634 32.8366 8 24 8C15.1634 8 8 15.1634 8 24C8 32.8366 15.1634 40 24 40Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );