1



class DashBoard extends StatefulWidget {
  static const route = '/dashboard';

  const DashBoard({super.key});
  @override
  _DashBoardState createState() => _DashBoardState();
}

class _DashBoardState extends State<DashBoard> {
  var appController = Get.find<AppController>();
  List<Widget> widgetArray = [Home(), UpdatedCircle(), Profile()];


  @override
  Widget build(BuildContext context) {
    return Scaffold(

      backgroundColor: Colors.white,
      body:widgetArray[appController.selectedIndex.value],
      bottomNavigationBar: Padding(
        padding: EdgeInsets.only(bottom: 30.0, left: 75.0, right: 75.0),
        child: Container(
          width: 182.w,
          height: 48.h,
          decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(15.w),
            boxShadow: const [
              BoxShadow(
                color: Color.fromRGBO(16, 31, 54, 0.12),
                blurRadius: 15.0, // soften the shadow
                spreadRadius: 5.0, //extend the shadow
                offset: Offset(
                  5.0, // Move to right 5  horizontally
                  5.0, // Move to bottom 5 Vertically
                ),
              )
            ],
          ),
          child: SingleChildScrollView(
            child: Column(
              children: [
                Stack(
                  alignment: Alignment.center,
                  children: [
                    FABBottomAppBar(
                      backgroundColor: Colors.white,
                      selectedColor: Colors.cyanAccent,
                      onTabSelected: didTapNavigationBar,
                      items: [
                        FABBottomAppBarItem(
                          image: Image.asset(
                            appController.selectedIndex.value == 0
                                ? AppIcon.purpleHome
                                : AppIcon.BlackHome,
                            width: 25,
                          ),
                        ),
                        FABBottomAppBarItem(
                          image: Image.asset(
                            appController.selectedIndex.value == 1
                                ? AppIcon.circleIcon
                                : AppIcon.circleIcon,
                            width: 25,
                            color: appController.selectedIndex.value == 1
                                ? Color(0xff8054D0)
                                : Colors.black,
                          ),
                        ),
                        FABBottomAppBarItem(
                          image: Image.asset(
                            appController.selectedIndex.value == 2
                                ? AppIcon.dashUserIcon
                                : AppIcon.dashUserIcon,
                            width: 25,
                            color: appController.selectedIndex.value == 2
                                ? Color(0xff8054D0)
                                : Colors.black,
                          ),
                        ),
                      ],
                      color: AppColors.appButtonBackgroundColor,
                    ),
                  ],
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }

  void didTapNavigationBar(int index) {
    setState(() {
      appController.selectedIndex.value = index;

    });
  }


class UpdatedCircle extends StatefulWidget {
  static const route = "/updatedCircle";
  const UpdatedCircle({Key? key}) : super(key: key);

  @override
  State<UpdatedCircle> createState() => _UpdatedCircleState();
}

class _UpdatedCircleState extends State<UpdatedCircle> {
  AppController appController = Get.find<AppController>();


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        elevation: 0.8,
        backgroundColor: Colors.white,

        leading: GestureDetector(
         onTap: (){
           appController.selectedIndex.value = 0;
         },
            child: SizedBox(
                height: 12.h,
                width: 5.73.w,
                child: Icon(

                  Icons.arrow_back_ios,
                  color: Colors.black,


            
              ),
            )),
        centerTitle: true,
        title: Text(
          "Circles",
          style: TextStyle(
              fontSize: 14.sp,
              fontFamily: "DmSans",
              fontWeight: FontWeight.w500,
              color: Color(0xff131F34)),
        ),
        actions: [
          Padding(
            padding: EdgeInsets.only(right: 26.w),
            child: const Icon(
              Icons.close,
              color: Colors.black,
            ),
          )
        ],

      ),
      backgroundColor: Colors.white,
     
  }
}

Set up your Flutter project and add the necessary dependencies.

Create a HomePage widget and a CirclePage widget. In this example, we'll use the MaterialApp widget as the entry point.

Define a BottomNavigationBar in the HomePage widget with the circle page arrow icon as one of the items.

Implement the onTap handler for the circle page arrow item to navigate back to the home page.

i want to back on bottombar home page click on circle page arrow solve my problem as soon its argent for me and i hope any one solve my problem in flutter

0 Answers0