-
-
Notifications
You must be signed in to change notification settings - Fork 182
/
Copy pathmix_slivers.dart
62 lines (56 loc) · 1.41 KB
/
mix_slivers.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import 'package:flutter/material.dart';
import 'package:flutter_sticky_header/flutter_sticky_header.dart';
import '../common.dart';
class MixSliversExample extends StatelessWidget {
const MixSliversExample({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return AppScaffold(
title: 'List Example',
slivers: [
SliverAppBar(
backgroundColor: Colors.orange,
title: Text('SliverAppBar'),
automaticallyImplyLeading: false,
pinned: true,
),
SliverToBoxAdapter(
child: Container(
height: 50,
color: Colors.red,
),
),
_StickyHeaderList(index: 0),
_StickyHeaderList(index: 1),
_StickyHeaderList(index: 2),
_StickyHeaderList(index: 3),
],
);
}
}
class _StickyHeaderList extends StatelessWidget {
const _StickyHeaderList({
Key? key,
this.index,
}) : super(key: key);
final int? index;
@override
Widget build(BuildContext context) {
return SliverStickyHeader(
header: Header(index: index),
sliver: SliverList(
delegate: SliverChildBuilderDelegate(
(context, i) => ListTile(
leading: CircleAvatar(
child: Text('$index'),
),
title: Text('List tile #$i'),
),
childCount: 6,
),
),
);
}
}