Skip to content

Instantly share code, notes, and snippets.

@tmenyhart
Created April 23, 2018 18:11
Show Gist options
  • Select an option

  • Save tmenyhart/8b2effb175398f91098de38a005627f3 to your computer and use it in GitHub Desktop.

Select an option

Save tmenyhart/8b2effb175398f91098de38a005627f3 to your computer and use it in GitHub Desktop.
Flutter Kickstart - Navigation, material page route
import 'package:flutter/material.dart';
import 'package:flutter_example/widgets/details_screen_widget.dart';
class ListScreenWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Center(
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text('List Screen!'),
new RaisedButton(
onPressed: () => _navigateToDetailsScreen(context),
child: new Text('Navigate to ListScreen!'),
),
new RaisedButton(
onPressed: () => Navigator.of(context).pop(),
child: new Text('Back to HomeScreen!'),
)
],
),
);
}
void _navigateToDetailsScreen(BuildContext context) {
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new DetailsScreen(),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment