I want a List Tile from my Menu at the bottom of the screen. I done it with a Sized box, it worked for my Nokia 7.1, but when I debug with another phone with a another resulution the solution doesn´t work, because I customized the box for the Nokia and not for another phones. Now I don´t konw how I can do it. I tried by using an Container istead of a Drawer, but it doesn´t slove the problem. Here is my Code:
return Drawer(
child: ListView(
physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.zero,
children: <Widget>[
DrawerHeader(
decoration: BoxDecoration(
color: Colors.green,
),
child: Text(
'Menü',
style: GoogleFonts.oswald(
textStyle: TextStyle(
color: Colors.black,
fontSize: 45,
)
),
),
),
[ListTiles] This is the List Tile I want at the bottom:
// this is my first attempt:
/*SizedBox(
height: 410,
),*/
ListTile(
leading: Icon(Icons.arrow_back_outlined,
color: Colors.black,
size: 30,
),
title: Text('Back',
style: GoogleFonts.raleway(
textStyle: TextStyle(
color: Colors.black,
fontSize: 30,
)
)
),
onTap: () => Navigator.pop(context),
),
],
),
);
CodePudding user response:
Judging by the ListView combined with physics: NeverScrollableScrollPhysics(), I think a refactor to the following solution might also work for you (condensed for brevity):
Drawer(child:
CustomScrollView(
physics: NeverScrollableScrollPhysics(),
slivers: <Widget>[
SliverToBoxAdapter(child:
Column(children: [
DrawerHeader(decoration: BoxDecoration(color: Colors.green), child: Text('Menü')),
// all of your list tiles
],
crossAxisAlignment: CrossAxisAlignment.stretch,
),
),
SliverFillRemaining(child:
Align(child:
ListTile(
leading: Icon(Icons.arrow_back_outlined, color: Colors.black, size: 30),
title: Text('Back'),
onTap: () => Navigator.pop(context),
),
alignment: Alignment.bottomCenter,
),
hasScrollBody: false,
)
],
)
)
