In the homepage i am calling widget to my body main.dart base on navigation bar option, in the homepage it has a list of images, if i click one of the images, it shows me the detail. the problem is the navigation bar in the detail page still show. How to hide the navigation bar?
Main.dart
class MyApp extends StatefulWidget {
@override
_NavState createState() => _NavState();
}
class _NavState extends State {
int _selectedIndex = 0;
final _widgetOptions = [
Breakfast(),
Desert(),
];
@override
Widget build(BuildContext context) {
return Scaffold(
body: _widgetOptions.elementAt(_selectedIndex),
bottomNavigationBar: Container(
color: Colors.grey[100],
child: DefaultTabController(
length: 2,
child: TabBar(
indicatorColor: Colors.grey,
labelColor: Colors.blueAccent,
unselectedLabelColor: Colors.grey,
onTap: _onItemTapped,
tabs: [
Tab(
text: 'Breakfast',
),
Tab(
text: 'Dessert',
),
],
),
),
),
);
}
void _onItemTapped(int index) {
setState(() {
_selectedIndex = index;
});
}
}
One of widget that i call to my homepage
class Breakfast extends StatelessWidget {
@override
Widget build(BuildContext context) {
final title = "Fatoni's Resto Menu";
return MaterialApp(
title: title,
home: Scaffold(
appBar: AppBar(
title: Text(title),
actions: <Widget>[
IconButton(
icon: Icon(Icons.settings),
onPressed: () {},
)
],
),
body: GridView.builder(
itemCount: DataBreakfast.listViewData.length,
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2),
itemBuilder: (context, index) {
return Column(
children: <Widget>[
Expanded(
child: Card(
margin: EdgeInsets.all(10.0),
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return DetailScreen(
name: DataBreakfast.listViewData[index],
image: DataBreakfast.listViewDataImage[index],
info: DataBreakfast.listViewDataInfo[index],
index: index);
},
),
);
},
),
),
)
],
);
},
),
),
);
}
}