Вы можете сделать это так
import 'package:flutter/material.dart';
class Test extends StatefulWidget {
@override
TestState createState() {
return new TestState();
}
}
class TestState extends State<Test> {
int _currentIndex = 0;
@override
Widget build(BuildContext context) {
return new Scaffold(
bottomNavigationBar: new BottomNavigationBar(
currentIndex: _currentIndex,
onTap: (newIndex) => setState((){_currentIndex = newIndex;}),
items: [
new BottomNavigationBarItem(
icon: new Icon(Icons.add),
title: new Text("trends")
),
new BottomNavigationBarItem(
icon: new Icon(Icons.location_on),
title: new Text("feed")
),
new BottomNavigationBarItem(
icon: new Icon(Icons.people),
title: new Text("community")
),
],
),
body: new IndexedStack(
index: _currentIndex,
children: <Widget>[
new YourCustomTrendsWidget(),
new YourCustomFeedWidget(),
new YourCustomCommunityWidget(),
],
),
);
}
}