Created
July 18, 2017 21:24
-
-
Save collinjackson/81eae5d7c001dce37c6c8fb82529243a to your computer and use it in GitHub Desktop.
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'; | |
class Demo extends StatefulWidget { | |
@override | |
DemoState createState() => new DemoState(); | |
} | |
class DemoState extends State<Demo> with TickerProviderStateMixin { | |
@override | |
Widget build(BuildContext context) { | |
ThemeData themeData = Theme.of(context); | |
return new ListView.builder( | |
itemBuilder: (BuildContext context, int index) { | |
return new Container( | |
child: new Text("Foo $index", style: themeData.textTheme.display2), | |
); | |
}, | |
); | |
} | |
} | |
void main() { | |
ScrollController _scrollController = new ScrollController( | |
initialScrollOffset: 150.0, | |
); | |
runApp(new MaterialApp( | |
home: new NestedScrollView( | |
controller: _scrollController, | |
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { | |
return <Widget>[ | |
new SliverAppBar( | |
title: new Text('NestedScrollView demo'), | |
expandedHeight: 300.0, | |
pinned: true, | |
), | |
]; | |
}, | |
body: new Material( | |
child: new Demo(), | |
), | |
) | |
)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment