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="M14.8073 23.2328C14.1242 22.7954 13.6237 22.0879 13.7428 21.3502C13.7667 21.2025 13.8554 21.0732 13.9847 20.9979C14.114 20.9225 14.2702 20.909 14.4105 20.9611C16.2287 21.6362 18.2567 21.2174 20.0526 19.5127C20.1764 19.3951 20.3517 19.3489 20.5174 19.39C20.6831 19.4312 20.8163 19.5541 20.8707 19.7159C21.1024 20.4047 20.8948 21.3341 20.3905 22.0976C19.8685 22.8878 18.983 23.5791 17.737 23.763C16.5386 23.9399 15.521 23.69 14.8073 23.2328Z" fill="black"/>
<path d="M32.7542 23.2328C33.4373 22.7954 33.9377 22.0879 33.8187 21.3502C33.7948 21.2025 33.7061 21.0732 33.5768 20.9979C33.4475 20.9225 33.2913 20.909 33.151 20.9611C31.3327 21.6362 29.3048 21.2174 27.5089 19.5127C27.3851 19.3951 27.2098 19.3489 27.0441 19.39C26.8784 19.4312 26.7452 19.5541 26.6907 19.7159C26.459 20.4047 26.6666 21.3341 27.171 22.0976C27.693 22.8878 28.5785 23.5791 29.8244 23.763C31.0229 23.9399 32.0404 23.69 32.7542 23.2328Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.3956 31.1707C17.21 31.4554 17.0619 31.8207 16.9647 32.1763C16.8668 32.534 16.7972 32.9661 16.8294 33.3898C16.8599 33.7906 17.0007 34.3807 17.528 34.7669C18.0781 35.1698 18.7399 35.1299 19.2997 34.954L19.3077 34.9515L19.3156 34.9489C21.7525 34.1383 22.9141 33.8152 24.0292 33.8215C25.1481 33.8278 26.2832 34.1646 28.6775 34.9467C29.1837 35.1245 29.8105 35.1624 30.3332 34.7525C30.8033 34.3839 30.9354 33.8401 30.9733 33.4844C31.0145 33.0978 30.9714 32.6991 30.8976 32.3605C30.8245 32.0247 30.7049 31.6734 30.541 31.3877C30.4548 31.2374 30.3132 31.0509 30.2627 30.9846C30.2539 30.973 30.2479 30.9651 30.2454 30.9616C28.9392 29.1388 26.5375 28 23.892 28C21.1503 28 18.664 29.2248 17.3956 31.1707ZM18.8323 33.3016C18.8334 33.3059 18.8342 33.3077 18.8342 33.3077C18.8342 33.3077 18.8337 33.3041 18.8315 33.2983C18.8318 33.2995 18.832 33.3006 18.8323 33.3016ZM18.8938 32.7038C18.8646 32.8107 18.8448 32.9117 18.8335 33.0016C21.1224 32.2422 22.5703 31.8133 24.0405 31.8216C25.4623 31.8296 26.8483 32.2476 28.9711 32.9388C28.9641 32.8899 28.9549 32.8387 28.9434 32.7861C28.9001 32.5869 28.8403 32.4424 28.8062 32.3828C28.7873 32.3499 28.777 32.3367 28.7525 32.3051C28.7287 32.2745 28.6913 32.2265 28.6198 32.1266C27.7499 30.9128 26.0046 30 23.892 30C21.6974 30 19.905 30.9834 19.071 32.2629C19.0299 32.326 18.9537 32.485 18.8938 32.7038ZM28.9747 33.3317C28.9727 33.3372 28.9721 33.3405 28.9721 33.3405C28.9721 33.3405 28.9737 33.3373 28.9756 33.3292C28.9753 33.3301 28.9749 33.3309 28.9747 33.3317Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M42 24C42 33.9411 33.9411 42 24 42C14.0589 42 6 33.9411 6 24C6 14.0589 14.0589 6 24 6C33.9411 6 42 14.0589 42 24ZM40 24C40 32.8366 32.8366 40 24 40C15.1634 40 8 32.8366 8 24C8 15.1634 15.1634 8 24 8C32.8366 8 40 15.1634 40 24Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );