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
b6aec82e
Commit
b6aec82e
authored
Feb 06, 2017
by
Ian Hickson
Committed by
GitHub
Feb 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AppBar -> PersistentHeader (#7899)
parent
53fc96da
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
104 additions
and
102 deletions
+104
-102
rendering.dart
packages/flutter/lib/rendering.dart
+1
-1
sliver_padding.dart
packages/flutter/lib/src/rendering/sliver_padding.dart
+4
-4
sliver_persistent_header.dart
...s/flutter/lib/src/rendering/sliver_persistent_header.dart
+12
-11
viewport_offset.dart
packages/flutter/lib/src/rendering/viewport_offset.dart
+6
-5
sliver_persistent_header.dart
...ges/flutter/lib/src/widgets/sliver_persistent_header.dart
+46
-46
widgets.dart
packages/flutter/lib/widgets.dart
+1
-1
slivers_appbar_floating_test.dart
...es/flutter/test/widgets/slivers_appbar_floating_test.dart
+5
-5
slivers_appbar_pinned_test.dart
...ages/flutter/test/widgets/slivers_appbar_pinned_test.dart
+7
-7
slivers_appbar_scrolling_test.dart
...s/flutter/test/widgets/slivers_appbar_scrolling_test.dart
+4
-4
slivers_evil_test.dart
packages/flutter/test/widgets/slivers_evil_test.dart
+18
-18
No files found.
packages/flutter/lib/rendering.dart
View file @
b6aec82e
...
...
@@ -45,12 +45,12 @@ export 'src/rendering/rotated_box.dart';
export
'src/rendering/semantics.dart'
;
export
'src/rendering/shifted_box.dart'
;
export
'src/rendering/sliver.dart'
;
export
'src/rendering/sliver_app_bar.dart'
;
export
'src/rendering/sliver_fixed_extent_list.dart'
;
export
'src/rendering/sliver_grid.dart'
;
export
'src/rendering/sliver_list.dart'
;
export
'src/rendering/sliver_multi_box_adaptor.dart'
;
export
'src/rendering/sliver_padding.dart'
;
export
'src/rendering/sliver_persistent_header.dart'
;
export
'src/rendering/stack.dart'
;
export
'src/rendering/table.dart'
;
export
'src/rendering/tweens.dart'
;
...
...
packages/flutter/lib/src/rendering/sliver_padding.dart
View file @
b6aec82e
...
...
@@ -21,10 +21,10 @@ import 'sliver.dart';
/// passed on to the child.
///
/// Applying this to anything but the most mundane sliver is likely to have
/// undesired effects. For example, wrapping a
[RenderSliverPinnedAppBar] will
///
cause the app bar to overlap earlier slivers (contrary to the normal
///
behavior of pinned app bars), and while the app bar is pinned, the padding
/// will scroll away.
/// undesired effects. For example, wrapping a
///
[RenderSliverPinnedPersistentHeader] will cause the app bar to overlap
///
earlier slivers (contrary to the normal behavior of pinned app bars), and
/// w
hile the app bar is pinned, the padding w
ill scroll away.
class
RenderSliverPadding
extends
RenderSliver
with
RenderObjectWithChildMixin
<
RenderSliver
>
{
/// Creates a render object that insets its child in a viewport.
///
...
...
packages/flutter/lib/src/rendering/sliver_
app_ba
r.dart
→
packages/flutter/lib/src/rendering/sliver_
persistent_heade
r.dart
View file @
b6aec82e
...
...
@@ -15,8 +15,8 @@ import 'object.dart';
import
'sliver.dart'
;
import
'viewport_offset.dart'
;
abstract
class
RenderSliver
AppBa
r
extends
RenderSliver
with
RenderObjectWithChildMixin
<
RenderBox
>,
RenderSliverHelpers
{
RenderSliver
AppBa
r
({
RenderBox
child
})
{
abstract
class
RenderSliver
PersistentHeade
r
extends
RenderSliver
with
RenderObjectWithChildMixin
<
RenderBox
>,
RenderSliverHelpers
{
RenderSliver
PersistentHeade
r
({
RenderBox
child
})
{
this
.
child
=
child
;
}
...
...
@@ -76,8 +76,9 @@ abstract class RenderSliverAppBar extends RenderSliver with RenderObjectWithChil
/// Call this whenever [updateChild] would change or mutate the child even if
/// given the same `shrinkOffset` as the last time it was called.
///
/// This must be implemented by [RenderSliverAppBar] subclasses such that the
/// next layout after this call will result in [updateChild] being called.
/// This must be implemented by [RenderSliverPersistentHeader] subclasses such
/// that the next layout after this call will result in [updateChild] being
/// called.
@protected
void
markNeedsUpdate
()
{
markNeedsLayout
();
...
...
@@ -129,7 +130,7 @@ abstract class RenderSliverAppBar extends RenderSliver with RenderObjectWithChil
///
/// The argument must be the value of the [child] property.
///
/// This must be implemented by [RenderSliver
AppBa
r] subclasses.
/// This must be implemented by [RenderSliver
PersistentHeade
r] subclasses.
///
/// If there is no child, this should return 0.0.
@override
...
...
@@ -193,8 +194,8 @@ abstract class RenderSliverAppBar extends RenderSliver with RenderObjectWithChil
/// a minimum size before continuing to scroll.
///
/// This sliver makes no effort to avoid overlapping other content.
abstract
class
RenderSliverScrolling
AppBar
extends
RenderSliverAppBa
r
{
RenderSliverScrolling
AppBa
r
({
abstract
class
RenderSliverScrolling
PersistentHeader
extends
RenderSliverPersistentHeade
r
{
RenderSliverScrolling
PersistentHeade
r
({
RenderBox
child
,
})
:
super
(
child:
child
);
...
...
@@ -228,8 +229,8 @@ abstract class RenderSliverScrollingAppBar extends RenderSliverAppBar {
/// then shrinks as the viewport continues to scroll.
///
/// This sliver avoids overlapping other earlier slivers where possible.
abstract
class
RenderSliverPinned
AppBar
extends
RenderSliverAppBa
r
{
RenderSliverPinned
AppBa
r
({
abstract
class
RenderSliverPinned
PersistentHeader
extends
RenderSliverPersistentHeade
r
{
RenderSliverPinned
PersistentHeade
r
({
RenderBox
child
,
})
:
super
(
child:
child
);
...
...
@@ -253,8 +254,8 @@ abstract class RenderSliverPinnedAppBar extends RenderSliverAppBar {
}
}
abstract
class
RenderSliverFloating
AppBar
extends
RenderSliverAppBa
r
{
RenderSliverFloating
AppBa
r
({
abstract
class
RenderSliverFloating
PersistentHeader
extends
RenderSliverPersistentHeade
r
{
RenderSliverFloating
PersistentHeade
r
({
RenderBox
child
,
})
:
super
(
child:
child
);
...
...
packages/flutter/lib/src/rendering/viewport_offset.dart
View file @
b6aec82e
...
...
@@ -11,8 +11,9 @@ import 'package:meta/meta.dart';
/// This contrasts to [GrowthDirection] in that it has a third value, [idle],
/// for the case where no scroll is occurring.
///
/// This is used by [RenderSliverFloatingAppBar] to only expand when the user is
/// scrolling in the same direction as the detected scroll offset change.
/// This is used by [RenderSliverFloatingPersistentHeader] to only expand when
/// the user is scrolling in the same direction as the detected scroll offset
/// change.
enum
ScrollDirection
{
/// No scrolling is underway.
idle
,
...
...
@@ -101,9 +102,9 @@ abstract class ViewportOffset extends ChangeNotifier {
/// the viewport's [RenderViewport2.axisDirection].
///
/// This is used by some slivers to determine how to react to a change in
/// scroll offset. For example, [RenderSliverFloating
AppBar] will only expand
///
a floating app bar when the [userScrollDirection] is in the positiv
e
/// scroll offset direction.
/// scroll offset. For example, [RenderSliverFloating
PersistentHeader] will
///
only expand a floating app bar when the [userScrollDirection] is in th
e
///
positive
scroll offset direction.
ScrollDirection
get
userScrollDirection
;
@override
...
...
packages/flutter/lib/src/widgets/
app_ba
r.dart
→
packages/flutter/lib/src/widgets/
sliver_persistent_heade
r.dart
View file @
b6aec82e
...
...
@@ -7,20 +7,20 @@ import 'package:flutter/rendering.dart';
import
'framework.dart'
;
abstract
class
Sliver
AppBa
rDelegate
{
abstract
class
Sliver
PersistentHeade
rDelegate
{
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const
Sliver
AppBa
rDelegate
();
const
Sliver
PersistentHeade
rDelegate
();
Widget
build
(
BuildContext
context
,
double
shrinkOffset
);
double
get
maxExtent
;
bool
shouldRebuild
(
@checked
Sliver
AppBa
rDelegate
oldDelegate
);
bool
shouldRebuild
(
@checked
Sliver
PersistentHeade
rDelegate
oldDelegate
);
}
class
Sliver
AppBa
r
extends
StatelessWidget
{
Sliver
AppBa
r
({
class
Sliver
PersistentHeade
r
extends
StatelessWidget
{
Sliver
PersistentHeade
r
({
Key
key
,
@required
this
.
delegate
,
this
.
pinned
:
false
,
...
...
@@ -32,7 +32,7 @@ class SliverAppBar extends StatelessWidget {
assert
(!
pinned
||
!
floating
);
}
final
Sliver
AppBa
rDelegate
delegate
;
final
Sliver
PersistentHeade
rDelegate
delegate
;
final
bool
pinned
;
...
...
@@ -41,10 +41,10 @@ class SliverAppBar extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
if
(
pinned
)
return
new
_SliverPinned
AppBa
r
(
delegate:
delegate
);
return
new
_SliverPinned
PersistentHeade
r
(
delegate:
delegate
);
if
(
floating
)
return
new
_SliverFloating
AppBa
r
(
delegate:
delegate
);
return
new
_SliverScrolling
AppBa
r
(
delegate:
delegate
);
return
new
_SliverFloating
PersistentHeade
r
(
delegate:
delegate
);
return
new
_SliverScrolling
PersistentHeade
r
(
delegate:
delegate
);
}
@override
...
...
@@ -62,14 +62,14 @@ class SliverAppBar extends StatelessWidget {
}
}
class
_Sliver
AppBa
rElement
extends
RenderObjectElement
{
_Sliver
AppBarElement
(
_SliverAppBa
rRenderObjectWidget
widget
)
:
super
(
widget
);
class
_Sliver
PersistentHeade
rElement
extends
RenderObjectElement
{
_Sliver
PersistentHeaderElement
(
_SliverPersistentHeade
rRenderObjectWidget
widget
)
:
super
(
widget
);
@override
_Sliver
AppBa
rRenderObjectWidget
get
widget
=>
super
.
widget
;
_Sliver
PersistentHeade
rRenderObjectWidget
get
widget
=>
super
.
widget
;
@override
_RenderSliver
AppBa
rForWidgetsMixin
get
renderObject
=>
super
.
renderObject
;
_RenderSliver
PersistentHeade
rForWidgetsMixin
get
renderObject
=>
super
.
renderObject
;
@override
void
mount
(
Element
parent
,
dynamic
newSlot
)
{
...
...
@@ -84,11 +84,11 @@ class _SliverAppBarElement extends RenderObjectElement {
}
@override
void
update
(
_Sliver
AppBa
rRenderObjectWidget
newWidget
)
{
final
_Sliver
AppBa
rRenderObjectWidget
oldWidget
=
widget
;
void
update
(
_Sliver
PersistentHeade
rRenderObjectWidget
newWidget
)
{
final
_Sliver
PersistentHeade
rRenderObjectWidget
oldWidget
=
widget
;
super
.
update
(
newWidget
);
final
Sliver
AppBa
rDelegate
newDelegate
=
newWidget
.
delegate
;
final
Sliver
AppBa
rDelegate
oldDelegate
=
oldWidget
.
delegate
;
final
Sliver
PersistentHeade
rDelegate
newDelegate
=
newWidget
.
delegate
;
final
Sliver
PersistentHeade
rDelegate
oldDelegate
=
oldWidget
.
delegate
;
if
(
newDelegate
!=
oldDelegate
&&
(
newDelegate
.
runtimeType
!=
oldDelegate
.
runtimeType
||
newDelegate
.
shouldRebuild
(
oldDelegate
)))
renderObject
.
triggerRebuild
();
...
...
@@ -134,21 +134,21 @@ class _SliverAppBarElement extends RenderObjectElement {
}
}
abstract
class
_Sliver
AppBa
rRenderObjectWidget
extends
RenderObjectWidget
{
_Sliver
AppBa
rRenderObjectWidget
({
abstract
class
_Sliver
PersistentHeade
rRenderObjectWidget
extends
RenderObjectWidget
{
_Sliver
PersistentHeade
rRenderObjectWidget
({
Key
key
,
@required
this
.
delegate
,
})
:
super
(
key:
key
)
{
assert
(
delegate
!=
null
);
}
final
Sliver
AppBa
rDelegate
delegate
;
final
Sliver
PersistentHeade
rDelegate
delegate
;
@override
_Sliver
AppBarElement
createElement
()
=>
new
_SliverAppBa
rElement
(
this
);
_Sliver
PersistentHeaderElement
createElement
()
=>
new
_SliverPersistentHeade
rElement
(
this
);
@override
_RenderSliver
AppBa
rForWidgetsMixin
createRenderObject
(
BuildContext
context
);
_RenderSliver
PersistentHeade
rForWidgetsMixin
createRenderObject
(
BuildContext
context
);
@override
void
debugFillDescription
(
List
<
String
>
description
)
{
...
...
@@ -157,8 +157,8 @@ abstract class _SliverAppBarRenderObjectWidget extends RenderObjectWidget {
}
}
abstract
class
_RenderSliver
AppBarForWidgetsMixin
implements
RenderSliverAppBa
r
{
_Sliver
AppBa
rElement
_element
;
abstract
class
_RenderSliver
PersistentHeaderForWidgetsMixin
implements
RenderSliverPersistentHeade
r
{
_Sliver
PersistentHeade
rElement
_element
;
@override
double
get
maxExtent
=>
_element
.
widget
.
delegate
.
maxExtent
;
...
...
@@ -175,54 +175,54 @@ abstract class _RenderSliverAppBarForWidgetsMixin implements RenderSliverAppBar
}
}
class
_SliverScrolling
AppBar
extends
_SliverAppBa
rRenderObjectWidget
{
_SliverScrolling
AppBa
r
({
class
_SliverScrolling
PersistentHeader
extends
_SliverPersistentHeade
rRenderObjectWidget
{
_SliverScrolling
PersistentHeade
r
({
Key
key
,
@required
Sliver
AppBa
rDelegate
delegate
,
@required
Sliver
PersistentHeade
rDelegate
delegate
,
})
:
super
(
key:
key
,
delegate:
delegate
);
@override
_RenderSliver
AppBa
rForWidgetsMixin
createRenderObject
(
BuildContext
context
)
{
return
new
_RenderSliverScrolling
AppBa
rForWidgets
();
_RenderSliver
PersistentHeade
rForWidgetsMixin
createRenderObject
(
BuildContext
context
)
{
return
new
_RenderSliverScrolling
PersistentHeade
rForWidgets
();
}
}
// This class exists to work around https://github.com/dart-lang/sdk/issues/15101
abstract
class
_RenderSliverScrolling
AppBar
extends
RenderSliverScrollingAppBa
r
{
}
abstract
class
_RenderSliverScrolling
PersistentHeader
extends
RenderSliverScrollingPersistentHeade
r
{
}
class
_RenderSliverScrolling
AppBarForWidgets
extends
_RenderSliverScrollingAppBa
r
with
_RenderSliver
AppBa
rForWidgetsMixin
{
}
class
_RenderSliverScrolling
PersistentHeaderForWidgets
extends
_RenderSliverScrollingPersistentHeade
r
with
_RenderSliver
PersistentHeade
rForWidgetsMixin
{
}
class
_SliverPinned
AppBar
extends
_SliverAppBa
rRenderObjectWidget
{
_SliverPinned
AppBa
r
({
class
_SliverPinned
PersistentHeader
extends
_SliverPersistentHeade
rRenderObjectWidget
{
_SliverPinned
PersistentHeade
r
({
Key
key
,
@required
Sliver
AppBa
rDelegate
delegate
,
@required
Sliver
PersistentHeade
rDelegate
delegate
,
})
:
super
(
key:
key
,
delegate:
delegate
);
@override
_RenderSliver
AppBa
rForWidgetsMixin
createRenderObject
(
BuildContext
context
)
{
return
new
_RenderSliverPinned
AppBa
rForWidgets
();
_RenderSliver
PersistentHeade
rForWidgetsMixin
createRenderObject
(
BuildContext
context
)
{
return
new
_RenderSliverPinned
PersistentHeade
rForWidgets
();
}
}
// This class exists to work around https://github.com/dart-lang/sdk/issues/15101
abstract
class
_RenderSliverPinned
AppBar
extends
RenderSliverPinnedAppBa
r
{
}
abstract
class
_RenderSliverPinned
PersistentHeader
extends
RenderSliverPinnedPersistentHeade
r
{
}
class
_RenderSliverPinned
AppBarForWidgets
extends
_RenderSliverPinnedAppBar
with
_RenderSliverAppBa
rForWidgetsMixin
{
}
class
_RenderSliverPinned
PersistentHeaderForWidgets
extends
_RenderSliverPinnedPersistentHeader
with
_RenderSliverPersistentHeade
rForWidgetsMixin
{
}
class
_SliverFloating
AppBar
extends
_SliverAppBa
rRenderObjectWidget
{
_SliverFloating
AppBa
r
({
class
_SliverFloating
PersistentHeader
extends
_SliverPersistentHeade
rRenderObjectWidget
{
_SliverFloating
PersistentHeade
r
({
Key
key
,
@required
Sliver
AppBa
rDelegate
delegate
,
@required
Sliver
PersistentHeade
rDelegate
delegate
,
})
:
super
(
key:
key
,
delegate:
delegate
);
@override
_RenderSliver
AppBa
rForWidgetsMixin
createRenderObject
(
BuildContext
context
)
{
return
new
_RenderSliverFloating
AppBa
rForWidgets
();
_RenderSliver
PersistentHeade
rForWidgetsMixin
createRenderObject
(
BuildContext
context
)
{
return
new
_RenderSliverFloating
PersistentHeade
rForWidgets
();
}
}
// This class exists to work around https://github.com/dart-lang/sdk/issues/15101
abstract
class
_RenderSliverFloating
AppBar
extends
RenderSliverFloatingAppBa
r
{
}
abstract
class
_RenderSliverFloating
PersistentHeader
extends
RenderSliverFloatingPersistentHeade
r
{
}
class
_RenderSliverFloating
AppBarForWidgets
extends
_RenderSliverFloatingAppBar
with
_RenderSliverAppBa
rForWidgetsMixin
{
}
class
_RenderSliverFloating
PersistentHeaderForWidgets
extends
_RenderSliverFloatingPersistentHeader
with
_RenderSliverPersistentHeade
rForWidgetsMixin
{
}
packages/flutter/lib/widgets.dart
View file @
b6aec82e
...
...
@@ -10,7 +10,6 @@ library widgets;
export
'src/widgets/animated_cross_fade.dart'
;
export
'src/widgets/animated_size.dart'
;
export
'src/widgets/app.dart'
;
export
'src/widgets/app_bar.dart'
;
export
'src/widgets/async.dart'
;
export
'src/widgets/banner.dart'
;
export
'src/widgets/basic.dart'
;
...
...
@@ -60,6 +59,7 @@ export 'src/widgets/semantics_debugger.dart';
export
'src/widgets/single_child_scroll_view.dart'
;
export
'src/widgets/size_changed_layout_notifier.dart'
;
export
'src/widgets/sliver.dart'
;
export
'src/widgets/sliver_persistent_header.dart'
;
export
'src/widgets/status_transitions.dart'
;
export
'src/widgets/table.dart'
;
export
'src/widgets/text.dart'
;
...
...
packages/flutter/test/widgets/slivers_appbar_floating_test.dart
View file @
b6aec82e
...
...
@@ -32,7 +32,7 @@ void main() {
axisDirection:
AxisDirection
.
down
,
slivers:
<
Widget
>[
new
BigSliver
(
height:
bigHeight
),
new
Sliver
AppBa
r
(
delegate:
new
TestDelegate
(),
floating:
true
),
new
Sliver
PersistentHeade
r
(
delegate:
new
TestDelegate
(),
floating:
true
),
new
BigSliver
(
height:
bigHeight
),
],
),
...
...
@@ -60,7 +60,7 @@ void main() {
axisDirection:
AxisDirection
.
down
,
slivers:
<
Widget
>[
new
BigSliver
(
key:
key1
=
new
GlobalKey
(),
height:
bigHeight
),
new
Sliver
AppBa
r
(
key:
key2
=
new
GlobalKey
(),
delegate:
delegate
,
floating:
true
),
new
Sliver
PersistentHeade
r
(
key:
key2
=
new
GlobalKey
(),
delegate:
delegate
,
floating:
true
),
new
BigSliver
(
key:
key3
=
new
GlobalKey
(),
height:
bigHeight
),
],
),
...
...
@@ -130,7 +130,7 @@ void main() {
axisDirection:
AxisDirection
.
down
,
slivers:
<
Widget
>[
new
BigSliver
(
key:
key1
=
new
GlobalKey
(),
height:
bigHeight
),
new
Sliver
AppBa
r
(
key:
key2
=
new
GlobalKey
(),
delegate:
delegate
,
floating:
true
),
new
Sliver
PersistentHeade
r
(
key:
key2
=
new
GlobalKey
(),
delegate:
delegate
,
floating:
true
),
new
BigSliver
(
key:
key3
=
new
GlobalKey
(),
height:
bigHeight
),
],
),
...
...
@@ -163,7 +163,7 @@ void main() {
axisDirection:
AxisDirection
.
down
,
slivers:
<
Widget
>[
new
BigSliver
(
key:
key1
=
new
GlobalKey
(),
height:
bigHeight
),
new
Sliver
AppBa
r
(
key:
key2
=
new
GlobalKey
(),
delegate:
delegate
,
floating:
true
),
new
Sliver
PersistentHeade
r
(
key:
key2
=
new
GlobalKey
(),
delegate:
delegate
,
floating:
true
),
new
BigSliver
(
key:
key3
=
new
GlobalKey
(),
height:
bigHeight
),
],
),
...
...
@@ -190,7 +190,7 @@ void main() {
});
}
class
TestDelegate
extends
Sliver
AppBa
rDelegate
{
class
TestDelegate
extends
Sliver
PersistentHeade
rDelegate
{
@override
double
get
maxExtent
=>
200.0
;
...
...
packages/flutter/test/widgets/slivers_appbar_pinned_test.dart
View file @
b6aec82e
...
...
@@ -33,8 +33,8 @@ void main() {
axisDirection:
AxisDirection
.
down
,
slivers:
<
Widget
>[
new
BigSliver
(
key:
key1
=
new
GlobalKey
(),
height:
bigHeight
),
new
Sliver
AppBa
r
(
key:
key2
=
new
GlobalKey
(),
delegate:
new
TestDelegate
(),
pinned:
true
),
new
Sliver
AppBa
r
(
key:
key3
=
new
GlobalKey
(),
delegate:
new
TestDelegate
(),
pinned:
true
),
new
Sliver
PersistentHeade
r
(
key:
key2
=
new
GlobalKey
(),
delegate:
new
TestDelegate
(),
pinned:
true
),
new
Sliver
PersistentHeade
r
(
key:
key3
=
new
GlobalKey
(),
delegate:
new
TestDelegate
(),
pinned:
true
),
new
BigSliver
(
key:
key4
=
new
GlobalKey
(),
height:
bigHeight
),
new
BigSliver
(
key:
key5
=
new
GlobalKey
(),
height:
bigHeight
),
],
...
...
@@ -67,8 +67,8 @@ void main() {
axisDirection:
AxisDirection
.
down
,
slivers:
<
Widget
>[
new
BigSliver
(
key:
key1
=
new
GlobalKey
(),
height:
bigHeight
),
new
Sliver
AppBa
r
(
key:
key2
=
new
GlobalKey
(),
delegate:
new
TestDelegate
(),
pinned:
true
),
new
Sliver
AppBa
r
(
key:
key3
=
new
GlobalKey
(),
delegate:
new
TestDelegate
(),
pinned:
true
),
new
Sliver
PersistentHeade
r
(
key:
key2
=
new
GlobalKey
(),
delegate:
new
TestDelegate
(),
pinned:
true
),
new
Sliver
PersistentHeade
r
(
key:
key3
=
new
GlobalKey
(),
delegate:
new
TestDelegate
(),
pinned:
true
),
new
BigSliver
(
key:
key4
=
new
GlobalKey
(),
height:
bigHeight
),
new
BigSliver
(
key:
key5
=
new
GlobalKey
(),
height:
bigHeight
),
],
...
...
@@ -157,8 +157,8 @@ void main() {
axisDirection:
AxisDirection
.
down
,
slivers:
<
Widget
>[
new
BigSliver
(
key:
key1
=
new
GlobalKey
(),
height:
bigHeight
),
new
Sliver
AppBa
r
(
key:
key2
=
new
GlobalKey
(),
delegate:
new
TestDelegate
(),
pinned:
true
),
new
Sliver
AppBa
r
(
key:
key3
=
new
GlobalKey
(),
delegate:
new
TestDelegate
(),
pinned:
true
),
new
Sliver
PersistentHeade
r
(
key:
key2
=
new
GlobalKey
(),
delegate:
new
TestDelegate
(),
pinned:
true
),
new
Sliver
PersistentHeade
r
(
key:
key3
=
new
GlobalKey
(),
delegate:
new
TestDelegate
(),
pinned:
true
),
new
BigSliver
(
key:
key4
=
new
GlobalKey
(),
height:
bigHeight
),
new
BigSliver
(
key:
key5
=
new
GlobalKey
(),
height:
bigHeight
),
],
...
...
@@ -184,7 +184,7 @@ void main() {
});
}
class
TestDelegate
extends
Sliver
AppBa
rDelegate
{
class
TestDelegate
extends
Sliver
PersistentHeade
rDelegate
{
@override
double
get
maxExtent
=>
200.0
;
...
...
packages/flutter/test/widgets/slivers_appbar_scrolling_test.dart
View file @
b6aec82e
...
...
@@ -24,8 +24,8 @@ void main() {
axisDirection:
AxisDirection
.
down
,
slivers:
<
Widget
>[
new
BigSliver
(
key:
key1
=
new
GlobalKey
()),
new
Sliver
AppBa
r
(
key:
key2
=
new
GlobalKey
(),
delegate:
new
TestDelegate
()),
new
Sliver
AppBa
r
(
key:
key3
=
new
GlobalKey
(),
delegate:
new
TestDelegate
()),
new
Sliver
PersistentHeade
r
(
key:
key2
=
new
GlobalKey
(),
delegate:
new
TestDelegate
()),
new
Sliver
PersistentHeade
r
(
key:
key3
=
new
GlobalKey
(),
delegate:
new
TestDelegate
()),
new
BigSliver
(
key:
key4
=
new
GlobalKey
()),
new
BigSliver
(
key:
key5
=
new
GlobalKey
()),
],
...
...
@@ -58,7 +58,7 @@ void main() {
axisDirection:
AxisDirection
.
down
,
slivers:
<
Widget
>[
new
BigSliver
(),
new
Sliver
AppBa
r
(
key:
key
,
delegate:
delegate
),
new
Sliver
PersistentHeade
r
(
key:
key
,
delegate:
delegate
),
new
BigSliver
(),
new
BigSliver
(),
],
...
...
@@ -73,7 +73,7 @@ void main() {
});
}
class
TestDelegate
extends
Sliver
AppBa
rDelegate
{
class
TestDelegate
extends
Sliver
PersistentHeade
rDelegate
{
@override
double
get
maxExtent
=>
200.0
;
...
...
packages/flutter/test/widgets/slivers_evil_test.dart
View file @
b6aec82e
...
...
@@ -9,8 +9,8 @@ import 'package:flutter/material.dart';
import
'test_widgets.dart'
;
class
TestSliver
AppBarDelegate
extends
SliverAppBa
rDelegate
{
TestSliver
AppBa
rDelegate
(
this
.
_maxExtent
);
class
TestSliver
PersistentHeaderDelegate
extends
SliverPersistentHeade
rDelegate
{
TestSliver
PersistentHeade
rDelegate
(
this
.
_maxExtent
);
final
double
_maxExtent
;
...
...
@@ -28,7 +28,7 @@ class TestSliverAppBarDelegate extends SliverAppBarDelegate {
}
@override
bool
shouldRebuild
(
TestSliver
AppBa
rDelegate
oldDelegate
)
=>
false
;
bool
shouldRebuild
(
TestSliver
PersistentHeade
rDelegate
oldDelegate
)
=>
false
;
}
class
TestBehavior
extends
ScrollBehavior2
{
...
...
@@ -84,38 +84,38 @@ void main() {
new
SliverToBoxAdapter
(
child:
new
Container
(
height:
520.0
)),
new
SliverToBoxAdapter
(
child:
new
Container
(
height:
520.0
)),
new
SliverToBoxAdapter
(
child:
new
Container
(
height:
520.0
)),
new
Sliver
AppBar
(
delegate:
new
TestSliverAppBa
rDelegate
(
150.0
),
pinned:
true
),
new
Sliver
PersistentHeader
(
delegate:
new
TestSliverPersistentHeade
rDelegate
(
150.0
),
pinned:
true
),
new
SliverToBoxAdapter
(
child:
new
Container
(
height:
520.0
)),
new
SliverPadding
(
padding:
new
EdgeInsets
.
all
(
50.0
),
child:
new
SliverToBoxAdapter
(
child:
new
Container
(
height:
520.0
)),
),
new
SliverToBoxAdapter
(
child:
new
Container
(
height:
520.0
)),
new
Sliver
AppBar
(
delegate:
new
TestSliverAppBa
rDelegate
(
150.0
),
floating:
true
),
new
Sliver
PersistentHeader
(
delegate:
new
TestSliverPersistentHeade
rDelegate
(
150.0
),
floating:
true
),
new
SliverToBoxAdapter
(
child:
new
Container
(
height:
520.0
)),
new
SliverToBoxAdapter
(
key:
centerKey
,
child:
new
Container
(
height:
520.0
)),
// ------------------------ CENTER ------------------------
new
Sliver
AppBar
(
delegate:
new
TestSliverAppBa
rDelegate
(
150.0
),
pinned:
true
),
new
Sliver
PersistentHeader
(
delegate:
new
TestSliverPersistentHeade
rDelegate
(
150.0
),
pinned:
true
),
new
SliverToBoxAdapter
(
child:
new
Container
(
height:
520.0
)),
new
SliverToBoxAdapter
(
child:
new
Container
(
height:
520.0
)),
new
SliverToBoxAdapter
(
child:
new
Container
(
height:
520.0
)),
new
SliverPadding
(
padding:
new
EdgeInsets
.
all
(
50.0
),
child:
new
Sliver
AppBar
(
delegate:
new
TestSliverAppBa
rDelegate
(
250.0
),
pinned:
true
),
child:
new
Sliver
PersistentHeader
(
delegate:
new
TestSliverPersistentHeade
rDelegate
(
250.0
),
pinned:
true
),
),
new
SliverToBoxAdapter
(
child:
new
Container
(
height:
520.0
)),
new
Sliver
AppBar
(
delegate:
new
TestSliverAppBa
rDelegate
(
250.0
),
pinned:
true
),
new
Sliver
PersistentHeader
(
delegate:
new
TestSliverPersistentHeade
rDelegate
(
250.0
),
pinned:
true
),
new
SliverToBoxAdapter
(
child:
new
Container
(
height:
5.0
)),
new
Sliver
AppBar
(
delegate:
new
TestSliverAppBa
rDelegate
(
250.0
),
pinned:
true
),
new
Sliver
PersistentHeader
(
delegate:
new
TestSliverPersistentHeade
rDelegate
(
250.0
),
pinned:
true
),
new
SliverToBoxAdapter
(
child:
new
Container
(
height:
5.0
)),
new
Sliver
AppBar
(
delegate:
new
TestSliverAppBa
rDelegate
(
250.0
),
pinned:
true
),
new
Sliver
AppBar
(
delegate:
new
TestSliverAppBa
rDelegate
(
250.0
),
pinned:
true
),
new
Sliver
PersistentHeader
(
delegate:
new
TestSliverPersistentHeade
rDelegate
(
250.0
),
pinned:
true
),
new
Sliver
PersistentHeader
(
delegate:
new
TestSliverPersistentHeade
rDelegate
(
250.0
),
pinned:
true
),
new
SliverToBoxAdapter
(
child:
new
Container
(
height:
5.0
)),
new
Sliver
AppBar
(
delegate:
new
TestSliverAppBa
rDelegate
(
250.0
),
pinned:
true
),
new
Sliver
AppBar
(
delegate:
new
TestSliverAppBa
rDelegate
(
250.0
)),
new
Sliver
PersistentHeader
(
delegate:
new
TestSliverPersistentHeade
rDelegate
(
250.0
),
pinned:
true
),
new
Sliver
PersistentHeader
(
delegate:
new
TestSliverPersistentHeade
rDelegate
(
250.0
)),
new
SliverToBoxAdapter
(
child:
new
Container
(
height:
520.0
)),
new
Sliver
AppBar
(
delegate:
new
TestSliverAppBa
rDelegate
(
150.0
),
floating:
true
),
new
Sliver
PersistentHeader
(
delegate:
new
TestSliverPersistentHeade
rDelegate
(
150.0
),
floating:
true
),
new
SliverToBoxAdapter
(
child:
new
Container
(
height:
520.0
)),
new
Sliver
AppBar
(
delegate:
new
TestSliverAppBa
rDelegate
(
150.0
),
floating:
true
),
new
Sliver
PersistentHeader
(
delegate:
new
TestSliverPersistentHeade
rDelegate
(
150.0
),
floating:
true
),
new
SliverToBoxAdapter
(
child:
new
Container
(
height:
5.0
)),
new
SliverList
(
delegate:
new
SliverChildListDelegate
(<
Widget
>[
...
...
@@ -136,9 +136,9 @@ void main() {
new
Container
(
height:
50.0
),
]),
),
new
Sliver
AppBar
(
delegate:
new
TestSliverAppBa
rDelegate
(
250.0
)),
new
Sliver
AppBar
(
delegate:
new
TestSliverAppBa
rDelegate
(
250.0
)),
new
Sliver
AppBar
(
delegate:
new
TestSliverAppBa
rDelegate
(
250.0
)),
new
Sliver
PersistentHeader
(
delegate:
new
TestSliverPersistentHeade
rDelegate
(
250.0
)),
new
Sliver
PersistentHeader
(
delegate:
new
TestSliverPersistentHeade
rDelegate
(
250.0
)),
new
Sliver
PersistentHeader
(
delegate:
new
TestSliverPersistentHeade
rDelegate
(
250.0
)),
new
SliverPadding
(
padding:
new
EdgeInsets
.
symmetric
(
horizontal:
50.0
),
child:
new
SliverToBoxAdapter
(
child:
new
Container
(
height:
520.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