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="M29.0681 15.5175C29.354 16.5845 30.4506 17.2176 31.5176 16.9318C32.5845 16.6459 33.2177 15.5492 32.9318 14.4823L34.8636 13.9646C35.4354 16.0985 34.1691 18.2918 32.0352 18.8636C29.9013 19.4354 27.708 18.1691 27.1362 16.0352C26.5645 13.9013 27.8308 11.708 29.9647 11.1362L30.4823 13.0681C29.4154 13.3539 28.7822 14.4506 29.0681 15.5175Z" fill="black"/>
<path d="M34.8761 19.7168C34.0516 20.9371 32.2761 21.6101 30.323 21.5212C28.3661 21.4322 26.6711 20.5989 25.9821 19.3539C25.7147 18.8707 25.1062 18.6957 24.623 18.9632C24.1398 19.2306 23.9648 19.8391 24.2322 20.3223C25.387 22.4091 27.8976 23.4129 30.232 23.5192C32.5701 23.6256 35.1715 22.852 36.5333 20.8365C36.8425 20.3789 36.7222 19.7572 36.2646 19.448C35.8069 19.1389 35.1853 19.2592 34.8761 19.7168Z" fill="black"/>
<path d="M17.567 34.7835C17.567 35.2162 17.2162 35.567 16.7835 35.567C16.3508 35.567 16 35.2162 16 34.7835H14C14 36.3208 15.2462 37.567 16.7835 37.567C18.3208 37.567 19.567 36.3208 19.567 34.7835C19.567 33.2462 18.3208 32 16.7835 32V34C17.2162 34 17.567 34.3508 17.567 34.7835Z" fill="black"/>
<path d="M19.9401 26.4229C18.1452 25.6474 16.2465 25.6474 15.0429 26.4962C14.5916 26.8145 13.9677 26.7067 13.6494 26.2554C13.3311 25.8041 13.4389 25.1801 13.8902 24.8618C15.878 23.4599 18.5847 23.6587 20.7333 24.5869C22.8785 25.5137 24.8703 27.3423 25.2104 29.7029C25.2891 30.2496 24.9098 30.7565 24.3632 30.8353C23.8166 30.9141 23.3096 30.5348 23.2308 29.9881C23.0279 28.5798 21.7383 27.1998 19.9401 26.4229Z" fill="black"/>
<path d="M18.1376 29.8154C16.9694 29.3275 15.8252 29.3409 15.1744 29.7587C14.7096 30.057 14.091 29.922 13.7927 29.4573C13.4943 28.9925 13.6293 28.3739 14.0941 28.0755C15.5271 27.1557 17.4386 27.356 18.9085 27.9699C20.3685 28.5797 21.8506 29.792 22.1433 31.4382C22.24 31.982 21.8775 32.5012 21.3338 32.5978C20.79 32.6945 20.2708 32.3321 20.1742 31.7883C20.0539 31.1121 19.3157 30.3074 18.1376 29.8154Z" fill="black"/>
<path d="M11.5 34C12.3284 34 13 33.3284 13 32.5C13 31.6715 12.3284 31 11.5 31C10.6715 31 9.99995 31.6715 9.99995 32.5C9.99995 33.3284 10.6715 34 11.5 34Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.07102 39.071C5.16578 35.1658 5.16578 28.8341 9.07102 24.9289L24.6274 9.37254C28.5326 5.46729 34.8643 5.46729 38.7695 9.37254C42.6747 13.2778 42.6747 19.6094 38.7695 23.5147L23.2132 39.071C19.3079 42.9763 12.9763 42.9763 9.07102 39.071ZM19.1213 17.7071L26.0416 10.7867C29.1658 7.66255 34.2311 7.66255 37.3553 10.7867C40.4795 13.9109 40.4795 18.9763 37.3553 22.1005L30.435 29.0208L19.1213 17.7071ZM17.7071 19.1213L10.4852 26.3431C7.36104 29.4673 7.36104 34.5326 10.4852 37.6568C13.6094 40.781 18.6747 40.781 21.7989 37.6568L29.0208 30.435L17.7071 19.1213Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );