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="M20 14V12C20 10.8954 19.1046 10 18 10C16.8954 10 16 10.8954 16 12V14H20Z" fill="black"/>
<path d="M20 16H16V25C16 26.1046 16.8954 27 18 27C19.1046 27 20 26.1046 20 25V16Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 6C10 4.89543 10.8954 4 12 4H24C25.1046 4 26 4.89543 26 6V42C26 43.1046 25.1046 44 24 44H12C10.8954 44 10 43.1046 10 42V6ZM20 38C20 39.1046 19.1046 40 18 40C16.8954 40 16 39.1046 16 38C16 36.8954 16.8954 36 18 36C19.1046 36 20 36.8954 20 38ZM18 31C17.1716 31 16.5 31.6716 16.5 32.5C16.5 33.3284 17.1716 34 18 34C18.8284 34 19.5 33.3284 19.5 32.5C19.5 31.6716 18.8284 31 18 31ZM18 8C15.7909 8 14 9.79086 14 12V25C14 27.2091 15.7909 29 18 29C20.2091 29 22 27.2091 22 25V12C22 9.79086 20.2091 8 18 8Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M31.5927 8.02626C31.3453 7.97376 31.0882 8.00001 30.8507 8.10497C30.6123 8.21034 30.3979 8.39359 30.2424 8.64184C30.0866 8.89065 30 9.18945 30 9.5C30 9.81056 30.0866 10.1094 30.2424 10.3582C30.3979 10.6064 30.6123 10.7897 30.8507 10.895C31.0882 11 31.3453 11.0262 31.5927 10.9738C31.8406 10.9211 32.0778 10.7893 32.2704 10.5839C32.6481 10.181 33.2809 10.1605 33.6838 10.5381C34.0868 10.9158 34.1073 11.5487 33.7296 11.9516C33.2668 12.4455 32.669 12.7899 32.0079 12.9302C31.3462 13.0706 30.6611 12.9978 30.0422 12.7244C29.4244 12.4513 28.9068 11.9937 28.5474 11.4197C28.1883 10.8463 28 10.1784 28 9.5C28 8.82165 28.1883 8.15375 28.5474 7.58032C28.9068 7.00632 29.4244 6.54871 30.0422 6.27565C30.6611 6.00217 31.3462 5.92939 32.0079 6.06983C32.669 6.21013 33.2668 6.55455 33.7296 7.04839C34.1073 7.45135 34.0868 8.08418 33.6838 8.46186C33.2809 8.83954 32.6481 8.81905 32.2704 8.41609C32.0778 8.21066 31.8406 8.07888 31.5927 8.02626Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M28.5 15C28.5 14.4477 28.9477 14 29.5 14H33.5C34.0523 14 34.5 14.4477 34.5 15C34.5 15.5523 34.0523 16 33.5 16H32.5V20C32.5 20.5523 32.0523 21 31.5 21C30.9477 21 30.5 20.5523 30.5 20V16H29.5C28.9477 16 28.5 15.5523 28.5 15Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M30.5 27C30.2239 27 30 27.2239 30 27.5C30 27.7761 30.2239 28 30.5 28H31.5C32.8807 28 34 29.1193 34 30.5C34 31.8807 32.8807 33 31.5 33H30.5C29.4099 33 28.4852 32.3029 28.1425 31.3332C27.9585 30.8125 28.2314 30.2412 28.7521 30.0572C29.2728 29.8731 29.8441 30.146 30.0282 30.6668C30.0973 30.8623 30.2839 31 30.5 31H31.5C31.7761 31 32 30.7761 32 30.5C32 30.2239 31.7761 30 31.5 30H30.5C29.1193 30 28 28.8807 28 27.5C28 26.1193 29.1193 25 30.5 25H31.5C32.5901 25 33.5148 25.6971 33.8575 26.6668C34.0415 27.1875 33.7686 27.7588 33.2479 27.9428C32.7272 28.1269 32.1559 27.854 31.9718 27.3332C31.9027 27.1377 31.7161 27 31.5 27H30.5Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M30.5 36C30.2239 36 30 36.2239 30 36.5C30 36.7761 30.2239 37 30.5 37H31.5C32.8807 37 34 38.1193 34 39.5C34 40.8807 32.8807 42 31.5 42H30.5C29.4099 42 28.4852 41.3029 28.1425 40.3332C27.9585 39.8125 28.2314 39.2412 28.7521 39.0572C29.2728 38.8731 29.8441 39.146 30.0282 39.6668C30.0973 39.8623 30.2839 40 30.5 40H31.5C31.7761 40 32 39.7761 32 39.5C32 39.2239 31.7761 39 31.5 39H30.5C29.1193 39 28 37.8807 28 36.5C28 35.1193 29.1193 34 30.5 34H31.5C32.5901 34 33.5148 34.6971 33.8575 35.6668C34.0415 36.1875 33.7686 36.7588 33.2479 36.9428C32.7272 37.1269 32.1559 36.854 31.9718 36.3332C31.9027 36.1377 31.7161 36 31.5 36H30.5Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M37.3732 25.5723C37.7519 25.7246 38 26.0919 38 26.5V31.5C38 32.0523 37.5523 32.5 37 32.5C36.4477 32.5 36 32.0523 36 31.5V28.5417C35.7509 28.5417 35.5014 28.4492 35.3075 28.2631C34.9091 27.8806 34.8961 27.2476 35.2786 26.8492L36.2786 25.8075C36.5613 25.513 36.9946 25.42 37.3732 25.5723Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );