Created
November 1, 2019 08:13
-
-
Save iapicca/fae4811a12915b61b4e0edc3ea2a3a2b to your computer and use it in GitHub Desktop.
Sliver Scrolling Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(MaterialApp(home: MyApp())); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) => Scaffold( | |
body: CustomScrollView( | |
slivers: <Widget>[ | |
SliverPersistentHeader( | |
delegate: _HeaderDelegate(), | |
pinned: true, | |
), | |
SliverList( | |
delegate: SliverChildBuilderDelegate( | |
(_, i) => Text(i.toString(), style: TextStyle(fontSize: 40),), | |
childCount: 100, | |
), | |
),],),); | |
} | |
class _HeaderDelegate extends SliverPersistentHeaderDelegate { | |
@override | |
double minExtent = 80; | |
@override | |
double maxExtent = 160; | |
@override | |
Widget build(BuildContext context,double shrinkOffset,bool overlapsContent,) => Container(color: Colors.pink,); | |
@override | |
bool shouldRebuild(_HeaderDelegate oldDelegate) => false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment