-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathmulti_sliver.dart
30 lines (25 loc) · 995 Bytes
/
multi_sliver.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import 'package:flutter/widgets.dart';
import 'rendering/multi_sliver.dart';
/// [MultiSliver] allows for returning multiple slivers from a single build method
class MultiSliver extends MultiChildRenderObjectWidget {
// flutter pre 3.13 does not allow the constructor to be const
// ignore: prefer_const_constructors_in_immutables
MultiSliver({
Key? key,
required List<Widget> children,
this.pushPinnedChildren = false,
}) : super(key: key, children: children);
/// If true any children that paint beyond the layoutExtent of the entire [MultiSliver] will
/// be pushed off towards the leading edge of the [Viewport]
final bool pushPinnedChildren;
@override
RenderMultiSliver createRenderObject(BuildContext context) =>
RenderMultiSliver(
containing: pushPinnedChildren,
);
@override
void updateRenderObject(
BuildContext context, covariant RenderMultiSliver renderObject) {
renderObject.containing = pushPinnedChildren;
}
}