#3 bottomNavigationBar & PageView()

colors.dart
import 'package:flutter/material.dart';
const mobileBackgroundColor = Color.fromRGBO(0, 0, 0, 1);
const webBackgroundColor = Color.fromRGBO(32, 33, 36, 1);
const primaryColor = Colors.white;
const secondaryColor = Color.fromARGB(166, 158, 158, 158);
const blueColor = Color.fromRGBO(0, 149, 246, 1);
bottomNavigationBar:
bottomNavigationBar: CupertinoTabBar(
     onTap: (index){  _pageController.jumpToPage(index);   
        // change icon color  
      } 
     backgroundColor:  ...,
     items: [
      BottomNavigationBarItem(
        label: "...",
        icon: ...,)

 ]),
PageView()
PageView(
   onPageChanged: (index) {...}
   physics: NeverScrollableScrollPhysics(),      
   controller: _pageController,
   children: [...],
)

To control which page is visible in a PageView:

1- Create a PageController.final PageController _pageController = PageController();
2- Connect the PageController to a PageView().PageView( controller: _pageController, ),
3- Create a function to do what you want.CupertinoTabBar(
   onTap: (index) {
   // navigate to the tabed page
   _pageController.jumpToPage(index);
}
)
4- stop listening when the widget is deleted.@override
void dispose() {
   _pageController.dispose();
   super.dispose();
}

Download files

More infoPageController
PageView() video
BottomNavigationBar video

#3.1 Task solution

Download files

😡
انت مشغل الـ AdBlock !!

ياريت تقفله لوسمحت 😊 😊

تنبيه هام ✋

إذا كانت الإعلانات مزعجة بالنسبة لك، فيُمكنك التبرع ب50$ وسيتم إيقاف الإعلانات لمدة شهر لجميع زوار الموقع 🧡 ويُمكنك التواصل معنا عن طريق صفحة الفيس بوك