Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import 'package:flutter/cupertino.dart' show CupertinoPageRoute;
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
home: HomePage(),
),
);
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
child: Center(
child: InkWell(
onTap: () => Navigator.of(context).push(PageTwo.route()),
child: Text('Clicky Here for page 2'),
),
),
),
);
}
}
class PageTwo extends StatelessWidget {
static Route<dynamic> route() {
return CupertinoPageRoute(
builder: (BuildContext context) {
return PageTwo();
},
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
child: Center(
child: Text('Page Two'),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment