我在Flutter中非常陌生,我想使注释后的容器能够滚动。 Nd我不想增加容器的高度如何实现此目的?除容器外,还有其他可使用的小部件吗? 我真的需要帮助,我在全球的所有亲爱的朋友都请帮助我寻找解决方案。
String dropdownValue = 'One';
Widget _DropDown(BuildContext context) {
return DropdownButton<String>(
value: dropdownValue,
icon: Icon(Icons.arrow_downward),
iconSize: 24,
elevation: 16,
style: TextStyle(
color: Colors.deepPurple
),
underline: Container(
height: 2,
color: Colors.deepPurpleAccent,
),
onChanged: (String newValue) {
setState(() {
dropdownValue = newValue;
});
},
items: dropdownvalue
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
})
.toList(),
);
}
Widget _myListView(BuildContext context) {
return ListView.separated(
itemCount:initialAttendance == null ? 0 : initialAttendance.length,
itemBuilder: (context, index) {
return Card(
elevation: 8.0,
child: ClipPath(
clipper: ShapeBorderClipper(shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(3))),
child: Container(
decoration: BoxDecoration(
border: Border(left: BorderSide(color: Color(0xffffc909), width: 5))),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: <Widget>[
Container(
child: Row(
children: <Widget>[
Container(
padding: EdgeInsets.only(left: 6),
child: Text(initialAttendance[index].toUpperCase(),style: TextStyle(fontWeight: FontWeight.bold),))
],
)
),
Container(
child: Row(
children: <Widget>[
Container(
padding: EdgeInsets.only(left: 6),
child: Text(initialAttendance1[index].toUpperCase(),style: TextStyle(fontWeight: FontWeight.bold),))
],
)
),
Container(
child: Row(
children: <Widget>[
Container(
padding: EdgeInsets.only(left: 6),
child: Text(initialAttendance2[index].toUpperCase(),style: TextStyle(fontWeight: FontWeight.bold),))
],
)
),
Container(
child: Row(
children: <Widget>[
Container(
padding: EdgeInsets.only(left: 6),
child: Text(initialAttendance3[index].toUpperCase(),style: TextStyle(fontWeight: FontWeight.bold),))
],
)
),
],
),
),
),
),
);
},
separatorBuilder: (context, index) {
return Divider();
},
);
}
return Scaffold(
appBar: AppBar(
title: new Text("Datesheet".toUpperCase() , style: TextStyle(
fontWeight: FontWeight.bold
), ),
backgroundColor: Color(0xff007ba4),
elevation: .1
),
body: ListView(
children: <Widget>[
Container(
height: 50,
child: Padding(
padding: const EdgeInsets.all(10.0),
child: _DropDown(context)
)
),
***Container( // I want this container to be scrollable
height: 600,
color: Color(0xff47b5be),
child: Padding(
padding: const EdgeInsets.all(10.0),
child: _myListView(context)
)***
)
]
),
);
}