Open direct2harsh opened 1 year ago
I have same issue with this plugin...
Please tell me How can I Change convex appbar current index programatically ?
My Convex Widget :
bottomNavigationBar: ConvexAppBar.builder(
itemBuilder: Builder(),
count: 5,
height: 61,
backgroundColor: AppColors.mainBlueColor,
onTap: (int i) {
controller.selectPage(i);
},
),
Item Builder :
class Builder extends DelegateBuilder {
var icons=[[Images.icHome,"Home"],[Images.icHistory,"History"],[Images.avtar,"Profile"],[Images.icGame,"Game"],[Images.icReward,"Reward"],];
@override
Widget build(
BuildContext context,
int index,
bool active,
) {
if (index == 2) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
height: 10,
),
Container(
height: active ? 45 : 36,
width: active ? 45 : 36,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: active ? Colors.white : AppColors.darkBlueColor,
),
padding: EdgeInsets.all(2),
child: CircleAvatar(
backgroundImage: AssetImage(Images.avtar),
)),
SizedBox(
height: active ? 4 : 1,
),
Text(
"Profile",
style: TextStyle(
fontFamily: Fonts.albertsans,
fontSize: 12,
color: active ? Colors.white : AppColors.darkBlueColor),
),
],
);
}
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
height: 10,
),
SvgPicture.asset(
icons[index][0],
height: active ? 34 : 30,
width: active ? 34 : 30,
color: active ? Colors.white : AppColors.darkBlueColor,
),
SizedBox(
height: 5,
),
Text(
icons[index][1],
style: TextStyle(
fontFamily: Fonts.albertsans,
fontSize: 12,
color: active ? Colors.white : AppColors.darkBlueColor,
),
),
SizedBox(
height: 2,
),
],
);
}
}
Hi, I need to change index (navigate to another page using Page Controller) by click on a TextButton. I am able to switch to another page but the Convex_bottom_bar does not change the UI for the current page like the active Tab text and Convex radius. It stays the same as default index of 0.
I created a Global key and used it like - final ConvexAppBar navigationBar = bottomNAVKey.currentWidget; navigationBar.onTap(1);
Any help is appreciated.