I added to my code the FlashyBar flutter package but I don’t know how to connect to another page when you press any icon from the bar. I tried to add onPressed or onTap but gives error. I see in the beginning some tabItems , should I change something there?
Here is the code
import 'package:flutter/material.dart';
import 'post_detail.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:flutter/cupertino.dart';
import 'package:flashy_tab_bar2/flashy_tab_bar2.dart';
import 'Influencerprofile.dart';
import 'package:liquid_pull_to_refresh/liquid_pull_to_refresh.dart';
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
int _selectedIndex = 0;
List<Widget> tabItems = [
Center(child: Text("0")),
Center(child: Text("1")),
Center(child: Text("2")),
Center(child: Text("3")),
Center(child: Text("4"))
];
@override
void initState() {
super.initState();
}
Future<void> _handleRefresh() async {
return await Future.delayed(Duration(seconds: 1));
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Colors.black,
title: Text(
'INFLUFIT.CLUB',
style: GoogleFonts.bebasNeue(
fontWeight: FontWeight.bold, fontSize: 30, color: Colors.white),
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(30),
),
),
),
body: Padding(
padding: const EdgeInsets.all(10.0),
child: Column(children: [
Container(
child: Stack(alignment: Alignment.bottomLeft, children: [
Align(
alignment: Alignment.topCenter,
child: Padding(
padding: const EdgeInsets.all(10.0),
child: TextField(
readOnly: true,
decoration: InputDecoration(
hintText: "Search influencer",
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(50),
borderSide: BorderSide.none,
),
fillColor: Colors.black.withOpacity(0.1),
filled: true,
),
)))
])),
SizedBox(
height: 10,
),
Container(
alignment: Alignment.centerRight,
child: Text(
'Location',
style: TextStyle(),
)),
Expanded(
child: LiquidPullToRefresh(
// key: _refreshIndicatorKey, // key if you want to add
onRefresh: _handleRefresh,
color: Colors.black,
child: ListView.builder(
itemCount: tabItems.length,
itemBuilder: (context, index) => PostDetail(),
),
),
),
]),
),
bottomNavigationBar: FlashyTabBar(
selectedIndex: _selectedIndex,
showElevation: true,
onItemSelected: (index) => setState(() {
_selectedIndex = index;
}),
items: [
FlashyTabBarItem(
icon: Icon(Icons.home),
title: Text('Feed'),
),
FlashyTabBarItem(
icon: Icon(Icons.favorite),
title: Text('Favourites'),
),
FlashyTabBarItem(
icon: Icon(Icons.add),
title: Text('Add'),
),
FlashyTabBarItem(
icon: Icon(
Icons.notifications_active_outlined,
),
title: Text('News'),
),
FlashyTabBarItem(
icon: Icon(Icons.person),
title: Text('My profile'),
),
],
),
);
}
}
What I should do? It has to do something with the Index?