如何添加滚动,以便多个文本答案可滚动?我曾尝试过使用SingleChildScrollView,但无法使滚动工作,文本答案消失并且页面无法滚动。
Widget build(BuildContext context) {
return Container(
width: double.infinity,
margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0),
child: RaisedButton(
padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 16.0),
color: Color(0xfff4f4f4),
textColor: Color(0xff3a3535),
child: Text(answerText, style: TextStyle(
fontFamily: 'VT323', fontSize: 22)),
onPressed: selectHandler,
),
decoration: BoxDecoration(
// color: Color.fromARGB(255, 238, 238, 238),
boxShadow: [
BoxShadow(offset: Offset(10, 10),color: Color.fromARGB(80, 0, 0, 0),blurRadius: 10),
BoxShadow(offset: Offset(-10, -10),color: Color.fromARGB(150, 255, 255, 255),blurRadius: 10)
],
),
);
}
}
0
投票
投票
尝试使用ListView:
Widget build(BuildContext context) {
return Container(
height: 100.0,
width: double.infinity,
margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0),
decoration: BoxDecoration(
// color: Color.fromARGB(255, 238, 238, 238),
boxShadow: [
BoxShadow(
offset: Offset(10, 10),
color: Color.fromARGB(80, 0, 0, 0),
blurRadius: 10),
BoxShadow(
offset: Offset(-10, -10),
color: Color.fromARGB(150, 255, 255, 255),
blurRadius: 10,
),
],
),
child: ListView(
children: <Widget>[
RaisedButton(
padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 16.0),
color: Color(0xfff4f4f4),
textColor: Color(0xff3a3535),
child: Text(answerText,
style: TextStyle(fontFamily: 'VT323', fontSize: 22)),
onPressed: () {},
),
],
),
);
}