chore: code clean up

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-11-10 09:49:06 +08:00
parent 03d405e197
commit 59910e275e
133 changed files with 597 additions and 816 deletions

View File

@@ -74,7 +74,7 @@ class ProgressBar extends LeafRenderObjectWidget {
/// When a user drags the thumb to a new location you can be notified
/// by the [onSeek] callback so that you can update your audio/video player.
const ProgressBar({
Key? key,
super.key,
required this.progress,
required this.total,
this.buffered,
@@ -96,7 +96,7 @@ class ProgressBar extends LeafRenderObjectWidget {
this.timeLabelType,
this.timeLabelTextStyle,
this.timeLabelPadding = 0.0,
}) : super(key: key);
});
/// The elapsed playing time of the media.
///
@@ -257,7 +257,7 @@ class ProgressBar extends LeafRenderObjectWidget {
final theme = Theme.of(context);
final primaryColor = theme.colorScheme.primary;
final textStyle = timeLabelTextStyle ?? theme.textTheme.bodyLarge;
final textScaleFactor = MediaQuery.textScaleFactorOf(context);
final textScaleFactor = MediaQuery.textScalerOf(context).scale(1);
return _RenderProgressBar(
progress: progress,
total: total,
@@ -274,7 +274,7 @@ class ProgressBar extends LeafRenderObjectWidget {
thumbRadius: thumbRadius,
thumbColor: thumbColor ?? primaryColor,
thumbGlowColor:
thumbGlowColor ?? (thumbColor ?? primaryColor).withAlpha(80),
thumbGlowColor ?? (thumbColor ?? primaryColor).withAlpha(80),
thumbGlowRadius: thumbGlowRadius,
thumbCanPaintOutsideBar: thumbCanPaintOutsideBar,
timeLabelLocation: timeLabelLocation ?? TimeLabelLocation.below,
@@ -290,7 +290,7 @@ class ProgressBar extends LeafRenderObjectWidget {
final theme = Theme.of(context);
final primaryColor = theme.colorScheme.primary;
final textStyle = timeLabelTextStyle ?? theme.textTheme.bodyLarge;
final textScaleFactor = MediaQuery.textScaleFactorOf(context);
final textScaleFactor = MediaQuery.textScalerOf(context).scale(1);
(renderObject as _RenderProgressBar)
..progress = progress
..total = total
@@ -958,7 +958,7 @@ class _RenderProgressBar extends RenderBox {
// progress bar
final barDy =
(isLabelBelow) ? 0.0 : _leftLabelSize.height + _timeLabelPadding;
(isLabelBelow) ? 0.0 : _leftLabelSize.height + _timeLabelPadding;
_drawProgressBar(canvas, Offset(0, barDy), Size(barWidth, barHeight));
}
@@ -1042,9 +1042,9 @@ class _RenderProgressBar extends RenderBox {
void _drawBar(
{required Canvas canvas,
required Size availableSize,
required double widthProportion,
required Color color}) {
required Size availableSize,
required double widthProportion,
required Color color}) {
final strokeCap = (_barCapShape == BarCapShape.round)
? StrokeCap.round
: StrokeCap.square;
@@ -1085,7 +1085,7 @@ class _RenderProgressBar extends RenderBox {
String _getTimeString(Duration time) {
final minutes =
time.inMinutes.remainder(Duration.minutesPerHour).toString();
time.inMinutes.remainder(Duration.minutesPerHour).toString();
final seconds = time.inSeconds
.remainder(Duration.secondsPerMinute)
.toString()
@@ -1101,7 +1101,7 @@ class _RenderProgressBar extends RenderBox {
// description
config.textDirection = TextDirection.ltr;
config.label = '进度条';//'Progress bar';
config.label = '进度条'; //'Progress bar';
config.value = '${(_thumbValue * 100).round()}%';
// increase action