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="M28.7071 17.2929C28.3166 16.9024 27.6834 16.9024 27.2929 17.2929C26.9024 17.6834 26.9024 18.3166 27.2929 18.7071L29.0858 20.5L27.2929 22.2929C26.9024 22.6834 26.9024 23.3166 27.2929 23.7071C27.6834 24.0976 28.3166 24.0976 28.7071 23.7071L30.5 21.9142L32.2929 23.7071C32.6834 24.0976 33.3166 24.0976 33.7071 23.7071C34.0976 23.3166 34.0976 22.6834 33.7071 22.2929L31.9142 20.5L33.7071 18.7071C34.0976 18.3166 34.0976 17.6834 33.7071 17.2929C33.3166 16.9024 32.6834 16.9024 32.2929 17.2929L30.5 19.0858L28.7071 17.2929Z" fill="black"/>
<path d="M15.7071 17.2929C15.3166 16.9024 14.6834 16.9024 14.2929 17.2929C13.9024 17.6834 13.9024 18.3166 14.2929 18.7071L16.0858 20.5L14.2929 22.2929C13.9024 22.6834 13.9024 23.3166 14.2929 23.7071C14.6834 24.0976 15.3166 24.0976 15.7071 23.7071L17.5 21.9142L19.2929 23.7071C19.6834 24.0976 20.3166 24.0976 20.7071 23.7071C21.0976 23.3166 21.0976 22.6834 20.7071 22.2929L18.9142 20.5L20.7071 18.7071C21.0976 18.3166 21.0976 17.6834 20.7071 17.2929C20.3166 16.9024 19.6834 16.9024 19.2929 17.2929L17.5 19.0858L15.7071 17.2929Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M31 32C31 35.3137 27.866 36 24 36C20.134 36 17 35.3137 17 32C17 28.6863 20.134 26 24 26C27.866 26 31 28.6863 31 32ZM29 32C29 32.5015 28.8862 32.7633 28.7868 32.9121C28.6821 33.0688 28.4917 33.251 28.1103 33.4273C27.2668 33.8174 25.8965 34 24 34C22.1035 34 20.7332 33.8174 19.8897 33.4273C19.5083 33.251 19.3179 33.0688 19.2132 32.9121C19.1138 32.7633 19 32.5015 19 32C19 30.069 20.9382 28 24 28C27.0618 28 29 30.069 29 32Z" 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,
    );