UnitRuler class

A class representing the UnitRuler, a digital tool for measuring various units like weight and length.

Inheritance

Constructors

UnitRuler({Key? key, required ValueChangedCallback onValueChanged, required double width, required ScaleUnit scaleUnit, required EdgeInsetsGeometry? scalePadding, required Alignment scaleAlignment, required Axis scrollDirection, required double scaleMarkerPositionTop, required double scaleMarkerPositionLeft, required double height, required String scaleIntervalText(int index, num rulerScaleValue), required double scaleIntervalTextPosition, double scaleMargin = 0, List<ScaleIntervalStyle> scaleIntervalStyles = const [ScaleIntervalStyle(scale: 0, color: Color.fromARGB(255, 188, 194, 203), width: 2, height: 32), ScaleIntervalStyle(color: Color.fromARGB(255, 188, 194, 203), width: 1, height: 20)], TextStyle scaleIntervalTextStyle = const TextStyle(color: Color.fromARGB(255, 188, 194, 203), fontSize: 14), Widget? scaleMarker, Color backgroundColor = Colors.white, ScaleController? controller})
Creates an instance of the UnitRuler. This constructor initializes the ruler with default settings.
const

Properties

backgroundColor Color
The background color of the UnitRuler widget. Used to customize the ruler's background.
final
controller ScaleController?
The controller used to manage the ruler's state and interactions.
final
hashCode int
The hash code for this object.
no setterinherited
height double
The height of the ruler widget.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onValueChanged ValueChangedCallback
A callback function that is triggered when the value changes.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scaleAlignment Alignment
The alignment of the ruler.
final
scaleIntervalStyles List<ScaleIntervalStyle>
A list of styles that determine how each unit interval is rendered.
final
scaleIntervalText String Function(int index, num rulerScaleValue)
A function that provides the text to display for a unit interval.
final
scaleIntervalTextPosition double
The position of the unit interval text.
final
scaleIntervalTextStyle TextStyle
The text style applied to the unit interval text.
final
scaleMargin double
The margin around the ruler, providing space between the ruler and its surrounding widgets.
final
scaleMarker Widget?
A widget that represents the marker displayed on the ruler.
final
scaleMarkerPositionLeft double
The horizontal position of the ruler marker.
final
scaleMarkerPositionTop double
The vertical position of the ruler marker.
final
scalePadding EdgeInsetsGeometry?
Padding for the ruler widget.
final
scaleUnit ScaleUnit
The name of the unit being measured.
final
scrollDirection Axis
The scroll direction of the ruler.
final
width double
The width of the ruler widget.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<StatefulWidget>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited