Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. //called when the button is pressed to go to the next view
  2. void _pushSaved() {
  3. Navigator.of(context).push( //get the current navigator
  4. new MaterialPageRoute<void>( //A modal route that replaces the entire screen with a platform-adaptive transition.
  5. builder: (BuildContext context) {
  6. final Iterable<ListTile> tiles = _saved.map( //iterate through our saved cryptocurrencies sequentially
  7. (crypto) {
  8. return new ListTile( //same list tile as what we have shown in the previous page
  9. leading: _getLeadingWidget(crypto['name'], Colors.blue),
  10. title: Text(crypto['name']),
  11. subtitle: Text(
  12. cryptoPrice(crypto),
  13. style: _boldStyle,
  14. ),
  15. );
  16. },
  17. );
  18. final List<Widget> divided = ListTile.divideTiles( //divided tiles allows to insert the dividers for visually pleasing outcome
  19. context: context,
  20. tiles: tiles,
  21. ).toList();
  22. return new Scaffold( //return a new scaffold with a new appbar and listview as a body
  23. appBar: new AppBar(
  24. title: const Text('Saved Cryptos'),
  25. ),
  26. body: new ListView(children: divided),
  27. );
  28. },
  29. ),
  30. );
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement