|
@@ -10,34 +10,46 @@ class FriendsPage extends StatefulWidget {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
class _FriendsPageState extends State<FriendsPage> {
|
|
class _FriendsPageState extends State<FriendsPage> {
|
|
|
- int _selectedIndex = 0;
|
|
|
|
|
-
|
|
|
|
|
static const List<Widget> _widgets = [
|
|
static const List<Widget> _widgets = [
|
|
|
FriendsList(),
|
|
FriendsList(),
|
|
|
Requests(),
|
|
Requests(),
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
- void _onItemTapped(int index) {
|
|
|
|
|
- setState(() {
|
|
|
|
|
- _selectedIndex = index;
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
@override
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
|
- return Scaffold(
|
|
|
|
|
- bottomNavigationBar: BottomNavigationBar(
|
|
|
|
|
- items: const [
|
|
|
|
|
- BottomNavigationBarItem(icon: Icon(Icons.people), label: 'Friends'),
|
|
|
|
|
- BottomNavigationBarItem(icon: Icon(Icons.notifications), label: 'Requests'),
|
|
|
|
|
- ],
|
|
|
|
|
- currentIndex: _selectedIndex,
|
|
|
|
|
- onTap: _onItemTapped,
|
|
|
|
|
|
|
+ return DefaultTabController(
|
|
|
|
|
+ length: 2,
|
|
|
|
|
+ child: Scaffold(
|
|
|
|
|
+ appBar: AppBar(
|
|
|
|
|
+ automaticallyImplyLeading: false,
|
|
|
|
|
+ bottom: TabBar(
|
|
|
|
|
+ tabs: [
|
|
|
|
|
+ Tab(
|
|
|
|
|
+ child: Column(
|
|
|
|
|
+ children: const [
|
|
|
|
|
+ Icon(Icons.people),
|
|
|
|
|
+ Text("Friends"),
|
|
|
|
|
+ ],
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ Tab(
|
|
|
|
|
+ child: Column(
|
|
|
|
|
+ children: const [
|
|
|
|
|
+ Icon(Icons.notifications),
|
|
|
|
|
+ Text("Requests"),
|
|
|
|
|
+ ],
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ ],
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ body: const Center(
|
|
|
|
|
+ child: Padding(
|
|
|
|
|
+ padding: EdgeInsets.all(32.0),
|
|
|
|
|
+ child: TabBarView(children: _widgets),
|
|
|
|
|
+ ),
|
|
|
),
|
|
),
|
|
|
- body: Center(
|
|
|
|
|
- child: Padding(
|
|
|
|
|
- padding: const EdgeInsets.all(32.0),
|
|
|
|
|
- child: _widgets[_selectedIndex],
|
|
|
|
|
- )));
|
|
|
|
|
|
|
+ ),
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|