Решил сделать навигацию по приложению через BottomNavigationBar, а в 'body' указываю индекс той страницы, на которой находится пользователь. Если запустить код так, то будет пустой белый лист. Если же убрать body, код запускается, но пользователь не сможет перемещаться по страницам. Не понимаю в чём ошибка
import 'package:incelynn_todo/pages/home.dart';
class MyCompany extends StatefulWidget {
const MyCompany({Key? key}) : super(key: key);
@override
State<MyCompany> createState() => _MyCompanyState();
}
class _MyCompanyState extends State<MyCompany> {
int currentIndex = 0;
final screens = [
const Home(),
const MyCompany(),
];
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.black87,
appBar: AppBar(
title: Text('StartUp!'),
backgroundColor: Colors.white12,
centerTitle: true,
),
body: IndexedStack(
index: currentIndex,
children: screens,
),
bottomNavigationBar: BottomNavigationBar(
backgroundColor: Colors.white12,
fixedColor: Colors.white70,
unselectedItemColor: Colors.white30,
currentIndex: currentIndex,
onTap: (index) => setState(() => currentIndex = index),
items: const [
BottomNavigationBarItem(label: ('Home'), icon: Icon(Icons.home)),
BottomNavigationBarItem(
label: ('Company'), icon: Icon(Icons.business)),
],
),
);
}
}```