Page Navigation code in flutter programming
import ‘package:flutter/material.dart’;
import ‘package:stateful_project/Page2.dart’;
class Page1 extends StatelessWidget
{
@override
Widget build(BuildContext context)
{
return Scaffold
(
floatingActionButton: FloatingActionButton
(
child: Icon(Icons.add_box),
onPressed: ()
{
Navigator.push
(
context, MaterialPageRoute
(
builder: (context)
{
return Page2();
}
)
);
}
),
);
import ‘package:flutter/material.dart’;
import ‘package:stateful_project/Page1.dart’;
class Page2 extends StatelessWidget
{
@override
Widget build(BuildContext context)
{
return Scaffold
(
floatingActionButton: FloatingActionButton
(
child: Icon(Icons.add_box),
onPressed: ()
{
Navigator.push
(
context, MaterialPageRoute
(
builder: (context)
{
return Page1();
}
)
);
}
),
);
}
}
}
}