Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //called when the button is pressed to go to the next view
- void _pushSaved() {
- Navigator.of(context).push( //get the current navigator
- new MaterialPageRoute<void>( //A modal route that replaces the entire screen with a platform-adaptive transition.
- builder: (BuildContext context) {
- final Iterable<ListTile> tiles = _saved.map( //iterate through our saved cryptocurrencies sequentially
- (crypto) {
- return new ListTile( //same list tile as what we have shown in the previous page
- leading: _getLeadingWidget(crypto['name'], Colors.blue),
- title: Text(crypto['name']),
- subtitle: Text(
- cryptoPrice(crypto),
- style: _boldStyle,
- ),
- );
- },
- );
- final List<Widget> divided = ListTile.divideTiles( //divided tiles allows to insert the dividers for visually pleasing outcome
- context: context,
- tiles: tiles,
- ).toList();
- return new Scaffold( //return a new scaffold with a new appbar and listview as a body
- appBar: new AppBar(
- title: const Text('Saved Cryptos'),
- ),
- body: new ListView(children: divided),
- );
- },
- ),
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement