使用容器高度来滚动,并且使用 physics: AlwaysScrollableScrollPhysics()
和 controller: controller
。
Container(
width: 400,
child: Drawer(
child: Stack(children: [
Container(
height: MediaQuery.of(context).size.height-80,
child: ListView(
controller: controller,
padding: EdgeInsets.zero,
physics: AlwaysScrollableScrollPhysics(),
children: [
Container(
height: 300,
padding: EdgeInsets.symmetric(vertical: 20, horizontal: 10),
child: DrawerHeader(
child:Stack(children: [
Center(
child: Column(
children: [
nullCatcher(image) == "" ? Image.asset("assets/images/doctor.png",height: 90,width: 90,) : Image.network(
"$image",
height: 90,
width: 90,
),
SizedBox(width: 30,),
Text("$name",style: TextStyle(color: Colors.grey[700],fontWeight: FontWeight.bold,fontSize: 25),),
Text("$specialty",style: TextStyle(color: Colors.grey[600]),),
],
),
),
Positioned(
right: 0,bottom: 10,
child: Text("Version: 1.0.0",style: TextStyle(color: Colors.orange),))
],),
),
),
ListTile(
contentPadding: EdgeInsets.zero,
title: Container(
height: 70,
padding: EdgeInsets.symmetric(horizontal: 30),
decoration: drawerListDecoration,
child: Row(
children: [
Container(
height: 35,width: 35,
decoration: BoxDecoration(
color: Theme.of(context).accentColor,
borderRadius: BorderRadius.circular(100)
),
child: Icon(Icons.attach_file,color: Colors.white,size: 20,)),
SizedBox(width: 20,),
Text('Create Appointment'),
],
)),
onTap: () {
Navigator.pushReplacement(context, MaterialPageRoute(builder: (__)=>CreateAppointment()));
},
),
ListTile(
contentPadding: EdgeInsets.zero,
title: Container(
height: 70,
padding: EdgeInsets.symmetric(horizontal: 30),
decoration: drawerListDecoration,
child: Row(
children: [
Container(
height: 35,width: 35,
decoration: BoxDecoration(
color: Theme.of(context).accentColor,
borderRadius: BorderRadius.circular(100)
),
child: Icon(Icons.attach_file,color: Colors.white,size: 20,)),
SizedBox(width: 20,),
Text('Appointment / Prescription List'),
],
)),
onTap: () {
Navigator.pushReplacement(context, MaterialPageRoute(builder: (__)=>AppointmentList()));
},
),
Container(
height: 70,
padding: EdgeInsets.symmetric(horizontal: 30 ),
color: Colors.grey[200],
child: Row(
children: [
Container(
height: 35,width: 35,
decoration: BoxDecoration(
color: Theme.of(context).accentColor,
borderRadius: BorderRadius.circular(100)
),
child: Icon(Icons.attach_file,color: Colors.white,size: 20,)),
SizedBox(width: 20,),
Text("Clinical Options:",style: TextStyle(fontWeight: FontWeight.bold,color: Colors.grey[600]),),
],
),
),
ListTile(
contentPadding: EdgeInsets.zero,
title: Container(
height: childHeight,
padding: EdgeInsets.only(left: childPaddeing),
child: Row(
children: [
lineDesign(),
SizedBox(width: 20,),
Text('Chief Complain'),
],
)),
onTap: () {
Navigator.pushReplacement(context, MaterialPageRoute(builder: (__)=>AppointmentList()));
},
),
ListTile(
contentPadding: EdgeInsets.zero,
title: Container(
height: 50,
padding: EdgeInsets.symmetric(horizontal: 45),
decoration: drawerListDecoration,
child: Row(
children: [
lineDesign(),
SizedBox(width: 20,),
Text('On Examination'),
],
)),
onTap: () {
Navigator.pushReplacement(context, MaterialPageRoute(builder: (__)=>AppointmentList()));
},
),
ListTile(
contentPadding: EdgeInsets.zero,
title: Container(
height: 70,
padding: EdgeInsets.symmetric(horizontal: 30),
decoration: drawerListDecoration,
child: Row(
children: [
Container(
height: 35,width: 35,
decoration: BoxDecoration(
color: Theme.of(context).accentColor,
borderRadius: BorderRadius.circular(100)
),
child: Icon(Icons.attach_file,color: Colors.white,size: 20,)),
SizedBox(width: 20,),
Text('Examination Category'),
],
)),
onTap: () {
Navigator.pushReplacement(context, MaterialPageRoute(builder: (__)=>AppointmentList()));
},
),
ListTile(
contentPadding: EdgeInsets.zero,
title: Container(
height: 70,
padding: EdgeInsets.symmetric(horizontal: 30),
decoration: drawerListDecoration,
child: Row(
children: [
Container(
height: 35,width: 35,
decoration: BoxDecoration(
color: Theme.of(context).accentColor,
borderRadius: BorderRadius.circular(100)
),
child: Icon(Icons.attach_file,color: Colors.white,size: 20,)),
SizedBox(width: 20,),
Text('Diagnosis'),
],
)),
onTap: () {
Navigator.pushReplacement(context, MaterialPageRoute(builder: (__)=>AppointmentList()));
},
),
ListTile(
contentPadding: EdgeInsets.zero,
title: Container(
height: 70,
padding: EdgeInsets.symmetric(horizontal: 30),
decoration: drawerListDecoration,
child: Row(
children: [
Container(
height: 35,width: 35,
decoration: BoxDecoration(
color: Theme.of(context).accentColor,
borderRadius: BorderRadius.circular(100)
),
child: Icon(Icons.attach_file,color: Colors.white,size: 20,)),
SizedBox(width: 20,),
Text('Investigations'),
],
)),
onTap: () {
Navigator.pushReplacement(context, MaterialPageRoute(builder: (__)=>AppointmentList()));
},
),
],
),
),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: ButtonTheme(
child: RaisedButton(
color: Colors.red[900],
onPressed: (){
if(blocState is LogoutInLoading){}else logoutAlert(blocContext);
},
child: Container(
height: 70,
child:blocState is LogoutInLoading ? Container( height: 20,width: 20,margin: EdgeInsets.symmetric(vertical: 25), child: CircularProgressIndicator(valueColor: AlwaysStoppedAnimation(Colors.white),),) : Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Sign Out",style: TextStyle(color: Colors.white,fontWeight: FontWeight.bold,fontSize: 25),),
SizedBox(width: 20,),
Icon(Icons.logout,color: Colors.white,)
],
),
),
),
)
)
],),
),
);
ScrollController
,为什么不再允许滚动没有人回答这个问题。 - undefined