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 fill-rule="evenodd" clip-rule="evenodd" d="M24.1188 9.00123C24.09 9.00041 24.0611 9 24.0321 9H23.9679C23.939 9 23.9101 9.00041 23.8813 9.00123C18.9774 9.08154 15 13.0645 15 18C15 19.6569 16.3432 21 18 21C19.6569 21 21 19.6569 21 18C21 16.3679 22.3263 15.0172 24 15.0002C25.6737 15.0172 27 16.3679 27 18C27 19.6425 25.6568 21 23.9679 21C22.3111 21 20.9679 22.3431 20.9679 24V28C20.9679 29.6569 22.3111 31 23.9679 31C25.6248 31 26.9679 29.6569 26.9679 28V26.491C30.4739 25.2605 33 21.9332 33 18C33 13.0645 29.0226 9.08154 24.1188 9.00123ZM24.0321 11C24.043 11 24.0538 11.0002 24.0646 11.0005L24.0803 11.0009C27.9076 11.0605 31 14.1668 31 18C31 21.2662 28.7549 24.0059 25.7204 24.7809C25.2777 24.894 24.9679 25.2928 24.9679 25.7498V28C24.9679 28.5523 24.5202 29 23.9679 29C23.4156 29 22.9679 28.5523 22.9679 28V24C22.9679 23.4477 23.4156 23 23.9679 23C26.7529 23 29 20.7556 29 18C29 15.2575 26.7743 13.0215 24.0077 13.0002H23.9923C21.2257 13.0215 19 15.2575 19 18C19 18.5523 18.5523 19 18 19C17.4478 19 17 18.5523 17 18C17 14.1668 20.0925 11.0605 23.9197 11.0009L23.9355 11.0005C23.9462 11.0002 23.957 11 23.9679 11H24.0321Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24 35C23.4477 35 23 35.4477 23 36C23 36.5523 23.4477 37 24 37C24.5523 37 25 36.5523 25 36C25 35.4477 24.5523 35 24 35ZM21 36C21 34.3431 22.3431 33 24 33C25.6569 33 27 34.3431 27 36C27 37.6569 25.6569 39 24 39C22.3431 39 21 37.6569 21 36Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );