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="M14.698 29.3103C13.3292 27.7399 11.0369 24.3692 11.0004 20.046C9.37497 19.8203 7.96011 19.5407 6.90689 19.1989C6.3859 19.0299 5.83306 18.8081 5.37048 18.4979C4.99757 18.2477 4.12207 17.5607 4.12207 16.3433C4.12207 15.126 4.99757 14.4389 5.37048 14.1888C5.83306 13.8785 6.3859 13.6568 6.90689 13.4877C7.9764 13.1407 9.41884 12.8577 11.076 12.6302C11.3012 12.5993 11.5318 12.5693 11.7677 12.54C11.1667 13.3346 10.6049 14.1069 10.2221 14.7813C9.28649 14.9362 8.48727 15.1072 7.84965 15.2907C7.8171 15.3001 7.78497 15.3095 7.75327 15.319C6.70615 15.6306 6.12207 15.9776 6.12207 16.3433C6.12207 16.7091 6.70615 17.0561 7.75327 17.3677C7.78497 17.3772 7.8171 17.3866 7.84965 17.3959C8.70174 17.6412 9.84241 17.864 11.2114 18.0561C11.5177 16.6423 12.1849 15.0602 13.3906 13.6681C15.2076 11.5703 18.1646 10 22.6704 10C24.9378 10 26.6467 10.2886 28.0399 10.8294C29.4444 11.3746 30.4647 12.1516 31.3788 13.0293C31.4485 13.0962 31.5201 13.1638 31.5929 13.2325C32.1852 13.7916 32.8549 14.4237 33.1923 15.3546C33.4972 16.1957 33.8824 17.2303 34.3005 18.3398C36.7656 18.0989 38.7655 17.7742 40.0793 17.3959C40.1119 17.3866 40.144 17.3772 40.1757 17.3677C41.2228 17.0561 41.8069 16.7091 41.8069 16.3433C41.8069 15.9776 41.2228 15.6306 40.1757 15.319C40.144 15.3095 40.1119 15.3001 40.0793 15.2907C39.5093 15.1266 38.8102 14.9726 38 14.8311V17.5L34 14L38 10V12.8026C39.177 12.9963 40.2077 13.2235 41.0221 13.4877C41.5431 13.6568 42.0959 13.8785 42.5585 14.1888C42.9314 14.4389 43.8069 15.126 43.8069 16.3433C43.8069 17.5607 42.9314 18.2477 42.5585 18.4979C42.0959 18.8081 41.5431 19.0299 41.0221 19.1989C39.9526 19.546 38.5101 19.829 36.8529 20.0564C36.2809 20.135 35.6733 20.2081 35.0342 20.2755C35.6697 21.9443 36.3181 23.6286 36.8371 24.9715C37.5146 26.7244 36.4363 28.5964 34.7018 28.9848V31.0186C34.7018 32.6754 33.3587 34.0186 31.7018 34.0186H28.7165V38H26.7165V32.0186H31.7018C32.2541 32.0186 32.7018 31.5709 32.7018 31.0186V27.0578H34.0354C34.7404 27.0578 35.2256 26.3499 34.9716 25.6925C34.3992 24.2114 33.6665 22.3075 32.9663 20.4645C30.2948 20.6742 27.2219 20.7923 23.9645 20.7923C19.8785 20.7923 16.083 20.6066 13.0058 20.2871C13.1321 24.0642 15.2962 27.0266 16.4302 28.2459L16.698 28.5337V38H14.698V29.3103ZM14.9024 14.9775C13.9911 16.0297 13.4668 17.2246 13.2075 18.2974C16.1984 18.608 19.9246 18.7923 23.9645 18.7923C26.9469 18.7923 29.7585 18.6919 32.2293 18.5143C31.8858 17.5991 31.5706 16.7495 31.3121 16.0362C31.1444 15.5738 30.8354 15.278 30.1695 14.6405L29.9935 14.4719C29.2034 13.7132 28.401 13.1149 27.3162 12.6939C26.2203 12.2685 24.7733 12 22.6704 12C18.673 12 16.2948 13.3698 14.9024 14.9775Z" fill="black"/>
</svg>
''',
colorFilter:
color != null ? widgets.ColorFilter.mode(color!, widgets.BlendMode.srcIn) : null,
width: width,
height: height,
);