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
6549d84a
Unverified
Commit
6549d84a
authored
Jun 24, 2021
by
Chinmoy
Committed by
GitHub
Jun 24, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds mainAxisMargin property to RawScrollbar (#84988)
parent
6bcdce37
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
1 deletion
+41
-1
scrollbar.dart
packages/flutter/lib/src/widgets/scrollbar.dart
+11
-1
scrollbar_test.dart
packages/flutter/test/widgets/scrollbar_test.dart
+30
-0
No files found.
packages/flutter/lib/src/widgets/scrollbar.dart
View file @
6549d84a
...
@@ -863,10 +863,12 @@ class RawScrollbar extends StatefulWidget {
...
@@ -863,10 +863,12 @@ class RawScrollbar extends StatefulWidget {
this
.
notificationPredicate
=
defaultScrollNotificationPredicate
,
this
.
notificationPredicate
=
defaultScrollNotificationPredicate
,
this
.
interactive
,
this
.
interactive
,
this
.
scrollbarOrientation
,
this
.
scrollbarOrientation
,
this
.
mainAxisMargin
=
0.0
,
})
:
assert
(
child
!=
null
),
})
:
assert
(
child
!=
null
),
assert
(
fadeDuration
!=
null
),
assert
(
fadeDuration
!=
null
),
assert
(
timeToFade
!=
null
),
assert
(
timeToFade
!=
null
),
assert
(
pressDuration
!=
null
),
assert
(
pressDuration
!=
null
),
assert
(
mainAxisMargin
!=
null
),
super
(
key:
key
);
super
(
key:
key
);
/// {@template flutter.widgets.Scrollbar.child}
/// {@template flutter.widgets.Scrollbar.child}
...
@@ -1077,6 +1079,12 @@ class RawScrollbar extends StatefulWidget {
...
@@ -1077,6 +1079,12 @@ class RawScrollbar extends StatefulWidget {
/// {@macro flutter.widgets.Scrollbar.scrollbarOrientation}
/// {@macro flutter.widgets.Scrollbar.scrollbarOrientation}
final
ScrollbarOrientation
?
scrollbarOrientation
;
final
ScrollbarOrientation
?
scrollbarOrientation
;
/// Distance from the scrollbar's start and end to the edge of the viewport
/// in logical pixels. It affects the amount of available paint area.
///
/// Mustn't be null and defaults to 0.
final
double
mainAxisMargin
;
@override
@override
RawScrollbarState
<
RawScrollbar
>
createState
()
=>
RawScrollbarState
<
RawScrollbar
>();
RawScrollbarState
<
RawScrollbar
>
createState
()
=>
RawScrollbarState
<
RawScrollbar
>();
}
}
...
@@ -1149,6 +1157,7 @@ class RawScrollbarState<T extends RawScrollbar> extends State<T> with TickerProv
...
@@ -1149,6 +1157,7 @@ class RawScrollbarState<T extends RawScrollbar> extends State<T> with TickerProv
thickness:
widget
.
thickness
??
_kScrollbarThickness
,
thickness:
widget
.
thickness
??
_kScrollbarThickness
,
fadeoutOpacityAnimation:
_fadeoutOpacityAnimation
,
fadeoutOpacityAnimation:
_fadeoutOpacityAnimation
,
scrollbarOrientation:
widget
.
scrollbarOrientation
,
scrollbarOrientation:
widget
.
scrollbarOrientation
,
mainAxisMargin:
widget
.
mainAxisMargin
,
);
);
}
}
...
@@ -1284,7 +1293,8 @@ class RawScrollbarState<T extends RawScrollbar> extends State<T> with TickerProv
...
@@ -1284,7 +1293,8 @@ class RawScrollbarState<T extends RawScrollbar> extends State<T> with TickerProv
..
thickness
=
widget
.
thickness
??
_kScrollbarThickness
..
thickness
=
widget
.
thickness
??
_kScrollbarThickness
..
radius
=
widget
.
radius
..
radius
=
widget
.
radius
..
padding
=
MediaQuery
.
of
(
context
).
padding
..
padding
=
MediaQuery
.
of
(
context
).
padding
..
scrollbarOrientation
=
widget
.
scrollbarOrientation
;
..
scrollbarOrientation
=
widget
.
scrollbarOrientation
..
mainAxisMargin
=
widget
.
mainAxisMargin
;
}
}
@override
@override
...
...
packages/flutter/test/widgets/scrollbar_test.dart
View file @
6549d84a
...
@@ -1452,4 +1452,34 @@ void main() {
...
@@ -1452,4 +1452,34 @@ void main() {
expect
(()
=>
painter
.
paint
(
testCanvas
,
size
),
throwsA
(
isA
<
AssertionError
>()));
expect
(()
=>
painter
.
paint
(
testCanvas
,
size
),
throwsA
(
isA
<
AssertionError
>()));
});
});
testWidgets
(
'RawScrollbar mainAxisMargin property works properly'
,
(
WidgetTester
tester
)
async
{
final
ScrollController
scrollController
=
ScrollController
();
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
MediaQuery
(
data:
const
MediaQueryData
(),
child:
RawScrollbar
(
mainAxisMargin:
10
,
isAlwaysShown:
true
,
controller:
scrollController
,
child:
SingleChildScrollView
(
controller:
scrollController
,
child:
const
SizedBox
(
width:
1000.0
,
height:
1000.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
,
580.0
))
..
rect
(
rect:
const
Rect
.
fromLTRB
(
794.0
,
10.0
,
800.0
,
358.0
))
);
});
}
}
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