I'm trying to use Spacer() within the children of Listview, but it's not working the way it should. So I changed to column, as the Spacer() works fine in it. However I can't come to a implementation that simulates the responsivity and pixel overflow control as the Listview using column. Is there a better way to do this?
Code with list view:
return Drawer(
backgroundColor: CustomColours.vertraIce,
child: ListView(
padding: EdgeInsets.zero,
children: [
DrawerHeader(
decoration: BoxDecoration(
color: CustomColours.vertraBlue,
),
child: const Image(
image: AssetImage('assets/images/logo.webp'),
),
),
ListTile(
leading: const Icon(Icons.person),
title: Text(
'Perfil ',
style: TextStyle(
color: CustomColours.vertraBlack,
fontSize: 20,
),
),
onTap: () async {
await Navigator.popAndPushNamed(context, '/');
},
),
ListTile(
leading: const Icon(Icons.receipt_long),
title: Text(
'Notas',
style: TextStyle(
color: CustomColours.vertraBlack,
fontSize: 20,
),
),
onTap: () async {
await Navigator.popAndPushNamed(context, '/receipt');
},
),
const Spacer(),
const Divider(),
ListTile(
leading: const Icon(Icons.info_outlined),
title: Text(
'Sobre nós',
style: TextStyle(
color: CustomColours.vertraBlack,
fontSize: 20,
),
),
onTap: () async {
_launchURL();
},
),
ListTile(
leading: const Icon(Icons.logout),
title: Text(
'Sair',
style: TextStyle(
color: CustomColours.vertraBlack,
fontSize: 20,
),
),
onTap: () async {
authFirebase.signOut();
},
),
],
),
);
code with Column:
return Drawer(
backgroundColor: CustomColours.vertraIce,
child: Column(
children: [
DrawerHeader(
decoration: BoxDecoration(
color: CustomColours.vertraBlue,
),
child: const Image(
image: AssetImage('assets/images/logo.webp'),
),
),
ListTile(
leading: const Icon(Icons.person),
title: Text(
'Perfil ',
style: TextStyle(
color: CustomColours.vertraBlack,
fontSize: 20,
),
),
onTap: () async {
await Navigator.popAndPushNamed(context, '/');
},
),
ListTile(
leading: const Icon(Icons.receipt_long),
title: Text(
'Notas',
style: TextStyle(
color: CustomColours.vertraBlack,
fontSize: 20,
),
),
onTap: () async {
await Navigator.popAndPushNamed(context, '/receipt');
},
),
const Spacer(),
const Divider(),
ListTile(
leading: const Icon(Icons.info_outlined),
title: Text(
'Sobre nós',
style: TextStyle(
color: CustomColours.vertraBlack,
fontSize: 20,
),
),
onTap: () async {
_launchURL();
},
),
ListTile(
leading: const Icon(Icons.logout),
title: Text(
'Sair',
style: TextStyle(
color: CustomColours.vertraBlack,
fontSize: 20,
),
),
onTap: () async {
authFirebase.signOut();
},
),
],
),
);