Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
f852c46c
Unverified
Commit
f852c46c
authored
Jul 19, 2022
by
Kate Lovett
Committed by
GitHub
Jul 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose padding on RawScrollbar (#107756)
parent
b5590a06
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
3 deletions
+43
-3
scrollbar.dart
packages/flutter/lib/src/widgets/scrollbar.dart
+9
-1
scrollbar_test.dart
packages/flutter/test/widgets/scrollbar_test.dart
+34
-2
No files found.
packages/flutter/lib/src/widgets/scrollbar.dart
View file @
f852c46c
...
...
@@ -944,6 +944,7 @@ class RawScrollbar extends StatefulWidget {
this
.
scrollbarOrientation
,
this
.
mainAxisMargin
=
0.0
,
this
.
crossAxisMargin
=
0.0
,
this
.
padding
,
@Deprecated
(
'Use thumbVisibility instead. '
'This feature was deprecated after v2.9.0-1.0.pre.'
,
...
...
@@ -1366,6 +1367,13 @@ class RawScrollbar extends StatefulWidget {
/// Must not be null and defaults to 0.
final
double
crossAxisMargin
;
/// The insets by which the scrollbar thumb and track should be padded.
///
/// When null, the inherited [MediaQueryData.padding] is used.
///
/// Defaults to null.
final
EdgeInsets
?
padding
;
@override
RawScrollbarState
<
RawScrollbar
>
createState
()
=>
RawScrollbarState
<
RawScrollbar
>();
}
...
...
@@ -1593,7 +1601,7 @@ class RawScrollbarState<T extends RawScrollbar> extends State<T> with TickerProv
..
textDirection
=
Directionality
.
of
(
context
)
..
thickness
=
widget
.
thickness
??
_kScrollbarThickness
..
radius
=
widget
.
radius
..
padding
=
MediaQuery
.
of
(
context
).
padding
..
padding
=
widget
.
padding
??
MediaQuery
.
of
(
context
).
padding
..
scrollbarOrientation
=
widget
.
scrollbarOrientation
..
mainAxisMargin
=
widget
.
mainAxisMargin
..
shape
=
widget
.
shape
...
...
packages/flutter/test/widgets/scrollbar_test.dart
View file @
f852c46c
...
...
@@ -2612,7 +2612,7 @@ void main() {
// Go without throw.
});
testWidgets
(
'Track offset respects padding'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Track offset respects
MediaQuery
padding'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/106834
final
ScrollController
scrollController
=
ScrollController
();
await
tester
.
pumpWidget
(
...
...
@@ -2640,7 +2640,39 @@ void main() {
find
.
byType
(
RawScrollbar
),
paints
..
rect
(
rect:
const
Rect
.
fromLTRB
(
744.0
,
50.0
,
750.0
,
550.0
))
// track
..
rect
(
rect:
const
Rect
.
fromLTRB
(
744.0
,
50.0
,
750.0
,
71.0
))
..
rect
(
rect:
const
Rect
.
fromLTRB
(
744.0
,
50.0
,
750.0
,
71.0
))
// thumb
);
// thumb
});
testWidgets
(
'RawScrollbar.padding replaces MediaQueryData.padding'
,
(
WidgetTester
tester
)
async
{
final
ScrollController
scrollController
=
ScrollController
();
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
MediaQuery
(
data:
const
MediaQueryData
(
padding:
EdgeInsets
.
all
(
50.0
),
),
child:
RawScrollbar
(
controller:
scrollController
,
minThumbLength:
21
,
minOverscrollLength:
8
,
thumbVisibility:
true
,
padding:
const
EdgeInsets
.
all
(
100
),
child:
SingleChildScrollView
(
controller:
scrollController
,
child:
const
SizedBox
(
width:
1000.0
,
height:
50000.0
),
),
),
)
)
);
await
tester
.
pumpAndSettle
();
expect
(
find
.
byType
(
RawScrollbar
),
paints
..
rect
(
rect:
const
Rect
.
fromLTRB
(
694.0
,
100.0
,
700.0
,
500.0
))
// track
..
rect
(
rect:
const
Rect
.
fromLTRB
(
694.0
,
100.0
,
700.0
,
121.0
))
// thumb
);
// thumb
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment