Skip to content

Instantly share code, notes, and snippets.

@efortuna
Created December 20, 2018 22:07
Show Gist options
  • Save efortuna/44869ab8bfe2886121aa2f20e5fdc86c to your computer and use it in GitHub Desktop.
Save efortuna/44869ab8bfe2886121aa2f20e5fdc86c to your computer and use it in GitHub Desktop.
BUGGY Stateful tile swapping code
List<Widget> tiles = [
StatefulColorfulTile(),
StatefulColorfulTile(),
];
...
class StatefulColorfulTile extends StatefulWidget {
@override
ColorfulTileState createState() => ColorfulTileState();
}
class ColorfulTileState extends State<ColorfulTile> {
Color myColor;
@override
void initState() {
super.initState();
myColor = UniqueColorGenerator.getColor();
}
@override
Widget build(BuildContext context) {
return Container(
color: myColor,
child: Padding(
padding: EdgeInsets.all(70.0),
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment