build method
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:
- the fields of the widget, which themselves must not change over time, and
- any ambient state obtained from the
context
using BuildContext.dependOnInheritedWidgetOfExactType.
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="M13.8064 14.0986C13.8064 14.0991 13.8064 14.0997 13.8065 14.1002C13.8079 14.1213 13.8119 14.171 13.8225 14.2453C13.8438 14.3942 13.891 14.6388 13.994 14.9481C14.1979 15.5597 14.6262 16.4429 15.5432 17.3599L19.2799 21.0967L8.82833 31.5483L9.97893 32.6989L24.8953 26.9618L33.1612 33.1612L26.9618 24.8953L32.6989 9.97893L31.5483 8.82833L21.0967 19.2799L17.3599 15.5432C16.4429 14.6262 15.5597 14.1979 14.9481 13.994C14.6388 13.891 14.3942 13.8438 14.2453 13.8225C14.171 13.8119 14.1213 13.8079 14.1002 13.8065C14.0997 13.8064 14.0991 13.8064 14.0986 13.8064H13.8064V14.0986ZM16.4515 7.1612C17.6128 5.99991 18.7741 7.1612 17.6128 8.32249L14.1289 11.8064C14.1289 11.8064 14.2976 11.8064 14.5894 11.8518C14.9876 11.9138 15.6151 12.0604 16.3567 12.407C17.0885 12.7492 17.9313 13.2861 18.7741 14.1289L21.0967 16.4515L30.1341 7.41412C30.9151 6.63307 32.1815 6.63307 32.9625 7.41412L34.1131 8.56472C34.672 9.1236 34.8493 9.9592 34.5656 10.6969L29.2257 24.5806L36.1935 33.8709L40.2233 31.8559C40.5908 31.6722 41.0345 31.7442 41.325 32.0347C41.6978 32.4074 41.6978 33.0117 41.325 33.3845L33.3845 41.325C33.0117 41.6978 32.4074 41.6978 32.0347 41.325C31.7442 41.0346 31.6722 40.5908 31.8559 40.2233L33.8709 36.1935L24.5805 29.2257L10.6969 34.5656C9.95919 34.8493 9.1236 34.672 8.56472 34.1131L7.41412 32.9625C6.63307 32.1815 6.63307 30.9151 7.41412 30.1341L16.4515 21.0967L14.1289 18.7741C13.2861 17.9313 12.7492 17.0885 12.407 16.3567C12.0604 15.6151 11.9138 14.9876 11.8518 14.5894C11.8064 14.2976 11.8064 14.1289 11.8064 14.1289L8.32249 17.6128C7.1612 18.7741 5.99991 17.6128 7.1612 16.4515L16.4515 7.1612Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);