Created
July 20, 2019 13:49
-
-
Save passsy/589734966acdcc18050b9419b5b0197b to your computer and use it in GitHub Desktop.
Flutter ListView with fixed header expanding below system navigation
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(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: HomePage(), | |
); | |
} | |
} | |
class HomePage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text("Personal Expenses"), | |
), | |
body: Column( | |
children: <Widget>[ | |
Card( | |
child: Container( | |
color: Colors.white, | |
height: 200, | |
child: Center(child: Text("I'm a fixed list header"),), | |
), | |
), | |
Expanded(child: | |
ListView.builder( | |
itemBuilder: (context, index) { | |
return Card( | |
child: ListTile( | |
title: Text("Title $index"), | |
subtitle: Text("Jul 20, 2019"), | |
leading: CircleAvatar( | |
child: Text( | |
"$index", | |
style: TextStyle(color: Colors.white), | |
), | |
backgroundColor: Colors.green, | |
), | |
), | |
); | |
}, | |
itemCount: 15, | |
), | |
), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment