A flutter Thermometer widget.
![Screenshot1](./images/screenshot1.gif) ![Screenshot2](./images/screenshot2.gif) ![Screenshot3](./images/screenshot3.gif)
Add a dependency to
dependencies: flutter_thermometer: ^1.0.0
For basic usage, three parameters are required:
value. The widget
must be instantiated within a fully constrained size container. In the follwing example, a
SizedBox is used:
SizedBox( width: thermoWidth, height: thermoHeight, child: Thermometer( value: value, minValue: minValue, maxValue: maxValue ) )
Anatomy of the thermometer widget
The thermometer widget is made of several elements: - An outline, which is characterized by `thickness`, `radius`, `barWidth` and `outlineColor` parameters. - A Mercury bar which whose height designates the temperature. Its color is controlled bt the `mercuryColor` parameter. - An optional scale. - An optional label. - An optional setpoint.
The thermometer scale comprises a set of ticks, usually shown on the left side of the thermometer, but
can be also set to be shown on the right side. The scale is provided by a class implementing the
ScaleProvider interface. Given a minimum and a maximum value, a
ScaleProvider computes a list of
ticks that are drawn on the widget. Each tick can have specific color, length and label. The package
comes with a single implementaion -
IntervalScaleProvider. This implementation places ticks at constant
interval, starting from the minimum temperature. All the ticks have the same color, length and a temperature
value as a text label.
Custom implementation can be used to show other kind of scales, for example one that has minor and major ticks.
The label is shown on the upper side of the thermometer widget, on the side opposite to the scale. It is usually
used to denote the unit of measurement shown by the thermometer. A label is created by providing an
ThermometerLabel to the widget. For convenience, two labels are provided by the package - degrees
Celsius and degrees Farenheit, but any other custom label can be created and styled.
A setpoint is a small triangle (or two triangles) denoting a target temperature. A setpoint is created by
Setpoint instance to the widget. The setpoint can be configured for value (temperature),
color, size and side - either on the left side, the right side or both.
The project is licensed under the MIT license. See the LICENSE file for details.