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="M13 12.0001C12.4477 12.0001 12 12.4478 12 13.0001C12 13.5524 12.4477 14.0001 13 14.0001H14V18.0001H13C12.4477 18.0001 12 18.4478 12 19.0001C12 19.5524 12.4477 20.0001 13 20.0001H17C17.5523 20.0001 18 19.5524 18 19.0001C18 18.4478 17.5523 18.0001 17 18.0001H16V14.0001H17C17.5523 14.0001 18 13.5524 18 13.0001C18 12.4478 17.5523 12.0001 17 12.0001H13Z" fill="black"/>
<path d="M25.8557 14.3698C25.548 14.0621 25.156 13.8525 24.7292 13.7677C24.3025 13.6828 23.8601 13.7263 23.4581 13.8929C23.0561 14.0594 22.7126 14.3413 22.4708 14.7031C22.2291 15.0649 22.1 15.4903 22.1 15.9254C22.1 16.3605 22.2291 16.7859 22.4708 17.1476C22.7126 17.5094 23.0561 17.7914 23.4581 17.9579C23.8601 18.1244 24.3025 18.168 24.7292 18.0831C25.156 17.9982 25.548 17.7887 25.8557 17.481C26.2462 17.0905 26.8794 17.0905 27.2699 17.481C27.6604 17.8715 27.6604 18.5047 27.2699 18.8952C26.6825 19.4826 25.9341 19.8826 25.1194 20.0447C24.3047 20.2067 23.4602 20.1236 22.6928 19.8057C21.9253 19.4878 21.2694 18.9495 20.8079 18.2588C20.3464 17.5681 20.1 16.7561 20.1 15.9254C20.1 15.0947 20.3464 14.2827 20.8079 13.592C21.2694 12.9013 21.9253 12.363 22.6928 12.0451C23.4602 11.7272 24.3047 11.644 25.1194 11.8061C25.9342 11.9681 26.6825 12.3682 27.2699 12.9555C27.6604 13.3461 27.6604 13.9792 27.2699 14.3698C26.8794 14.7603 26.2462 14.7603 25.8557 14.3698Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M31 12.0001C30.4477 12.0001 30 12.4478 30 13.0001V19.0001C30 19.5524 30.4477 20.0001 31 20.0001H33C35.2091 20.0001 37 18.2092 37 16.0001C37 13.791 35.2091 12.0001 33 12.0001H31ZM32 18.0001V14.0001H33C34.1046 14.0001 35 14.8955 35 16.0001C35 17.1047 34.1046 18.0001 33 18.0001H32Z" fill="black"/>
<path d="M20.3732 24.0721C20.7519 24.2245 21 24.5917 21 24.9999V34.9999C21 35.5522 20.5523 35.9999 20 35.9999C19.4477 35.9999 19 35.5522 19 34.9999V27.4855L18.7214 27.7757C18.3389 28.1742 17.7059 28.1871 17.3075 27.8046C16.9091 27.4221 16.8961 26.7891 17.2786 26.3907L19.2786 24.3074C19.5613 24.0129 19.9946 23.9198 20.3732 24.0721Z" fill="black"/>
<path d="M29 24.9999C29 24.5917 28.7519 24.2245 28.3732 24.0721C27.9946 23.9198 27.5613 24.0129 27.2786 24.3074L25.2786 26.3907C24.8961 26.7891 24.9091 27.4221 25.3075 27.8046C25.7059 28.1871 26.3389 28.1742 26.7214 27.7757L27 27.4855V34.9999C27 35.5522 27.4477 35.9999 28 35.9999C28.5523 35.9999 29 35.5522 29 34.9999V24.9999Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 9.00009C6 7.34324 7.34315 6.00009 9 6.00009H39C40.6569 6.00009 42 7.34324 42 9.00009V39.0001C42 40.6569 40.6569 42.0001 39 42.0001H9C7.34315 42.0001 6 40.6569 6 39.0001V9.00009ZM9 8.00009H39C39.5523 8.00009 40 8.44781 40 9.00009V39.0001C40 39.5524 39.5523 40.0001 39 40.0001H9C8.44772 40.0001 8 39.5524 8 39.0001V9.00009C8 8.44781 8.44771 8.00009 9 8.00009Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );