Fix RawScrollbar colors (#107177)
This commit is contained in:
@@ -1572,8 +1572,12 @@ class RawScrollbarState<T extends RawScrollbar> extends State<T> with TickerProv
|
||||
scrollbarPainter
|
||||
..color = widget.thumbColor ?? const Color(0x66BCBCBC)
|
||||
..trackRadius = widget.trackRadius
|
||||
..trackColor = _showTrack ? const Color(0x08000000) : const Color(0x00000000)
|
||||
..trackBorderColor = _showTrack ? const Color(0x1a000000) : const Color(0x00000000)
|
||||
..trackColor = _showTrack
|
||||
? widget.trackColor ?? const Color(0x08000000)
|
||||
: const Color(0x00000000)
|
||||
..trackBorderColor = _showTrack
|
||||
? widget.trackBorderColor ?? const Color(0x1a000000)
|
||||
: const Color(0x00000000)
|
||||
..textDirection = Directionality.of(context)
|
||||
..thickness = widget.thickness ?? _kScrollbarThickness
|
||||
..radius = widget.radius
|
||||
|
||||
@@ -2465,6 +2465,52 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('RawScrollbar correctly assigns colors', (WidgetTester tester) async {
|
||||
final ScrollController scrollController = ScrollController();
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: MediaQuery(
|
||||
data: const MediaQueryData(),
|
||||
child: PrimaryScrollController(
|
||||
controller: scrollController,
|
||||
child: RawScrollbar(
|
||||
thumbVisibility: true,
|
||||
thumbColor: const Color(0xFFF44336),
|
||||
trackVisibility: true,
|
||||
trackColor: const Color(0xFF2196F3),
|
||||
trackBorderColor: const Color(0xFFFFEB3B),
|
||||
controller: scrollController,
|
||||
child: const SingleChildScrollView(
|
||||
child: SizedBox(width: 4000.0, height: 4000.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(scrollController.offset, 0.0);
|
||||
expect(
|
||||
find.byType(RawScrollbar),
|
||||
paints
|
||||
..rect(
|
||||
rect: const Rect.fromLTRB(794.0, 0.0, 800.0, 600.0),
|
||||
color: const Color(0xFF2196F3),
|
||||
)
|
||||
..line(
|
||||
p1: const Offset(794.0, 0.0),
|
||||
p2: const Offset(794.0, 600.0),
|
||||
strokeWidth: 1.0,
|
||||
color: const Color(0xFFFFEB3B),
|
||||
)
|
||||
..rect(
|
||||
rect: const Rect.fromLTRB(794.0, 0.0, 800.0, 90.0),
|
||||
color: const Color(0xFFF44336),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('trackRadius and radius properties of RawScrollbar can draw RoundedRectangularRect', (WidgetTester tester) async {
|
||||
final ScrollController scrollController = ScrollController();
|
||||
await tester.pumpWidget(
|
||||
|
||||
Reference in New Issue
Block a user