Created
December 20, 2018 22:07
-
-
Save efortuna/44869ab8bfe2886121aa2f20e5fdc86c to your computer and use it in GitHub Desktop.
BUGGY Stateful tile swapping code
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
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