Remove drawer default divider in flutter

67 views Asked by At

I'm trying to remove a divider that is showed by default in the drawer under the drawer header shown in this image (It arrived with the 3.16 flutter version) : Drawer divider image

I tried following this post answers : Flutter DrawerHeader // How to get rid of divider

But it didn't work and created another divider on top of the current : Drawer with red divider on top

Here is my drawer code (not complete only with the drawer header part) :

class MyDrawer extends StatefulWidget {
  const MyDrawer({super.key});

  @override
  State<MyDrawer> createState() => _MyDrawerState();
}

class _MyDrawerState extends State<MyDrawer> {
  User? currentUser = Auth().currentUser;

  @override
  Widget build(BuildContext context) {
    return Drawer(
      elevation: 20,
      backgroundColor: Colpal.purple,
      child: Column(
        children: [
          SizedBox(
            height: 290,
            child: DrawerHeader(
              child: Column(children: [
                Stack(
                  children: [
                    IconButton(
                      onPressed: ()=>Navigator.pop(context), 
                      icon: Icon(Icons.close, color: Colpal.white,)
                    ),
                    Positioned(
                      child: Align(
                        alignment: Alignment.center,
                        child: GestureDetector(
                          onTap: () {
                            Navigator.pop(context);
                            Navigator.push(context, MaterialPageRoute(builder: (context) => ProfileScreen(uid: currentUser!.uid.toString(),),));
                            
                          },
                          child: GestureDetector(
                            child: SvgPicture.asset("assets/svg/export_icons/icons/iconUser.svg", height: 137,),
                          ),
                        ),
                      ),
                    ),
                    GestureDetector(
                      onTap: () {
                        Navigator.pop(context);
                        Navigator.push(context, MaterialPageRoute(builder: (context) => ProfileScreen(uid: currentUser!.uid.toString(),),));
                        
                      },
                      child: SizedBox(
                        height: 137,
                        width: double.infinity,
                        child: Center(
                          child: profilePicture(),
                        ),
                      ),
                    )
                  ],
                ),
          
                verticalSpacer(20),
                StreamBuilder<DocumentSnapshot>(  
                  stream: FirebaseFirestore.instance.collection('users').doc(currentUser!.uid).snapshots(),
                  builder: (context, snapshot) {
                    if (snapshot.hasData){
                      final userData = snapshot.data!.data() as Map<String, dynamic>;
                      if (userData['username']!=null){
                        return Text(
                          userData['username'],
                          style: TextStyle(
                            fontSize: 25,
                            color: Colpal.white,
                            fontWeight: FontWeight.w300
                          ),
                        );
                      }else{
                        return Text(
                          S.of(context).yourProfile,
                          style: TextStyle(
                            fontSize: 25,
                            color: Colpal.white,
                            fontWeight: FontWeight.w300
                          ),
                        );
                      }
                      
                    }
                    return Center(
                      child: CircularProgressIndicator(color: Colpal.white),
                    );
                },)
              ],)
            ),
          ),
0

There are 0 answers