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
d9e0c32d
Commit
d9e0c32d
authored
Apr 09, 2016
by
Hans Muller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove ScrollableListPainter (#3226)
* Remove ScrollableListPainter
parent
df0a9fc1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
4 additions
and
175 deletions
+4
-175
tabs.dart
packages/flutter/lib/src/material/tabs.dart
+0
-1
block.dart
packages/flutter/lib/src/rendering/block.dart
+1
-4
viewport.dart
packages/flutter/lib/src/rendering/viewport.dart
+1
-8
pageable_list.dart
packages/flutter/lib/src/widgets/pageable_list.dart
+0
-24
scrollable.dart
packages/flutter/lib/src/widgets/scrollable.dart
+0
-98
scrollable_list.dart
packages/flutter/lib/src/widgets/scrollable_list.dart
+2
-40
No files found.
packages/flutter/lib/src/material/tabs.dart
View file @
d9e0c32d
...
...
@@ -1075,7 +1075,6 @@ class _TabBarViewState<T> extends PageableListState<TabBarView<T>> implements Ta
itemsWrap:
config
.
itemsWrap
,
mainAxis:
config
.
scrollDirection
,
startOffset:
scrollOffset
,
overlayPainter:
config
.
scrollableListPainter
,
children:
_items
);
}
...
...
packages/flutter/lib/src/rendering/block.dart
View file @
d9e0c32d
...
...
@@ -6,7 +6,6 @@ import 'dart:math' as math;
import
'box.dart'
;
import
'object.dart'
;
import
'viewport.dart'
;
/// Parent data for use with [RenderBlockBase].
class
BlockParentData
extends
ContainerBoxParentDataMixin
<
RenderBox
>
{
}
...
...
@@ -25,8 +24,7 @@ typedef double _Constrainer(double value);
/// viewport with a scrolling direction that matches the block's main axis.
class
RenderBlock
extends
RenderBox
with
ContainerRenderObjectMixin
<
RenderBox
,
BlockParentData
>,
RenderBoxContainerDefaultsMixin
<
RenderBox
,
BlockParentData
>
implements
HasMainAxis
{
RenderBoxContainerDefaultsMixin
<
RenderBox
,
BlockParentData
>
{
RenderBlock
({
List
<
RenderBox
>
children
,
...
...
@@ -42,7 +40,6 @@ class RenderBlock extends RenderBox
}
/// The direction to use as the main axis.
@override
Axis
get
mainAxis
=>
_mainAxis
;
Axis
_mainAxis
;
void
set
mainAxis
(
Axis
value
)
{
...
...
packages/flutter/lib/src/rendering/viewport.dart
View file @
d9e0c32d
...
...
@@ -73,18 +73,12 @@ class ViewportDimensions {
String
toString
()
=>
'ViewportDimensions(container:
$containerSize
, content:
$contentSize
)'
;
}
/// An interface that indicates that an object has a scroll direction.
abstract
class
HasMainAxis
{
/// Whether this object scrolls horizontally or vertically.
Axis
get
mainAxis
;
}
/// A base class for render objects that are bigger on the inside.
///
/// This class holds the common fields for viewport render objects but does not
/// have a child model. See [RenderViewport] for a viewport with a single child
/// and [RenderVirtualViewport] for a viewport with multiple children.
class
RenderViewportBase
extends
RenderBox
implements
HasMainAxis
{
class
RenderViewportBase
extends
RenderBox
{
RenderViewportBase
(
Offset
paintOffset
,
Axis
mainAxis
,
...
...
@@ -128,7 +122,6 @@ class RenderViewportBase extends RenderBox implements HasMainAxis {
/// The child is given layout constraints that are fully unconstrainted along
/// the main axis (e.g., the child can be as tall as it wants if the main axis
/// is vertical).
@override
Axis
get
mainAxis
=>
_mainAxis
;
Axis
_mainAxis
;
void
set
mainAxis
(
Axis
value
)
{
...
...
packages/flutter/lib/src/widgets/pageable_list.dart
View file @
d9e0c32d
...
...
@@ -35,7 +35,6 @@ class PageableList extends Scrollable {
this
.
itemsWrap
:
false
,
this
.
itemsSnapAlignment
:
PageableListFlingBehavior
.
stopAtNextPage
,
this
.
onPageChanged
,
this
.
scrollableListPainter
,
this
.
duration
:
const
Duration
(
milliseconds:
200
),
this
.
curve
:
Curves
.
ease
,
this
.
children
...
...
@@ -61,9 +60,6 @@ class PageableList extends Scrollable {
/// Called when the currently visible page changes.
final
ValueChanged
<
int
>
onPageChanged
;
/// Used to paint the scrollbar for this list.
final
ScrollableListPainter
scrollableListPainter
;
/// The duration used when animating to a given page.
final
Duration
duration
;
...
...
@@ -146,7 +142,6 @@ class PageableListState<T extends PageableList> extends ScrollableState<T> {
}
void
_updateScrollBehavior
()
{
config
.
scrollableListPainter
?.
contentExtent
=
_itemCount
.
toDouble
();
didUpdateScrollBehavior
(
scrollBehavior
.
updateExtents
(
contentExtent:
_itemCount
.
toDouble
(),
containerExtent:
1.0
,
...
...
@@ -154,24 +149,6 @@ class PageableListState<T extends PageableList> extends ScrollableState<T> {
));
}
@override
void
dispatchOnScrollStart
()
{
super
.
dispatchOnScrollStart
();
config
.
scrollableListPainter
?.
scrollStarted
();
}
@override
void
dispatchOnScroll
()
{
super
.
dispatchOnScroll
();
config
.
scrollableListPainter
?.
scrollOffset
=
scrollOffset
;
}
@override
void
dispatchOnScrollEnd
()
{
super
.
dispatchOnScrollEnd
();
config
.
scrollableListPainter
?.
scrollEnded
();
}
@override
Widget
buildContent
(
BuildContext
context
)
{
return
new
PageViewport
(
...
...
@@ -179,7 +156,6 @@ class PageableListState<T extends PageableList> extends ScrollableState<T> {
mainAxis:
config
.
scrollDirection
,
anchor:
config
.
scrollAnchor
,
startOffset:
scrollOffset
,
overlayPainter:
config
.
scrollableListPainter
,
children:
config
.
children
);
}
...
...
packages/flutter/lib/src/widgets/scrollable.dart
View file @
d9e0c32d
...
...
@@ -8,7 +8,6 @@ import 'dart:ui' as ui show window;
import
'package:newton/newton.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/rendering.dart'
show
HasMainAxis
;
import
'basic.dart'
;
import
'framework.dart'
;
...
...
@@ -764,100 +763,3 @@ class Block extends StatelessWidget {
);
}
}
abstract
class
ScrollableListPainter
extends
RenderObjectPainter
{
@override
void
attach
(
RenderObject
renderObject
)
{
assert
(
renderObject
is
RenderBox
);
assert
(
renderObject
is
HasMainAxis
);
super
.
attach
(
renderObject
);
}
@override
RenderBox
get
renderObject
=>
super
.
renderObject
;
Axis
get
scrollDirection
{
HasMainAxis
scrollable
=
renderObject
as
dynamic
;
return
scrollable
?.
mainAxis
;
}
Size
get
viewportSize
=>
renderObject
.
size
;
double
get
contentExtent
=>
_contentExtent
;
double
_contentExtent
=
0.0
;
void
set
contentExtent
(
double
value
)
{
assert
(
value
!=
null
);
assert
(
value
>=
0.0
);
if
(
_contentExtent
==
value
)
return
;
_contentExtent
=
value
;
renderObject
?.
markNeedsPaint
();
}
double
get
scrollOffset
=>
_scrollOffset
;
double
_scrollOffset
=
0.0
;
void
set
scrollOffset
(
double
value
)
{
assert
(
value
!=
null
);
if
(
_scrollOffset
==
value
)
return
;
_scrollOffset
=
value
;
renderObject
?.
markNeedsPaint
();
}
/// Called when a scroll starts. Subclasses may override this method to
/// initialize some state or to play an animation.
void
scrollStarted
()
{
}
/// Similar to scrollStarted(). Called when a scroll ends. For fling scrolls
/// "ended" means that the scroll animation either stopped of its own accord
/// or was canceled by the user.
void
scrollEnded
()
{
}
}
class
CompoundScrollableListPainter
extends
ScrollableListPainter
{
CompoundScrollableListPainter
(
this
.
painters
);
final
List
<
ScrollableListPainter
>
painters
;
@override
void
attach
(
RenderObject
renderObject
)
{
for
(
ScrollableListPainter
painter
in
painters
)
painter
.
attach
(
renderObject
);
}
@override
void
detach
()
{
for
(
ScrollableListPainter
painter
in
painters
)
painter
.
detach
();
}
@override
void
set
contentExtent
(
double
value
)
{
for
(
ScrollableListPainter
painter
in
painters
)
painter
.
contentExtent
=
value
;
}
@override
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
for
(
ScrollableListPainter
painter
in
painters
)
painter
.
paint
(
context
,
offset
);
}
@override
void
set
scrollOffset
(
double
value
)
{
for
(
ScrollableListPainter
painter
in
painters
)
painter
.
scrollOffset
=
value
;
}
@override
void
scrollStarted
()
{
for
(
ScrollableListPainter
painter
in
painters
)
painter
.
scrollStarted
();
}
@override
void
scrollEnded
()
{
for
(
ScrollableListPainter
painter
in
painters
)
painter
.
scrollEnded
();
}
}
packages/flutter/lib/src/widgets/scrollable_list.dart
View file @
d9e0c32d
...
...
@@ -23,7 +23,6 @@ class ScrollableList extends Scrollable {
this
.
itemsWrap
:
false
,
this
.
clampOverscrolls
:
false
,
this
.
padding
,
this
.
scrollableListPainter
,
this
.
children
})
:
super
(
key:
key
,
...
...
@@ -40,7 +39,6 @@ class ScrollableList extends Scrollable {
final
bool
itemsWrap
;
final
bool
clampOverscrolls
;
final
EdgeInsets
padding
;
final
ScrollableListPainter
scrollableListPainter
;
final
Iterable
<
Widget
>
children
;
@override
...
...
@@ -55,7 +53,6 @@ class _ScrollableListState extends ScrollableState<ScrollableList> {
ExtentScrollBehavior
get
scrollBehavior
=>
super
.
scrollBehavior
;
void
_handleExtentsChanged
(
double
contentExtent
,
double
containerExtent
)
{
config
.
scrollableListPainter
?.
contentExtent
=
contentExtent
;
setState
(()
{
didUpdateScrollBehavior
(
scrollBehavior
.
updateExtents
(
contentExtent:
config
.
itemsWrap
?
double
.
INFINITY
:
contentExtent
,
...
...
@@ -65,18 +62,6 @@ class _ScrollableListState extends ScrollableState<ScrollableList> {
});
}
@override
void
dispatchOnScrollStart
()
{
super
.
dispatchOnScrollStart
();
config
.
scrollableListPainter
?.
scrollStarted
();
}
@override
void
dispatchOnScroll
()
{
super
.
dispatchOnScroll
();
config
.
scrollableListPainter
?.
scrollOffset
=
scrollOffset
;
}
@override
Widget
buildContent
(
BuildContext
context
)
{
final
double
listScrollOffset
=
config
.
clampOverscrolls
...
...
@@ -90,7 +75,6 @@ class _ScrollableListState extends ScrollableState<ScrollableList> {
itemExtent:
config
.
itemExtent
,
itemsWrap:
config
.
itemsWrap
,
padding:
config
.
padding
,
overlayPainter:
config
.
scrollableListPainter
,
children:
config
.
children
);
}
...
...
@@ -302,8 +286,7 @@ class ScrollableLazyList extends Scrollable {
this
.
itemExtent
,
this
.
itemCount
,
this
.
itemBuilder
,
this
.
padding
,
this
.
scrollableListPainter
this
.
padding
})
:
super
(
key:
key
,
initialScrollOffset:
initialScrollOffset
,
...
...
@@ -321,7 +304,6 @@ class ScrollableLazyList extends Scrollable {
final
int
itemCount
;
final
ItemListBuilder
itemBuilder
;
final
EdgeInsets
padding
;
final
ScrollableListPainter
scrollableListPainter
;
@override
ScrollableState
createState
()
=>
new
_ScrollableLazyListState
();
...
...
@@ -335,7 +317,6 @@ class _ScrollableLazyListState extends ScrollableState<ScrollableLazyList> {
ExtentScrollBehavior
get
scrollBehavior
=>
super
.
scrollBehavior
;
void
_handleExtentsChanged
(
double
contentExtent
,
double
containerExtent
)
{
config
.
scrollableListPainter
?.
contentExtent
=
contentExtent
;
setState
(()
{
didUpdateScrollBehavior
(
scrollBehavior
.
updateExtents
(
contentExtent:
contentExtent
,
...
...
@@ -345,24 +326,6 @@ class _ScrollableLazyListState extends ScrollableState<ScrollableLazyList> {
});
}
@override
void
dispatchOnScrollStart
()
{
super
.
dispatchOnScrollStart
();
config
.
scrollableListPainter
?.
scrollStarted
();
}
@override
void
dispatchOnScroll
()
{
super
.
dispatchOnScroll
();
config
.
scrollableListPainter
?.
scrollOffset
=
scrollOffset
;
}
@override
void
dispatchOnScrollEnd
()
{
super
.
dispatchOnScrollEnd
();
config
.
scrollableListPainter
?.
scrollEnded
();
}
@override
Widget
buildContent
(
BuildContext
context
)
{
return
new
LazyListViewport
(
...
...
@@ -373,8 +336,7 @@ class _ScrollableLazyListState extends ScrollableState<ScrollableLazyList> {
itemExtent:
config
.
itemExtent
,
itemCount:
config
.
itemCount
,
itemBuilder:
config
.
itemBuilder
,
padding:
config
.
padding
,
overlayPainter:
config
.
scrollableListPainter
padding:
config
.
padding
);
}
}
...
...
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