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="24" height="24" viewBox="0 0 24 24" stroke-width="1.5" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.75 22C19.75 22.4142 19.4142 22.75 19 22.75H5C4.58579 22.75 4.25 22.4142 4.25 22C4.25 21.5858 4.58579 21.25 5 21.25H6.25V19C6.25 18.5858 6.58579 18.25 7 18.25C7.41421 18.25 7.75 18.5858 7.75 19V21.25H19C19.4142 21.25 19.75 21.5858 19.75 22Z" fill="currentColor"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.75 16C19.75 16.4142 19.4142 16.75 19 16.75H10C9.58579 16.75 9.25 16.4142 9.25 16C9.25 15.5858 9.58579 15.25 10 15.25L19 15.25C19.4142 15.25 19.75 15.5858 19.75 16Z" fill="currentColor"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.75 2C16.75 2.41421 16.4142 2.75 16 2.75L12 2.75C11.5858 2.75 11.25 2.41421 11.25 2C11.25 1.58579 11.5858 1.25 12 1.25L16 1.25C16.4142 1.25 16.75 1.58579 16.75 2Z" fill="currentColor"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.75 7C12.75 7.41421 12.4142 7.75 12 7.75C10.5575 7.75 9.49686 7.99535 8.81093 8.4853C8.17542 8.93923 7.75 9.68494 7.75 11V13C7.75 13.4142 7.41421 13.75 7 13.75C6.58579 13.75 6.25 13.4142 6.25 13V11C6.25 9.31506 6.82458 8.06077 7.93907 7.2647C9.00314 6.50465 10.4425 6.25 12 6.25C12.4142 6.25 12.75 6.58579 12.75 7Z" fill="currentColor"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.75 11.4C16.75 12.1456 16.1456 12.75 15.4 12.75H12.6C11.8544 12.75 11.25 12.1456 11.25 11.4V4.6C11.25 3.85442 11.8544 3.25 12.6 3.25H15.4C16.1456 3.25 16.75 3.85442 16.75 4.6V11.4Z" fill="currentColor"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.75 16C10.75 13.9289 9.07107 12.25 7 12.25C4.92893 12.25 3.25 13.9289 3.25 16C3.25 18.0711 4.92893 19.75 7 19.75C9.07107 19.75 10.75 18.0711 10.75 16Z" fill="currentColor"/>
</svg>
''',
      colorFilter:
          color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
      width: width,
      height: height,
    );