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 4C24.5523 4 25 4.44772 25 5V8.45455C25 8.79457 24.942 9.13383 24.8268 9.45399C24.7117 9.77416 24.54 10.0734 24.3158 10.3316C24.0913 10.59 23.8172 10.8038 23.5047 10.9529C23.1915 11.1023 22.8497 11.1818 22.5002 11.1818H20.2589L20.2389 11.1816C19.0077 11.157 17.7858 11.656 16.8135 12.6284C15.8397 13.6023 15.1911 14.9802 15.0243 16.5086C14.9542 17.3448 15.0364 18.1876 15.2642 18.9816C15.493 19.7789 15.8618 20.5037 16.3404 21.1118C16.8187 21.7196 17.394 22.195 18.0235 22.5164C18.2493 22.6316 18.7551 22.7627 19.4071 22.8613C20.0262 22.9549 20.6417 23 21.0004 23C21.5527 23.0001 22.0004 23.4478 22.0003 24.0001C22.0003 24.5524 21.5525 25.0001 21.0002 25C20.5214 25 19.804 24.944 19.1082 24.8388C18.4452 24.7386 17.654 24.5733 17.1141 24.2976C16.2123 23.8372 15.4153 23.1703 14.7687 22.3487C14.1223 21.5274 13.6385 20.5674 13.3417 19.5331C13.045 18.4988 12.9402 17.4074 13.0325 16.3274L13.0346 16.3056C13.2443 14.3561 14.0749 12.5388 15.3992 11.2143C16.7248 9.88855 18.457 9.14858 20.2684 9.18182H22.5002C22.5445 9.18182 22.5928 9.17199 22.6436 9.14777C22.695 9.12325 22.7515 9.0826 22.8056 9.02026C22.86 8.95768 22.9093 8.87605 22.9448 8.7771C22.9804 8.67813 23 8.56818 23 8.45455V5C23 4.44772 23.4477 4 24 4Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.1141 23.7024C15.0167 23.2416 16.0003 23.0001 17.0002 23C17.5525 22.9999 18.0003 23.4476 18.0003 23.9999C18.0004 24.5522 17.5527 24.9999 17.0004 25C16.3252 25.0001 15.6523 25.1626 15.0235 25.4836C14.394 25.805 13.8187 26.2804 13.3404 26.8882C12.8618 27.4963 12.493 28.2211 12.2642 29.0184C12.0364 29.8124 11.9542 30.6552 12.0243 31.4914C12.1911 33.0198 12.8397 34.3977 13.8135 35.3716C14.2229 35.7811 14.9525 36.1621 15.8381 36.4358C16.708 36.7047 17.6014 36.8311 18.2389 36.8184L18.2589 36.8182H22.5002C22.8497 36.8182 23.1915 36.8977 23.5047 37.0471C23.8172 37.1962 24.0913 37.41 24.3158 37.6684C24.54 37.9266 24.7117 38.2258 24.8268 38.546C24.942 38.8662 25 39.2054 25 39.5455V43C25 43.5523 24.5523 44 24 44C23.4477 44 23 43.5523 23 43V39.5455C23 39.4318 22.9804 39.3219 22.9448 39.2229C22.9093 39.124 22.86 39.0423 22.8056 38.9797C22.7515 38.9174 22.695 38.8767 22.6436 38.8522C22.5928 38.828 22.5445 38.8182 22.5002 38.8182H18.2684C17.3844 38.8344 16.2814 38.6662 15.2474 38.3466C14.2251 38.0306 13.14 37.5266 12.3992 36.7857C11.0749 35.4612 10.2443 33.6439 10.0346 31.6944L10.0325 31.6726C9.9402 30.5926 10.045 29.5012 10.3417 28.4669C10.6385 27.4326 11.1223 26.4726 11.7687 25.6513C12.4153 24.8297 13.2123 24.1628 14.1141 23.7024Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M31.003 4C31.5553 4 32.003 4.44772 32.003 5V10.1816C32.0032 11.2022 31.8288 12.2156 31.4874 13.1646C31.146 14.1136 30.6426 14.9842 30.0001 15.7236C29.8265 15.9234 29.6267 16.1314 29.4094 16.3366C31.0698 16.4329 32.8619 16.7241 34.3796 17.5088C35.4115 18.0423 36.3328 18.8116 36.9897 19.9065C37.6456 20.9998 38.0001 22.3544 38.0001 24C38.0001 25.6409 37.6565 26.992 37.018 28.0838C36.3779 29.1785 35.4774 29.9506 34.4633 30.4869C32.9265 31.2998 31.1003 31.5847 29.419 31.6719C29.6227 31.8662 29.8159 32.0693 29.9975 32.2784C31.2915 33.7689 31.999 35.7633 31.9986 37.8182V43C31.9986 43.5523 31.5509 44 30.9986 44C30.4463 44 29.9986 43.5523 29.9986 43V37.8182C29.9989 36.2098 29.443 34.6904 28.4873 33.5896C27.4766 32.4255 26.2032 31.7066 24.9995 31.7059C24.4474 31.7056 24 31.2578 24.0001 30.7056C24.0003 30.1534 24.4479 29.7059 25.0001 29.7059H27.9972C29.9752 29.7059 32.0095 29.5222 33.5282 28.719C34.2659 28.3288 34.8675 27.7994 35.2916 27.0742C35.7173 26.3462 36.0001 25.3591 36.0001 24C36.0001 22.6456 35.7106 21.662 35.2747 20.9354C34.8397 20.2105 34.2212 19.6783 33.4611 19.2854C31.8984 18.4774 29.8138 18.2941 27.8153 18.2941H24.8182C24.266 18.294 23.8182 17.8462 23.8182 17.294C23.8183 16.7417 24.266 16.2941 24.8182 16.2941H24.8209C25.4559 16.2939 26.089 16.1502 26.6855 15.8659C27.2539 15.595 27.9926 14.9848 28.4904 14.4119C28.9628 13.8681 29.3437 13.2152 29.6055 12.4876C29.8673 11.7599 30.0032 10.9761 30.003 10.182V5C30.003 4.44772 30.4507 4 31.003 4Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M16 24C16 23.4477 16.4479 23 17.0002 23H30C30.5523 23 31 23.4477 31 24C31 24.5523 30.5523 25 30 25H17.0004C16.4481 25 16 24.5523 16 24Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M22 17.2942C22 16.7419 22.4477 16.2942 23 16.2942H25C25.5523 16.2942 26 16.7419 26 17.2942C26 17.8464 25.5523 18.2942 25 18.2942H23C22.4477 18.2942 22 17.8464 22 17.2942Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M17 30.7058C17 30.1536 17.4477 29.7058 18 29.7058L25.0001 29.7059C25.5524 29.7059 26 30.1536 26 30.7058C26 31.2581 25.5518 31.7059 24.9995 31.7059L18 31.7058C17.4477 31.7058 17 31.2581 17 30.7058Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );