body:Container(
//child: IndexedStack(
//index: _selectedIndex,
//children: _items
//)//_items.elementAt(_index),
height: MediaQuery.of(context).size.height*0.25,
margin: EdgeInsets.all(20),
alignment: Alignment.topCenter,
child: IndexedStack(
index: _selectedIndex,
children: [
ElevatedButton(
style: ElevatedButton.styleFrom(
minimumSize: const
Size.fromHeight(50)
),
child: Text('SUBUH'),
onPressed: (){
Navigator.push(context,
MaterialPageRoute(
builder: (context) => halamansubuh(
)
),
ElevatedButton(
style: ElevatedButton.styleFrom(
minimumSize: const
Size.fromHeight(100)
),
child: Text('ZUHUR'),
onPressed: (){
Navigator.push(context,
MaterialPageRoute(
builder: (context) => halamanzuhur(title: 'halamanzuhur', desc: 'halamanzuhur',
)
));
}
),
);
}
)
Replace your code with this code
Container(
//child: IndexedStack(
//index: _selectedIndex,
//children: _items
//)//_items.elementAt(_index),
height: MediaQuery.of(context).size.height*0.25,
margin: EdgeInsets.all(20),
alignment: Alignment.topCenter,
child: IndexedStack(
index: _selectedIndex,
children: [
ElevatedButton(
style: ElevatedButton.styleFrom(
minimumSize: const
Size.fromHeight(50)
),
child: Text('SUBUH'),
onPressed: (){
Navigator.push(context,
MaterialPageRoute(
builder: (context) => halamansubuh(
)
),);}),
ElevatedButton(
style: ElevatedButton.styleFrom(
minimumSize: const
Size.fromHeight(100)
),
child: Text('ZUHUR'),
onPressed: (){
Navigator.push(context,
MaterialPageRoute(
builder: (context) => halamanzuhur(title: 'halamanzuhur', desc: 'halamanzuhur',
)
));
}
),
]
));