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 20.0002C12.4477 20.0002 12 20.4479 12 21.0002C12 21.5525 12.4477 22.0002 13 22.0002H14V26.0002H13C12.4477 26.0002 12 26.4479 12 27.0002C12 27.5525 12.4477 28.0002 13 28.0002H17C17.5523 28.0002 18 27.5525 18 27.0002C18 26.4479 17.5523 26.0002 17 26.0002H16V22.0002H17C17.5523 22.0002 18 21.5525 18 21.0002C18 20.4479 17.5523 20.0002 17 20.0002H13Z" fill="black"/>
<path d="M25.8557 22.3698C25.548 22.0622 25.156 21.8526 24.7292 21.7677C24.3025 21.6829 23.8601 21.7264 23.4581 21.8929C23.0561 22.0595 22.7126 22.3414 22.4708 22.7032C22.2291 23.065 22.1 23.4904 22.1 23.9255C22.1 24.3606 22.2291 24.7859 22.4708 25.1477C22.7126 25.5095 23.0561 25.7915 23.4581 25.958C23.8601 26.1245 24.3025 26.1681 24.7292 26.0832C25.156 25.9983 25.548 25.7888 25.8557 25.4811C26.2462 25.0906 26.8794 25.0906 27.2699 25.4811C27.6604 25.8716 27.6604 26.5048 27.2699 26.8953C26.6825 27.4827 25.9341 27.8827 25.1194 28.0448C24.3047 28.2068 23.4602 28.1237 22.6928 27.8058C21.9253 27.4879 21.2694 26.9496 20.8079 26.2589C20.3464 25.5682 20.1 24.7562 20.1 23.9255C20.1 23.0948 20.3464 22.2828 20.8079 21.5921C21.2694 20.9014 21.9253 20.3631 22.6928 20.0452C23.4602 19.7273 24.3047 19.6441 25.1194 19.8062C25.9342 19.9682 26.6825 20.3682 27.2699 20.9556C27.6604 21.3462 27.6604 21.9793 27.2699 22.3698C26.8794 22.7604 26.2462 22.7604 25.8557 22.3698Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M31 20.0002C30.4477 20.0002 30 20.4479 30 21.0002V27.0002C30 27.5525 30.4477 28.0002 31 28.0002H33C35.2091 28.0002 37 26.2093 37 24.0002C37 21.791 35.2091 20.0002 33 20.0002H31ZM32 26.0002V22.0002H33C34.1046 22.0002 35 22.8956 35 24.0002C35 25.1048 34.1046 26.0002 33 26.0002H32Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 9.00018C6 7.34333 7.34315 6.00018 9 6.00018H39C40.6569 6.00018 42 7.34333 42 9.00018V39.0002C42 40.657 40.6569 42.0002 39 42.0002H9C7.34315 42.0002 6 40.657 6 39.0002V9.00018ZM9 8.00018H39C39.5523 8.00018 40 8.4479 40 9.00018V39.0002C40 39.5525 39.5523 40.0002 39 40.0002H9C8.44772 40.0002 8 39.5525 8 39.0002V9.00018C8 8.4479 8.44771 8.00018 9 8.00018Z" fill="black"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );