1

I have a list of blog posts in the body and bottom navigation bar. I have to show the navigator button either page scroll up or down.

enter image description here

When we click on the button then navigator should pop up. Like this.

enter image description here

I have written the code but it is not working

import 'package:flutter/cupertino.dart';
import 'package:bottom_drawer/bottom_drawer.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';

class DrawerBack extends StatefulWidget {
 @override
_DrawerBack createState() => _DrawerBack();

}

class _DrawerBack extends State<DrawerBack> {

  bool isLoading = true;
  SharedPreferences? sharedPreferences;

@override
void initState() {
 super.initState();
}

@override
Widget build(BuildContext context) {
 return Scaffold(
  body: SafeArea(
      child:Container(
        child: Column(
          children:[
            buildBottomDrawer(context),
          ]
        ),
      )
  ),
);}

BottomDrawerController controller = BottomDrawerController();

 Widget buildBottomDrawer(BuildContext context) {
  return BottomDrawer(
   header: Container(
    child: Center(
      child: Container(
        height: 60,
        child: Image.asset('assets/image/up_arrow.png', height: 50, width: 50),
      ),
    ),
  ),

  body: Container(
    child: Column(
      children: [
        Padding(
          padding: EdgeInsets.all(10),
          child: Row(
            children: [
              Padding(
                padding: EdgeInsets.all(5),
                child: Column(
                  children: [
                    Image.asset("assets/image/Home.png"),
                    Text("Home",
                      style: TextStyle(color: Color(0xff8D8D8D),fontFamily: 'Manrope',
                        fontSize: 15,
                      ),
                    )
                  ],
                ),
              ),
              Spacer(),
              Padding(
                padding: EdgeInsets.all(5),
                child: Column(
                  children: [
                    Image.asset("assets/image/trends.png"),
                    Text("Trends",
                      style: TextStyle(color: Color(0xff8D8D8D),fontFamily: 'Manrope',
                        fontSize: 15,
                      ),
                    )
                  ],
                ),
              ),
              Spacer(),
              Padding(
                padding: EdgeInsets.all(5),
                child: Column(
                  children: [
                    Image.asset("assets/image/port.png"),
                    Text("Portfolio",
                      style: TextStyle(color: Color(0xff8D8D8D),fontFamily: 'Manrope',
                        fontSize: 15,
                      ),
                    )
                  ],
                ),
              ),
            ],
          ),
        ),
        Padding(
          padding: EdgeInsets.all(10),
          child: Row(
            children: [
              Spacer(),
              Spacer(),
              Padding(
                padding: EdgeInsets.all(5),
                child: Column(
                  children: [
                    Image.asset("assets/image/coins.png"),
                    Text("Coins",
                      style: TextStyle(color: Color(0xff8D8D8D),fontFamily: 'Manrope',
                        fontSize: 15,
                      ),
                    )
                  ],
                ),
              ),
              Spacer(),
              Padding(
                padding: EdgeInsets.all(5),
                child: Column(
                  children: [
                    Image.asset("assets/image/top.png"),
                    Text("Top Coins",
                      style: TextStyle(color: Color(0xff8D8D8D),fontFamily: 'Manrope',
                        fontSize: 15,
                      ),
                    )
                  ],
                ),
              ),
              Spacer(),
              Spacer(),
            ],
          ),
        ),
      ],
    ),
  ),

  headerHeight: 60.0,

  drawerHeight: MediaQuery.of(context).size.height *2,

  color: Colors.black,
  cornerRadius: 32,

  controller: controller,
 );}
}

So I have write this code when I see internet that we can make this using Bottom Drawer but it is not working I have seen the code on internet also and write the same code but it is not working yet.

So guys you can help me in this.

0 Answers0