Skip to content

Instantly share code, notes, and snippets.

@passsy
Created July 20, 2019 13:49
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 passsy/589734966acdcc18050b9419b5b0197b to your computer and use it in GitHub Desktop.
Save passsy/589734966acdcc18050b9419b5b0197b to your computer and use it in GitHub Desktop.
Flutter ListView with fixed header expanding below system navigation
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