【发布时间】:2020-03-12 04:59:13
【问题描述】:
我有这个底部导航栏项目,它有卡片作为它的列小部件子项。我试图将卡片内的凸起按钮作为尾随属性传递,但 onPressed() 函数在初始化时出错。它说“无效的常量值”。
List _widgetOptions = <Widget>[
Scaffold(
appBar: AppBar(
title: Text("Fines"),
),
body: Container(
child: SingleChildScrollView(
child: Column(
children: <Widget>[
Card(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
const ListTile(
title: Text('Fine ID: 3265'),
subtitle: Text('Fines: Crossing double line\novertaking on pedestrian crossing'),
trailing: RaisedButton(
onPressed: () {},//**this line is underlined in red. Error is here**
color: Colors.green,
child: Text('Pay'),
),
),
],
),
)
],
),
),
)),
];
【问题讨论】: