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="M34.767 35.8353C31.9246 38.4227 28.1465 40 24 40C20.8342 40 17.8832 39.0806 15.3994 37.4942C15.0971 38.1029 14.6911 38.6479 14.2054 39.1044C17.0242 40.936 20.3879 42 24 42C29.0603 42 33.6328 39.9119 36.9031 36.5503C36.1321 36.4646 35.4089 36.2147 34.767 35.8353Z" fill="black"/>
<path d="M41.8146 26.5931C41.9368 25.7464 42 24.8806 42 24C42 14.0589 33.9411 6 24 6C14.0589 6 6 14.0589 6 24C6 25.8967 6.29336 27.7249 6.83719 29.4417C7.32113 28.6605 7.84761 27.9454 8.34656 27.3279C8.11946 26.2544 8 25.1411 8 24C8 15.1634 15.1634 8 24 8C32.7582 8 39.8728 15.0369 39.9983 23.7653C40.631 24.588 41.2816 25.5509 41.8146 26.5931Z" fill="black"/>
<path d="M13.7428 20.3502C13.6237 21.0879 14.1242 21.7954 14.8073 22.2328C15.521 22.69 16.5386 22.9399 17.737 22.763C18.983 22.5791 19.8685 21.8878 20.3905 21.0976C20.8948 20.3341 21.1024 19.4047 20.8707 18.7159C20.8163 18.5541 20.6831 18.4312 20.5174 18.39C20.3517 18.3489 20.1764 18.3951 20.0526 18.5127C18.2567 20.2174 16.2287 20.6362 14.4105 19.9611C14.2702 19.909 14.114 19.9225 13.9847 19.9979C13.8554 20.0732 13.7667 20.2025 13.7428 20.3502Z" fill="black"/>
<path d="M33.8187 20.3502C33.9377 21.0879 33.4373 21.7954 32.7542 22.2328C32.0404 22.69 31.0229 22.9399 29.8244 22.763C28.5785 22.5791 27.693 21.8878 27.171 21.0976C26.6666 20.3341 26.459 19.4047 26.6907 18.7159C26.7452 18.5541 26.8784 18.4312 27.0441 18.39C27.2098 18.3489 27.3851 18.3951 27.5089 18.5127C29.3048 20.2174 31.3327 20.6362 33.151 19.9611C33.2913 19.909 33.4475 19.9225 33.5768 19.9979C33.7061 20.0732 33.7948 20.2025 33.8187 20.3502Z" fill="black"/>
<path d="M41 30.7273C41 32.5348 39.433 34 37.5 34C35.567 34 34 32.5348 34 30.7273C34 27.8636 37.5 25 37.5 25C37.5 25 41 27.8636 41 30.7273Z" fill="black"/>
<path d="M10.5 38C12.433 38 14 36.5348 14 34.7273C14 31.8636 10.5 29 10.5 29C10.5 29 7 31.8636 7 34.7273C7 36.5348 8.567 38 10.5 38Z" fill="black"/>
<path d="M31.4065 33C30.0305 29.4383 27.2304 27 24 27C20.7695 27 17.9694 29.4383 16.5935 33C16.2061 34.0028 17.0133 35 18.0883 35L29.9116 35C30.9866 35 31.7939 34.0028 31.4065 33Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );