added comments and refactored code
This commit is contained in:
@@ -5,6 +5,7 @@ import 'map_page.dart';
|
||||
|
||||
class MainNavigationScaffold extends StatefulWidget {
|
||||
const MainNavigationScaffold({super.key});
|
||||
|
||||
static const routeName = '/';
|
||||
|
||||
@override
|
||||
@@ -12,13 +13,13 @@ class MainNavigationScaffold extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MainNavigationScaffoldState extends State<MainNavigationScaffold> {
|
||||
int _selectedPageIndex = 0;
|
||||
|
||||
final List<Widget> _pages = [
|
||||
const LandingPage(),
|
||||
const MapPage(),
|
||||
];
|
||||
|
||||
int _selectedPageIndex = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -32,6 +33,7 @@ class _MainNavigationScaffoldState extends State<MainNavigationScaffold> {
|
||||
NavigationDestination(icon: Icon(Icons.map_outlined), label: 'Map'),
|
||||
],
|
||||
),
|
||||
// Used IndexedStack to save the page state while navigating
|
||||
body: IndexedStack(
|
||||
index: _selectedPageIndex,
|
||||
children: _pages,
|
||||
|
||||
Reference in New Issue
Block a user