TKeyValue.progress constructor
TKeyValue.progress(
- String key,
- double? value, {
- double progressMaxWidth = 180.0,
- double height = 6.0,
- bool showPercentage = true,
- String? valueText,
- TProgressValuePosition valuePosition = TProgressValuePosition.topRight,
- Color? color,
- Color? colorBuilder()?,
- Color? backgroundColor,
- bool flowing = false,
- TextStyle? valueStyle,
- Widget? icon,
- double? width,
- Alignment? alignment,
- double? minWidth,
- double? maxWidth,
Creates a key-value item for displaying progress bars using TProgressBar.
Implementation
factory TKeyValue.progress(
String key,
double? value, {
double progressMaxWidth = 180.0,
double height = 6.0,
bool showPercentage = true,
String? valueText,
TProgressValuePosition valuePosition = TProgressValuePosition.topRight,
Color? color,
Color? Function(double value, double percentage)? colorBuilder,
Color? backgroundColor,
bool flowing = false,
TextStyle? valueStyle,
Widget? icon,
double? width,
Alignment? alignment,
double? minWidth,
double? maxWidth,
}) {
Widget? widget;
if (value != null) {
widget = ConstrainedBox(
constraints: BoxConstraints(maxWidth: progressMaxWidth),
child: TProgressBar(
value: value,
height: height,
showPercentage: showPercentage,
valueText: valueText,
valuePosition: valuePosition,
color: color,
colorBuilder: colorBuilder,
backgroundColor: backgroundColor,
flowing: flowing,
valueStyle: valueStyle,
),
);
}
return TKeyValue(
key,
value: value != null ? (valueText ?? '${(value * 100).toInt()}%') : null,
widget: widget,
icon: icon,
width: width,
alignment: alignment,
minWidth: minWidth,
maxWidth: maxWidth,
);
}