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="M16.1522 12.3281C13.1876 14.405 11.2455 17.8434 11.2356 21.7382C11.2342 22.2905 10.7853 22.7371 10.233 22.7357C9.68073 22.7343 9.23416 22.2854 9.23557 21.7331C9.25459 14.2677 15.322 8.23112 22.7875 8.25015C23.3397 8.25156 23.7863 8.70041 23.7849 9.2527C23.7835 9.80498 23.3346 10.2516 22.7824 10.2501C21.0368 10.2457 19.381 10.6298 17.8968 11.3209L19.0759 12.8931C21.1912 11.9034 23.6636 11.656 26.0777 12.3756C26.607 12.5334 26.9082 13.0903 26.7504 13.6196C26.5926 14.1489 26.0357 14.45 25.5064 14.2923C21.3391 13.0501 16.9539 15.4213 15.7117 19.5885C15.5539 20.1178 14.997 20.4189 14.4677 20.2612C13.9384 20.1034 13.6373 19.5465 13.795 19.0172C14.4263 16.8995 15.7048 15.1516 17.3501 13.9253L16.1522 12.3281Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M32 28C32 30.2091 30.2091 32 28 32C25.7909 32 24 30.2091 24 28C24 25.7909 25.7909 24 28 24C30.2091 24 32 25.7909 32 28ZM30 28C30 29.1046 29.1046 30 28 30C26.8954 30 26 29.1046 26 28C26 26.8954 26.8954 26 28 26C29.1046 26 30 26.8954 30 28Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M28 37C32.9706 37 37 32.9706 37 28C37 23.0294 32.9706 19 28 19C23.0294 19 19 23.0294 19 28C19 32.9706 23.0294 37 28 37ZM28 35C31.866 35 35 31.866 35 28C35 24.134 31.866 21 28 21C24.134 21 21 24.134 21 28C21 31.866 24.134 35 28 35Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.25 31.5V27.75C17.25 25.9551 15.7949 24.5 14 24.5C12.2051 24.5 10.75 25.9551 10.75 27.75V31.5C10.75 33.2949 12.2051 34.75 14 34.75C15.7949 34.75 17.25 33.2949 17.25 31.5ZM12.75 27.75C12.75 27.0596 13.3096 26.5 14 26.5C14.6904 26.5 15.25 27.0596 15.25 27.75V31.5C15.25 32.1904 14.6904 32.75 14 32.75C13.3096 32.75 12.75 32.1904 12.75 31.5V27.75Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44ZM24 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 42Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );