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'; | |
import 'package:flutter/gestures.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: MyHomePage(title: 'Flutter Demo Home Page'), |
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
void main() => runApp(new MaterialApp(home: PositionedTiles())); | |
class PositionedTiles extends StatefulWidget { | |
@override | |
State<StatefulWidget> createState() => PositionedTilesState(); | |
} | |
class PositionedTilesState extends State<PositionedTiles> { | |
List<Widget> tiles = [ | |
Padding( |
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
void main() => runApp(new MaterialApp(home: PositionedTiles())); | |
class PositionedTiles extends StatefulWidget { | |
@override | |
State<StatefulWidget> createState() => PositionedTilesState(); | |
} | |
class PositionedTilesState extends State<PositionedTiles> { | |
// Stateful tiles now wrapped in padding (a stateless widget) to increase height | |
// of widget tree and show why keys are needed at the Padding level. |
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(key: UniqueKey()), // Keys added here | |
StatefulColorfulTile(key: UniqueKey()), | |
]; | |
... | |
class StatefulColorfulTile extends StatefulWidget { | |
StatefulColorfulTile({Key key}) : super(key: key); // NEW CONSTRUCTOR | |
@override |
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(); | |
} |
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
void main() => runApp(new MaterialApp(home: PositionedTiles())); | |
class PositionedTiles extends StatefulWidget { | |
@override | |
State<StatefulWidget> createState() => PositionedTilesState(); | |
} | |
class PositionedTilesState extends State<PositionedTiles> { | |
List<Widget> tiles = [ | |
StatelessColorfulTile(), |
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
class WikipediaExplorer extends StatefulWidget { | |
@override | |
_WikipediaExplorerState createState() => _WikipediaExplorerState(); | |
} | |
class _WikipediaExplorerState extends State<WikipediaExplorer> { | |
Completer<WebViewController> _controller = Completer<WebViewController>(); | |
final Set<String> _favorites = Set<String>(); | |
@override |