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 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 42ZM24 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 44Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24 31C27.866 31 31 27.866 31 24C31 20.134 27.866 17 24 17C20.134 17 17 20.134 17 24C17 27.866 20.134 31 24 31ZM24 33C28.9706 33 33 28.9706 33 24C33 19.0294 28.9706 15 24 15C19.0294 15 15 19.0294 15 24C15 28.9706 19.0294 33 24 33Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.5758 28.4241C20.009 28.0503 19.5573 27.5162 19.2853 26.8862L23.8862 22.2853C24.5162 22.5573 25.0503 23.009 25.4241 23.5758L20.5758 28.4241ZM25.8105 24.361C25.9333 24.7181 26 25.1012 26 25.5C26 27.433 24.433 29 22.5 29C22.1012 29 21.7181 28.9333 21.361 28.8105L25.8105 24.361ZM22.9688 22.0311L19.0311 25.9688C19.0106 25.8155 19 25.659 19 25.5C19 23.567 20.567 22 22.5 22C22.659 22 22.8155 22.0106 22.9688 22.0311Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.4327 28.3246C19.9816 27.9938 19.6126 27.5575 19.3621 27.0521C19.3351 26.9976 19.3095 26.9423 19.2853 26.8862L23.8862 22.2853C23.9423 22.3095 23.9976 22.3351 24.0521 22.3621C24.5575 22.6126 24.9938 22.9816 25.3246 23.4327C25.3589 23.4796 25.3921 23.5273 25.4241 23.5758L20.5758 28.4241C20.5273 28.3921 20.4796 28.3589 20.4327 28.3246ZM25.8105 24.361C25.8314 24.4219 25.8507 24.4835 25.8683 24.5458C25.9541 24.8491 26 25.1692 26 25.5C26 25.529 25.9996 25.5579 25.9989 25.5868C25.9536 27.4508 24.4508 28.9536 22.5868 28.9989C22.5579 28.9996 22.529 29 22.5 29C22.1692 29 21.8491 28.9541 21.5458 28.8683C21.4835 28.8507 21.4219 28.8314 21.361 28.8105L25.8105 24.361ZM21.414 22.1718C20.3545 22.5173 19.5173 23.3545 19.1718 24.414C19.0603 24.7558 19 25.1209 19 25.5C19 25.5836 19.0029 25.6665 19.0087 25.7486C19.0139 25.8227 19.0214 25.8961 19.0311 25.9688L22.9688 22.0311C22.8961 22.0214 22.8227 22.0139 22.7486 22.0087C22.6665 22.0029 22.5836 22 22.5 22C22.1209 22 21.7558 22.0603 21.414 22.1718Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.8105 15.639C17.9333 15.2819 18 14.8988 18 14.5C18 12.567 16.433 11 14.5 11C14.1012 11 13.7181 11.0667 13.361 11.1895L17.8105 15.639ZM11.2852 13.1138C11.5572 12.4838 12.009 11.9497 12.5758 11.5759L17.4241 16.4242C17.0503 16.991 16.5162 17.4428 15.8862 17.7148L11.2852 13.1138ZM14.9688 17.9689C14.8154 17.9894 14.659 18 14.5 18C12.567 18 11 16.433 11 14.5C11 14.341 11.0106 14.1846 11.0311 14.0312L14.9688 17.9689Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M33.5759 34.4241C33.009 34.0504 32.5573 33.5162 32.2853 32.8863L36.8863 28.2853C37.5162 28.5573 38.0504 29.009 38.4241 29.5759L33.5759 34.4241ZM38.8105 30.3611C38.9333 30.7181 39 31.1013 39 31.5C39 33.433 37.433 35 35.5 35C35.1013 35 34.7181 34.9333 34.3611 34.8105L38.8105 30.3611ZM35.9689 28.0311L32.0311 31.9689C32.0106 31.8155 32 31.659 32 31.5C32 29.567 33.567 28 35.5 28C35.659 28 35.8155 28.0106 35.9689 28.0311Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M33.4328 34.3246C32.9816 33.9938 32.6126 33.5575 32.3621 33.0521C32.3351 32.9976 32.3095 32.9423 32.2853 32.8863L36.8863 28.2853C36.9423 28.3095 36.9976 28.3351 37.0521 28.3621C37.5575 28.6126 37.9938 28.9816 38.3246 29.4328C38.3589 29.4796 38.3921 29.5273 38.4241 29.5759L33.5759 34.4241C33.5273 34.3921 33.4796 34.3589 33.4328 34.3246ZM38.8105 30.3611C38.8314 30.4219 38.8507 30.4835 38.8684 30.5458C38.9541 30.8492 39 31.1692 39 31.5C39 31.529 38.9996 31.558 38.9989 31.5868C38.9536 33.4508 37.4509 34.9536 35.5868 34.9989C35.558 34.9996 35.529 35 35.5 35C35.1692 35 34.8492 34.9541 34.5458 34.8684C34.4835 34.8507 34.4219 34.8314 34.3611 34.8105L38.8105 30.3611ZM34.414 28.1717C33.3545 28.5172 32.5172 29.3545 32.1717 30.414C32.0603 30.7559 32 31.1209 32 31.5C32 31.5836 32.0029 31.6665 32.0087 31.7487C32.0139 31.8227 32.0214 31.8961 32.0311 31.9689L35.9689 28.0311C35.8961 28.0214 35.8227 28.0139 35.7487 28.0087C35.6665 28.0029 35.5836 28 35.5 28C35.1209 28 34.7559 28.0603 34.414 28.1717Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M31 13C31.5523 13 32 12.5523 32 12C32 11.4477 31.5523 11 31 11C30.4477 11 30 11.4477 30 12C30 12.5523 30.4477 13 31 13ZM31 15C32.6569 15 34 13.6569 34 12C34 10.3431 32.6569 9 31 9C29.3431 9 28 10.3431 28 12C28 13.6569 29.3431 15 31 15Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M13 33C13.5523 33 14 32.5523 14 32C14 31.4477 13.5523 31 13 31C12.4477 31 12 31.4477 12 32C12 32.5523 12.4477 33 13 33ZM13 35C14.6569 35 16 33.6569 16 32C16 30.3431 14.6569 29 13 29C11.3431 29 10 30.3431 10 32C10 33.6569 11.3431 35 13 35Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );