fix #362
This commit is contained in:
parent
478c408db7
commit
e139dc3247
1 changed files with 61 additions and 0 deletions
|
|
@ -1476,6 +1476,9 @@ class _MangaChapterPageGalleryState
|
||||||
.watch(currentIndexProvider(chapter));
|
.watch(currentIndexProvider(chapter));
|
||||||
return SliderTheme(
|
return SliderTheme(
|
||||||
data: SliderTheme.of(context).copyWith(
|
data: SliderTheme.of(context).copyWith(
|
||||||
|
valueIndicatorShape:
|
||||||
|
_CustomValueIndicatorShape(
|
||||||
|
tranform: _isReverseHorizontal),
|
||||||
overlayShape:
|
overlayShape:
|
||||||
const RoundSliderOverlayShape(
|
const RoundSliderOverlayShape(
|
||||||
overlayRadius: 5.0),
|
overlayRadius: 5.0),
|
||||||
|
|
@ -2378,3 +2381,61 @@ class CustomPopupMenuButton<T> extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _CustomValueIndicatorShape extends SliderComponentShape {
|
||||||
|
final _indicatorShape = const PaddleSliderValueIndicatorShape();
|
||||||
|
final bool tranform;
|
||||||
|
const _CustomValueIndicatorShape({this.tranform = false});
|
||||||
|
@override
|
||||||
|
Size getPreferredSize(bool isEnabled, bool isDiscrete) {
|
||||||
|
return const Size(40, 40);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void paint(PaintingContext context, Offset center,
|
||||||
|
{required Animation<double> activationAnimation,
|
||||||
|
required Animation<double> enableAnimation,
|
||||||
|
required bool isDiscrete,
|
||||||
|
required TextPainter labelPainter,
|
||||||
|
required RenderBox parentBox,
|
||||||
|
required SliderThemeData sliderTheme,
|
||||||
|
required TextDirection textDirection,
|
||||||
|
required double value,
|
||||||
|
required double textScaleFactor,
|
||||||
|
required Size sizeWithOverflow}) {
|
||||||
|
final textSpan = TextSpan(
|
||||||
|
text: labelPainter.text?.toPlainText(),
|
||||||
|
style: sliderTheme.valueIndicatorTextStyle,
|
||||||
|
);
|
||||||
|
|
||||||
|
final textPainter = TextPainter(
|
||||||
|
text: textSpan,
|
||||||
|
textAlign: labelPainter.textAlign,
|
||||||
|
textDirection: textDirection,
|
||||||
|
);
|
||||||
|
|
||||||
|
textPainter.layout();
|
||||||
|
|
||||||
|
context.canvas.save();
|
||||||
|
context.canvas.translate(center.dx, center.dy);
|
||||||
|
context.canvas.scale(tranform ? -1.0 : 1.0, 1.0);
|
||||||
|
context.canvas.translate(-center.dx, -center.dy);
|
||||||
|
|
||||||
|
_indicatorShape.paint(
|
||||||
|
context,
|
||||||
|
center,
|
||||||
|
activationAnimation: activationAnimation,
|
||||||
|
enableAnimation: enableAnimation,
|
||||||
|
labelPainter: textPainter,
|
||||||
|
parentBox: parentBox,
|
||||||
|
sliderTheme: sliderTheme,
|
||||||
|
value: value,
|
||||||
|
textScaleFactor: textScaleFactor,
|
||||||
|
sizeWithOverflow: sizeWithOverflow,
|
||||||
|
isDiscrete: isDiscrete,
|
||||||
|
textDirection: textDirection,
|
||||||
|
);
|
||||||
|
|
||||||
|
context.canvas.restore();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue