Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Flex layout issues.
import 'package:flutter/material.dart';
void main() {
runApp(new AnimatedListSample());
}
class AnimatedListSample extends StatelessWidget{
final GlobalKey<AnimatedListState> _listKey =
new GlobalKey<AnimatedListState>();
// Used to build list items.
Widget _buildItem(
BuildContext context, int index, Animation<double> animation) {
var clr = Colors.blue;
if ( (index % 2) == 1 ) {
clr = Colors.red;
}
return new Container(
color: clr,
height: 100.0
);
}
@override
Widget build(BuildContext context) {
var list = new AnimatedList(
key: _listKey,
initialItemCount: 3,
itemBuilder: _buildItem,
padding: new EdgeInsets.all(0.0),
);
var widget = new MaterialApp(
home: new Scaffold(
body: new Container(
color: Colors.white,
child: new Column(
children: <Widget>[
new Container(
color: Colors.grey,
child: new Column(
children: <Widget>[
new Expanded( child:list),
/*
My other widgets
*/
],
)
),
/*
My other widgets
*/
],
)
)
),
);
return widget;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment