HorizontalProgressBar class
The class HorizontalProgressBar is used to create a horizontal progress bar. The required parameters of the HorizontalProgressBar are: maxValue, currentPosition, and onChanged.
Use of HorizontalProgressBar
HorizontalProgressBar(
maxValue: 10,
// [currentPosition] should be declared before its uses
currentPosition: currentPosition,
onChanged: (val) {
setState(() {
currentPosition = val;
});
},
)
Notes:
- Uses
/for smooth decimal precision (instead of integer division~/). - Clamps positions to prevent overflow of thumb or buffered area.
- Stores last drag value to use in
onChangeEndwithout errors. - Validation moved to constructor for better error reporting.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- HorizontalProgressBar
Constructors
-
HorizontalProgressBar({Key? key, required double maxValue, required double currentPosition, required ValueChanged<
double> onChanged, double? width, double? bufferedPosition, ValueChanged<double> ? onChangeStart, ValueChanged<double> ? onChangeEnd, Color bufferedColor = Colors.grey, Color progressColor = Colors.blue, Color thumbColor = const Color.fromRGBO(13, 71, 161, 1), double thumbDiameter = 15, double trackHeight = 10, double enabledHeight = 10, bool isThumbVisible = true}) -
const
Properties
- bufferedColor → Color
-
bufferedColor sets buffered area color.
final
- bufferedPosition → double?
-
bufferedPosition sets the buffer position.
final
- currentPosition → double
-
currentPosition Represents the progressbar's current position.
final
- enabledHeight → double
-
enabledHeight sets the height of the progressbar.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isThumbVisible → bool
-
isThumbVisible sets whether the thumb is visible or not.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- maxValue → double
-
maxValue represents the maximum value of the progress bar, the value ranges from 0 to maxValue.
final
-
onChanged
→ ValueChanged<
double> -
onChanged Callback function. Called whenever the progressbar's current value gets changed.
final
-
onChangeEnd
→ ValueChanged<
double> ? -
onChangeEnd Callback function. Called whenever the progressbar's current value change ends.
It is only called when the progressbar is dragged.
final
-
onChangeStart
→ ValueChanged<
double> ? -
onChangeStart Callback function. Called whenever the progressbar's current value starts to be changed.
It is only called when the progressbar is dragged.
final
- progressColor → Color
-
progressColor Progress area color.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- thumbColor → Color
-
thumbColor sets the color of the thumb.
final
- thumbDiameter → double
-
thumbDiameter the diameter of the thumb.
final
- trackHeight → double
-
trackHeight height of the progress and buffered track.
final
- width → double?
-
width sets the width of the progress bar.
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
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