import 'package:flutter/material.dart';
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Home Page'),
),
body: Center(
child: RaisedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => AnotherPage()),
);
},
child: Text('Go to Another Page'),
),
),
);
}
}
class AnotherPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Another Page'),
),
body: Center(
child: Text('Welcome to Another Page!'),
),
);
}
}
void main() {
runApp(MaterialApp(
home: HomePage(),
));
}