【发布时间】:2022-12-03 06:43:48
【问题描述】:
想自定义按钮的默认边框半径但是出现如下错误: “不能将参数类型‘MaterialStateProperty’分配给参数类型‘OutlinedBorder’”
Padding(
padding: const EdgeInsets.all(20.0),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0))),
elevation: 0,
primary: Colors.white,
minimumSize: const Size.fromHeight(50)),
onPressed: () {
Navigator.pushNamed(context, '/home');
// Navigator.of(context).pushReplacementNamed('/home');
},
child: const Text(
"Start",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18,
color: Color.fromRGBO(86, 96, 49, 1)),
)),
),
【问题讨论】:
标签: flutter error-handling flutter-layout syntax-error