Skip to content

Instantly share code, notes, and snippets.

@collinjackson
Created July 18, 2017 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save collinjackson/81eae5d7c001dce37c6c8fb82529243a to your computer and use it in GitHub Desktop.
Save collinjackson/81eae5d7c001dce37c6c8fb82529243a to your computer and use it in GitHub Desktop.
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