Skip to content

Instantly share code, notes, and snippets.

@iapicca
Created November 1, 2019 08:13
Show Gist options
  • Save iapicca/fae4811a12915b61b4e0edc3ea2a3a2b to your computer and use it in GitHub Desktop.
Save iapicca/fae4811a12915b61b4e0edc3ea2a3a2b to your computer and use it in GitHub Desktop.
Sliver Scrolling Test
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