Skip to content

Instantly share code, notes, and snippets.

@fabiomsr
Last active December 9, 2018 16:30
Show Gist options
  • Save fabiomsr/3424bdd23a4b94d452381f491b6c42d8 to your computer and use it in GitHub Desktop.
Save fabiomsr/3424bdd23a4b94d452381f491b6c42d8 to your computer and use it in GitHub Desktop.
Navigator push
class _ContactListState extends State<ContactList> implements ContactListViewContract {
// ...
List<_ContactListItem> _buildContactList() {
return _contacts.map((contact) =>
_ContactListItem (
contact: contact,
onTap: () { _showContactPage(context, contact); }
))
.toList();
}
void _showContactPage(BuildContext context, Contact contact) {
Navigator.push(context, MaterialPageRoute<Null>(
settings: const RouteSettings(name: ContactPage.routeName),
builder: (BuildContext context) => ContactPage(contact)
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment