right7ctrl/flutter_floating_bottom_navigation_bar

How to navigate between pages?

Closed this issue · 3 comments

I installed this and paste your codes to my three pages with their index defined at top. But i am still in my index 0 page whenever i click the button.

`import 'package:floating_bottom_navigation_bar/floating_bottom_navigation_bar.dart';
import 'package:flutter/material.dart';
import 'package:hisobu/magrupu/pages/post.dart';
import 'admin.dart';
import 'categories/business.dart';
import 'categories/education.dart';
import 'categories/entertainment.dart';
import 'categories/jamii.dart';
import 'categories/sports.dart';
import 'categories/technology.dart';
import 'home_page.dart';

class CategoriesGroup extends StatefulWidget {
const CategoriesGroup({Key? key}) : super(key: key);

@OverRide
_CategoriesGroupState createState() => _CategoriesGroupState();
}

class _CategoriesGroupState extends State {
get isMovbile => true;
int _index = 1;
@OverRide
Widget build(BuildContext context) {
return Scaffold(
extendBody: true,
backgroundColor: const Color(0xffffeaee),
appBar: AppBar(
backgroundColor: const Color(0xffa54f39),
actions: [
IconButton(
icon: const Icon(Icons.admin_panel_settings,
size: 35, color: Color(0xFF9C8875)),
color: Colors.black,
onPressed: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => const AdminPage()));
},
),
],
// backgroundColor: Colors.white,
title: Text(
'Categories',
// style: GoogleFonts.pacifico(),
),
),
body: GridView(
padding: const EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 16),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
crossAxisSpacing: 16,
mainAxisSpacing: 16,
),
children: [
InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => const Entertainment()));
},
child: Semantics(label: 'Clickable container',
child: Container(
color: Colors.blueGrey,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Semantics(label: 'icon',
child: const Icon(
Icons.center_focus_strong_outlined,
size: 50,
),
),
Semantics(label: 'Entertainment',
child: const ExcludeSemantics(
child: Text(
'Entertainment',
style: TextStyle(color: Colors.white, fontSize: 19),
),
),
),
],
))),
)
),
InkWell(
onTap: () {
Navigator.push(
context, MaterialPageRoute(builder: (context) => const Sports()));
},
child: Semantics(label: 'Clickable container',
child: Container(
color: Colors.blueGrey,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Semantics(label: 'icon',
child: const Icon(
Icons.center_focus_strong_outlined,
size: 50,
),
),
Semantics(label: 'Sports',
child: const ExcludeSemantics(
child: Text(
'Sports',
style: TextStyle(color: Colors.white, fontSize: 19),
),
),
),
],
))),
)
),
InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => Education()));
},
child: Semantics(label: 'Clickable container',
child: Container(
color: Colors.blueGrey,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Semantics(label: 'icon',
child: const Icon(
Icons.center_focus_strong_outlined,
size: 50,
),
),
Semantics(label: 'Education',
child: const ExcludeSemantics(
child: Text(
'Education',
style: TextStyle(color: Colors.white, fontSize: 19),
),
),
),
],
))),
)
),
InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => Business()));
},
child: Semantics(label: 'Clickable container',
child: Container(
color: Colors.blueGrey,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Semantics(label: 'icon',
child: const Icon(
Icons.center_focus_strong_outlined,
size: 50,
),
),
Semantics(label: 'Business',
child: const ExcludeSemantics(
child: Text(
'Business',
style: TextStyle(color: Colors.white, fontSize: 19),
),
),
),
],
))),
)
),
InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => Technology()));
},
child: Semantics(label: 'Clickable container',
child: Container(
color: Colors.blueGrey,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Semantics(label: 'icon',
child: const Icon(
Icons.center_focus_strong_outlined,
size: 50,
),
),
Semantics(label: 'Technology',
child: const ExcludeSemantics(
child: Text(
'Technology',
style: TextStyle(color: Colors.white, fontSize: 19),
),
),
),
],
))),
)
),
InkWell(
onTap: () {
Navigator.push(
context, MaterialPageRoute(builder: (context) => const Jamii()));
},
child: Semantics(label: 'Clickable container',
child: Container(
color: Colors.blueGrey,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Semantics(label: 'icon',
child: const Icon(
Icons.center_focus_strong_outlined,
size: 50,
),
),
Semantics(label: 'Community',
child: const ExcludeSemantics(
child: Text(
'Community',
style: TextStyle(color: Colors.white, fontSize: 19),
),
),
),
],
))),
)
),
],
),
bottomNavigationBar: FloatingNavbar(
onTap: (int val) => setState(() => _index = val),
currentIndex: _index,
items: [
FloatingNavbarItem(icon: Icons.home, title: 'Home'),
FloatingNavbarItem(icon: Icons.category, title: 'Explore'),
FloatingNavbarItem(icon: Icons.add_box, title: 'Add'),
],
),
);
}
}`

That is my second page. But i cant go to it

Its not a related question/issue